git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Junio C Hamano via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Philip Oakley" <philipoakley@iee.email>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Philippe Blain" <levraiphilippeblain@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH v3 3/4] Documentation: don't hardcode command categories twice
Date: Wed, 05 Aug 2020 01:19:06 +0000	[thread overview]
Message-ID: <552444a84241d280640c4700f17477a9c297fb73.1596590347.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.691.v3.git.1596590347.gitgitgadget@gmail.com>

From: Junio C Hamano <gitster@pobox.com>

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>
---
 Documentation/Makefile      |  2 +-
 Documentation/cmd-list.perl | 20 ++++++++------------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 39f6fc8de7..eb9c7e2b0e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -302,7 +302,7 @@ $(cmds_txt): cmd-list.made
 
 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 	$(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 >$@
 
 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
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 @@ sub format_one {
 	$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, $_);
-- 
gitgitgadget


  parent reply	other threads:[~2020-08-05  1:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 15:20 [PATCH 0/3] [RFC] List all guides in git(1) Philippe Blain via GitGitGadget
2020-08-02 15:20 ` [PATCH 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
2020-08-02 15:20 ` [PATCH 2/3] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
2020-08-02 15:20 ` [PATCH 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
2020-08-02 21:44   ` Junio C Hamano
2020-08-02 22:05     ` Junio C Hamano
2020-08-03 14:16       ` Philippe Blain
2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
2020-08-04  0:20   ` [PATCH v2 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
2020-08-04  0:20   ` [PATCH v2 2/3] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
2020-08-04  0:20   ` [PATCH v2 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
2020-08-04  0:26   ` [PATCH v2 0/3] List all guides in git(1) Junio C Hamano
2020-08-04 13:44     ` Philippe Blain
2020-08-05  1:19   ` [PATCH v3 0/4] " Philippe Blain via GitGitGadget
2020-08-05  1:19     ` [PATCH v3 1/4] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
2020-08-05  1:19     ` [PATCH v3 2/4] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
2020-08-05  1:19     ` Junio C Hamano via GitGitGadget [this message]
2020-08-05  1:19     ` [PATCH v3 4/4] git.txt: add list of guides Philippe Blain via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=552444a84241d280640c4700f17477a9c297fb73.1596590347.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=philipoakley@iee.email \
    --cc=sunshine@sunshineco.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).