diff options
author | Philippe Blain <levraiphilippeblain@gmail.com> | 2020-08-05 01:19:07 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-04 18:34:02 -0700 |
commit | f442f28a81b56d99b803be221ba397f2a586c88e (patch) | |
tree | 59552f2b6d409a194e4fccea9bde9d00b06954be /Documentation/cmd-list.perl | |
parent | e7a9807a627772f795d5105be497fd648611bc70 (diff) | |
download | git-f442f28a81b56d99b803be221ba397f2a586c88e.tar.gz |
git.txt: add list of guides
Not all man5/man7 guides are mentioned in the 'git(1)' documentation,
which makes the missing ones somewhat hard to find.
Add a list of the guides to git(1) by leveraging the existing
`Documentation/cmd-list.perl` script to generate a file `cmds-guide.txt`
which gets included in git.txt.
Also, do not hard-code the manual section '1'. Instead, use a regex so
that the manual section is discovered from the first line of each
`git*.txt` file.
This addition was hinted at in 1b81d8cb19 (help: use command-list.txt
for the source of guides, 2018-05-20).
Helped-by: Junio C Hamano <gitster@pobox.com>
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 | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl index ee96de53db..af5da45d28 100755 --- a/Documentation/cmd-list.perl +++ b/Documentation/cmd-list.perl @@ -6,9 +6,14 @@ sub format_one { my ($out, $nameattr) = @_; my ($name, $attr) = @$nameattr; my ($state, $description); + my $mansection; $state = 0; open I, '<', "$name.txt" or die "No such file $name.txt"; while (<I>) { + if (/^git[a-z0-9-]*\(([0-9])\)$/) { + $mansection = $1; + next; + } if (/^NAME$/) { $state = 1; next; @@ -27,7 +32,7 @@ sub format_one { die "No description found in $name.txt"; } if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) { - print $out "linkgit:$name\[1\]::\n\t"; + print $out "linkgit:$name\[$mansection\]::\n\t"; if ($attr =~ / deprecated /) { print $out "(deprecated) "; } |