From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?U8OpYmFzdGllbiBHdWltbWFyYQ==?= Subject: [PATCH v3 2/4] generate-cmdlist.sh: parse common command groups Date: Sun, 03 May 2015 02:22:24 +0200 Message-ID: <55456A40.80806@gmail.com> References: <554405D5.9080702@gmail.com> <55456990.6000509@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Luke Diamand , Andreas Schwab , Junio C Hamano , =?UTF-8?B?U8OpYmFzdGllbiBHdWltbWFyYQ==?= To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sun May 03 02:22:34 2015 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yohg0-0008IH-UX for gcvg-git-2@plane.gmane.org; Sun, 03 May 2015 02:22:33 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751527AbbECAW3 convert rfc822-to-quoted-printable (ORCPT ); Sat, 2 May 2015 20:22:29 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:38760 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751390AbbECAW2 (ORCPT ); Sat, 2 May 2015 20:22:28 -0400 Received: by wiun10 with SMTP id n10so78450208wiu.1 for ; Sat, 02 May 2015 17:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=NVjf6K4wlUoa9R5Jswnk2bPYEh5NZBLYqtfphlpcw6s=; b=S7RNnGxy7Xka7mye99EW36s0StY5jpAJV2ABFgQIHZZp6gL52RP1f7zMoHZms3Y0pY 8Eh0cNU24D4nSrUrqVPmHBIYf3+m2zo7G0+RpCz76ds+iOaOIgx++lXVFEbu1Ueysqp9 b1LKlNb3Mtyyk6A7QMddPnqiwnMIRCfyQRBofD8Tx/Y2b6eA2xQ7WFCAk88enjAA1IyN Fr8iDkNntQLNQ0acFXxlu/Ez+ITp8avsdXaP3ozeZJJSAdxPgTFUAQR/xguxItKXWuq3 g0LZpnykvJVokO00VdLUoImLr7a93raWPUi66TcUXDrrL1LI/TWuH+1NcTCmVonWkJXs dizA== X-Received: by 10.180.90.72 with SMTP id bu8mr7975896wib.62.1430612546712; Sat, 02 May 2015 17:22:26 -0700 (PDT) Received: from [192.168.0.10] (bd231-1-88-176-208-17.fbx.proxad.net. [88.176.208.17]) by mx.google.com with ESMTPSA id i6sm13793562wjf.29.2015.05.02.17.22.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 May 2015 17:22:26 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <55456990.6000509@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Teach generate-cmdlist.sh to parse common command groups found in command-list.txt in the form common-3_worktree ('3_worktree' being the group identifier) Extract the $grp variable, in addition to the previous $cmd, and inject it as a third field in the cmdname_help struct: {"add", N_("Add file contents to the index"), "3_worktree"}, So that when 'git' is called, we can display common commands grouped by theme instead of a less useful alphabetical order. Reviewed by: Luke Diamand Reviewed by: Andreas Schwab Signed-off-by: S=C3=A9bastien Guimmara --- generate-cmdlist.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 9a4c9b9..98f937b 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -4,19 +4,20 @@ echo "/* Automatically generated by $0 */ struct cmdname_help { char name[16]; char help[80]; + char group[20]; }; =20 static struct cmdname_help common_cmds[] =3D {" =20 -sed -n -e 's/^git-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt | +sed -n -e 's/^git-\([^ ]*\)[ ].* common-\(.*\)/\1:\2/p' command-list= =2Etxt | sort | -while read cmd +while IFS=3D: read cmd grp do sed -n ' /^NAME/,/git-'"$cmd"'/H ${ x - s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", N_("\1")},/ + s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", N_("\1"), "'"$grp"'"},/ p }' "Documentation/git-$cmd.txt" done --=20 2.4.0