Re: [PATCH v4/wip 02/12] generate-cmds.sh: export all commands to command-list.h
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Apr 29, 2018, 16:11 UTC
- Message-ID
- <CACsJy8AzAFVhQw-K_juFg2iF0tVHo0_fF-CRYwMR=xPcTUC-8Q@mail.gmail.com>
- In-Reply-To
- <CAPig+cQ-ZfvHD6B-mK6tOBMdKiVzwz15M4rsOdBMBcgu0OmuxA@mail.gmail.com>
On Wed, Apr 25, 2018 at 8:07 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 26 quoted lines
> On Wed, Apr 25, 2018 at 12:30 PM, Nguyễn Thái Ngọc Duy
> <pclouds@gmail.com> wrote:
>> The current generate-cmds.sh generates just enough to print "git help"
>> output. That is, it only extracts help text for common commands.
>>
>> The script is now updated to extract help text for all commands and
>> keep command classification a new file, command-list.h. This will be
>> useful later:
>> [...]
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>> diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
>> @@ -12,14 +34,51 @@ get_synopsis () {
>> +define_categories() {
>> + echo
>> + echo "/* Command categories */"
>> + bit=0
>> + category_list "$1" |
>> + while read cat
>> + do
>> + echo "#define CAT_$cat (1UL << $bit)"
>> + bit=$(($bit+1))
>> + done
>> + test "$bit" -gt 32 && die "Urgh.. too many categories?"
>
> Should this be '-ge' rather than '-gt'?After we print "1UL << 31" we increment it to 32 and exit the loop, then it's still within limits, -ge would incorrectly complain
-- Duy