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>
This commit is contained in:
parent
0371a764d2
commit
e7a9807a62
@ -302,7 +302,7 @@ $(cmds_txt): cmd-list.made
|
|||||||
|
|
||||||
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
|
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
|
||||||
$(QUIET_GEN)$(RM) $@ && \
|
$(QUIET_GEN)$(RM) $@ && \
|
||||||
$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
|
$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
|
||||||
date >$@
|
date >$@
|
||||||
|
|
||||||
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
|
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
|
||||||
|
@ -38,12 +38,15 @@ sub format_one {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (<>) {
|
my ($input, @categories) = @ARGV;
|
||||||
|
|
||||||
|
open IN, "<$input";
|
||||||
|
while (<IN>) {
|
||||||
last if /^### command list/;
|
last if /^### command list/;
|
||||||
}
|
}
|
||||||
|
|
||||||
my %cmds = ();
|
my %cmds = ();
|
||||||
for (sort <>) {
|
for (sort <IN>) {
|
||||||
next if /^#/;
|
next if /^#/;
|
||||||
|
|
||||||
chomp;
|
chomp;
|
||||||
@ -51,17 +54,10 @@ for (sort <>) {
|
|||||||
$attr = '' unless defined $attr;
|
$attr = '' unless defined $attr;
|
||||||
push @{$cmds{$cat}}, [$name, " $attr "];
|
push @{$cmds{$cat}}, [$name, " $attr "];
|
||||||
}
|
}
|
||||||
|
close IN;
|
||||||
|
|
||||||
for my $cat (qw(ancillaryinterrogators
|
for my $out (@categories) {
|
||||||
ancillarymanipulators
|
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
|
||||||
mainporcelain
|
|
||||||
plumbinginterrogators
|
|
||||||
plumbingmanipulators
|
|
||||||
synchingrepositories
|
|
||||||
foreignscminterface
|
|
||||||
purehelpers
|
|
||||||
synchelpers)) {
|
|
||||||
my $out = "cmds-$cat.txt";
|
|
||||||
open O, '>', "$out+" or die "Cannot open output file $out+";
|
open O, '>', "$out+" or die "Cannot open output file $out+";
|
||||||
for (@{$cmds{$cat}}) {
|
for (@{$cmds{$cat}}) {
|
||||||
format_one(\*O, $_);
|
format_one(\*O, $_);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user