diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-08-05 04:19:06 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-05 04:34:02 +0300 |
commit | e7a9807a627772f795d5105be497fd648611bc70 (patch) | |
tree | b6e368157ee18b05ef1b8ddfa53eb604b13a0017 /Documentation/cmd-list.perl | |
parent | 0371a764d2db05e13a87bc1fc16600a1a576e9fe (diff) |
Documentation: don't hardcode command categories twice
Instead of hard-coding the list of command categories in both
`Documentation/Makefile` and `Documentation/cmd-list.perl`, make the
Makefile the authoritative source and tweak `cmd-list.perl` so that it
receives the list of command categories as argument.
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/cmd-list.perl')
-rwxr-xr-x | Documentation/cmd-list.perl | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl index 5aa73cfe45..ee96de53db 100755 --- a/Documentation/cmd-list.perl +++ b/Documentation/cmd-list.perl @@ -38,12 +38,15 @@ sub format_one { } } -while (<>) { +my ($input, @categories) = @ARGV; + +open IN, "<$input"; +while (<IN>) { last if /^### command list/; } my %cmds = (); -for (sort <>) { +for (sort <IN>) { next if /^#/; chomp; @@ -51,17 +54,10 @@ for (sort <>) { $attr = '' unless defined $attr; push @{$cmds{$cat}}, [$name, " $attr "]; } +close IN; -for my $cat (qw(ancillaryinterrogators - ancillarymanipulators - mainporcelain - plumbinginterrogators - plumbingmanipulators - synchingrepositories - foreignscminterface - purehelpers - synchelpers)) { - my $out = "cmds-$cat.txt"; +for my $out (@categories) { + my ($cat) = $out =~ /^cmds-(.*)\.txt$/; open O, '>', "$out+" or die "Cannot open output file $out+"; for (@{$cmds{$cat}}) { format_one(\*O, $_); |