]> Dogcows Code - chaz/git-codeowners/blob - bin/git-codeowners
use Text::Table::Any for table formatting
[chaz/git-codeowners] / bin / git-codeowners
1 #! perl
2 # ABSTRACT: A tool for managing CODEOWNERS files
3 # PODNAME: git-codeowners
4
5 =head1 SYNOPSIS
6
7 git-codeowners [--version|--help|--manual]
8
9 git-codeowners [show] [--format FORMAT] [--[no-]project] [PATH...]
10
11 git-codeowners owners [--format FORMAT] [--pattern PATTERN]
12
13 git-codeowners patterns [--format FORMAT] [--owner OWNER]
14
15 git-codeowners create|update [REPO_DIRPATH|CODEOWNERS_FILEPATH]
16
17 # enable bash shell completion
18 eval "$(git-codeowners --shell-completion)"
19
20 =head1 DESCRIPTION
21
22 F<git-codeowners> is yet another CLI tool for managing F<CODEOWNERS> files in
23 git repos. In particular, it can be used to quickly find out who owns
24 a particular file in a monorepo (or monolith).
25
26 B<THIS IS EXPERIMENTAL!> The interface of this tool and its modules will
27 probably change as I field test some things. Feedback welcome.
28
29 =head1 OPTIONS
30
31 =head2 --version
32
33 Print the program name and version to C<STDOUT>, and exit.
34
35 Alias: C<-v>
36
37 =head2 --help
38
39 Print the synopsis to C<STDOUT>, and exit.
40
41 Alias: C<-h>
42
43 You can also use C<--manual> to print the full documentation.
44
45 =head2 --color
46
47 Enable colorized output.
48
49 Color is ON by default on terminals; use C<--no-color> to disable. Some environment variables may
50 also alter the behavior of colorizing output:
51
52 =for :list
53 * C<NO_COLOR> - Set to disable color (same as C<--no-color>).
54 * C<COLOR_DEPTH> - Set the number of supportable colors (e.g. 0, 16, 256, 16777216).
55
56 =head2 --format
57
58 Specify the output format to use. See L</FORMAT>.
59
60 Alias: C<-f>
61
62 =head2 --shell-completion
63
64 eval "$(lintany --shell-completion)"
65
66 Print shell code to enable completion to C<STDOUT>, and exit.
67
68 Does not yet support Zsh...
69
70 =head1 COMMANDS
71
72 =head2 show
73
74 git-codeowners [show] [--format FORMAT] [--[no-]project] [PATH...]
75
76 Show owners of one or more files in a repo.
77
78 =head2 owners
79
80 git-codeowners owners [--format FORMAT] [--pattern PATTERN]
81
82 =head2 patterns
83
84 git-codeowners patterns [--format FORMAT] [--owner OWNER]
85
86 =head2 create
87
88 git-codeowners create [REPO_DIRPATH|CODEOWNERS_FILEPATH]
89
90 Create a new F<CODEOWNERS> file for a specified repo (or current directory).
91
92 =head2 update
93
94 git-codeowners update [REPO_DIRPATH|CODEOWNERS_FILEPATH]
95
96 Update the "unowned" list of an existing F<CODEOWNERS> file for a specified
97 repo (or current directory).
98
99 =head1 FORMAT
100
101 The C<--format> argument can be one of:
102
103 =for :list
104 * C<csv> - Comma-separated values (requires L<Text::CSV>)
105 * C<json:pretty> - Pretty JSON (requires L<JSON::MaybeXS>)
106 * C<json> - JSON (requires L<JSON::MaybeXS>)
107 * C<table> - Table (requires L<Text::Table::Any>)
108 * C<tsv> - Tab-separated values (requires L<Text::CSV>)
109 * C<yaml> - YAML (requires L<YAML>)
110 * C<FORMAT> - Custom format (see below)
111
112 =head2 Custom
113
114 You can specify a custom format using printf-like format sequences. These are the items that can be
115 substituted:
116
117 =for :list
118 * C<%F> - Filename
119 * C<%O> - Owner or owners
120 * C<%P> - Project
121 * C<%T> - Pattern
122 * C<%n> - newline
123 * C<%t> - tab
124 * C<%%> - percent sign
125
126 The syntax also allows padding and some filters. Examples:
127
128 git-codeowners show -f ' * %-50F %O' # default for "show"
129 git-codeowners show -f '%{quote}F,%{quote}O' # ad hoc CSV
130 git-codeowners patterns -f '--> %{color:0c0}T' # whatever...
131
132 Available filters:
133
134 =for :list
135 * C<quote> - Quote the replacement string.
136 * C<color:FFFFFF> - Colorize the replacement string (if color is ON).
137 * C<nocolor> - Do not colorize replacement string.
138
139 =head2 Table
140
141 Table formatting can be done by one of several different modules, each with its own features and
142 bugs. The default module is L<Text::Table::Tiny>, but this can be overridden using the
143 C<PERL_TEXT_TABLE> environment variable if desired, like this:
144
145 PERL_TEXT_TABLE=Text::Table::HTML git-codeowners -f table
146
147 The list of available modules is at L<Text::Table::Any/@BACKENDS>.
148
149 =cut
150
151 # FATPACK - Do not remove this line.
152
153 use warnings;
154 use strict;
155
156 use App::Codeowners;
157
158 our $VERSION = '9999.999'; # VERSION
159
160 App::Codeowners->main(@ARGV);
This page took 0.03459 seconds and 4 git commands to generate.