2 # ABSTRACT: A tool for managing CODEOWNERS files
3 # PODNAME: git-codeowners
7 git-codeowners [--version|--help|--manual]
9 git-codeowners [show] [--format FORMAT] [--owner OWNER]...
10 [--pattern PATTERN]... [--[no-]patterns]
11 [--project PROJECT]... [--[no-]projects] [PATH...]
13 git-codeowners owners [--format FORMAT] [--pattern PATTERN]
15 git-codeowners patterns [--format FORMAT] [--owner OWNER]
17 git-codeowners create|update [REPO_DIRPATH|CODEOWNERS_FILEPATH]
19 # enable bash shell completion
20 eval "$(git-codeowners --shell-completion)"
24 F<git-codeowners> is yet another CLI tool for managing F<CODEOWNERS> files in git repos. In
25 particular, it can be used to quickly find out who owns a particular file in a monorepo (or
28 B<THIS IS EXPERIMENTAL!> The interface of this tool and its modules will probably change as I field
29 test some things. Feedback welcome.
33 There are several ways to install F<git-codeowners> to your system.
37 You can install F<git-codeowners> using L<cpanm>:
43 You can also choose to download F<git-codeowners> as a self-contained executable:
45 curl -OL https://raw.githubusercontent.com/chazmcgarvey/git-codeowners/solo/git-codeowners
46 chmod +x git-codeowners
48 To hack on the code, clone the repo instead:
50 git clone https://github.com/chazmcgarvey/git-codeowners.git
52 make bootstrap # installs dependencies; requires cpanm
58 Print the program name and version to C<STDOUT>, and exit.
64 Print the synopsis to C<STDOUT>, and exit.
68 You can also use C<--manual> to print the full documentation.
72 Enable colorized output.
74 Color is ON by default on terminals; use C<--no-color> to disable. Some environment variables may
75 also alter the behavior of colorizing output:
78 * C<NO_COLOR> - Set to disable color (same as C<--no-color>).
79 * C<COLOR_DEPTH> - Set the number of supportable colors (e.g. 0, 16, 256, 16777216).
83 Specify the output format to use. See L</FORMAT>.
87 =head2 --shell-completion
89 eval "$(lintany --shell-completion)"
91 Print shell code to enable completion to C<STDOUT>, and exit.
93 Does not yet support Zsh...
99 git-codeowners [show] [--format FORMAT] [--owner OWNER]...
100 [--pattern PATTERN]... [--[no-]patterns]
101 [--project PROJECT]... [--[no-]projects] [PATH...]
103 Show owners of one or more files in a repo.
105 If C<--owner>, C<--project>, C<--pattern> are set, only show files with matching
106 criteria. These can be repeated.
108 Use C<--patterns> to also show the matching pattern associated with each file.
110 By default the output might show associated projects if the C<CODEOWNERS> file
111 defines them. You can control this by explicitly using C<--projects> or
112 C<--no-projects> to always show or always hide defined projects, respectively.
116 git-codeowners owners [--format FORMAT] [--pattern PATTERN]
118 List all owners defined in the F<CODEOWNERS> file.
122 git-codeowners patterns [--format FORMAT] [--owner OWNER]
124 List all patterns defined in the F<CODEOWNERS> file.
128 git-codeowners create [REPO_DIRPATH|CODEOWNERS_FILEPATH]
130 Create a new F<CODEOWNERS> file for a specified repo (or current directory).
134 git-codeowners update [REPO_DIRPATH|CODEOWNERS_FILEPATH]
136 Update the "unowned" list of an existing F<CODEOWNERS> file for a specified
137 repo (or current directory).
141 The C<--format> argument can be one of:
144 * C<csv> - Comma-separated values (requires L<Text::CSV>)
145 * C<json:pretty> - Pretty JSON (requires L<JSON::MaybeXS>)
146 * C<json> - JSON (requires L<JSON::MaybeXS>)
147 * C<table> - Table (requires L<Text::Table::Any>)
148 * C<tsv> - Tab-separated values (requires L<Text::CSV>)
149 * C<yaml> - YAML (requires L<YAML>)
150 * C<FORMAT> - Custom format (see below)
154 You can specify a custom format using printf-like format sequences. These are the items that can be
159 * C<%O> - Owner or owners
164 * C<%%> - percent sign
166 The syntax also allows padding and some filters. Examples:
168 git-codeowners show -f ' * %-50F %O' # default for "show"
169 git-codeowners show -f '%{quote}F,%{quote}O' # ad hoc CSV
170 git-codeowners patterns -f '--> %{color:0c0}T' # whatever...
175 * C<quote> - Quote the replacement string.
176 * C<color:FFFFFF> - Colorize the replacement string (if color is ON).
177 * C<nocolor> - Do not colorize replacement string.
181 Table formatting can be done by one of several different modules, each with its own features and
182 bugs. The default module is L<Text::Table::Tiny>, but this can be overridden using the
183 C<PERL_TEXT_TABLE> environment variable if desired, like this:
185 PERL_TEXT_TABLE=Text::Table::HTML git-codeowners -f table
187 The list of available modules is at L<Text::Table::Any/@BACKENDS>.
192 * Some commands require F<git> (at least version 1.8.5).
196 # FATPACK - Do not remove this line.
203 our $VERSION = '9999.999'; # VERSION
205 App::Codeowners->main(@ARGV);