From: Danh Doan Date: Thu, 06 Feb 2020 01:35:33 GMT Subject: Re: [PATCH v6 01/15] help: move list_config_help to builtin/help Message-ID: <20200206013533.GA3993@danh.dev> In-Reply-To: <20200206004108.261317-2-emilyshaffer@google.com> On 2020-02-05 16:40:54-0800, Emily Shaffer wrote: > diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh > index 71158f7d8b..45fecf8bdf 100755 > --- a/generate-cmdlist.sh > +++ b/generate-cmdlist.sh > @@ -76,23 +76,6 @@ print_command_list () { > echo "};" > } > > -print_config_list () { > - cat < -static const char *config_name_list[] = { > -EOF > - grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | > - sed '/deprecated/d; s/::$//; s/, */\n/g' | > - sort | > - while read line > - do > - echo " \"$line\"," > - done > - cat < - NULL, > -}; > -EOF > -} > - > exclude_programs= > while test "--exclude-program" = "$1" > do > @@ -113,5 +96,3 @@ echo > define_category_names "$1" > echo > print_command_list "$1" > -echo > -print_config_list > diff --git a/generate-configlist.sh b/generate-configlist.sh > new file mode 100755 > index 0000000000..eca6a00c30 > --- /dev/null > +++ b/generate-configlist.sh > @@ -0,0 +1,24 @@ > +#!/bin/sh > + > +echo "/* Automatically generated by generate-configlist.sh */" > +echo > + > +print_config_list () { > + cat < +static const char *config_name_list[] = { > +EOF > + grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | > + sed '/deprecated/d; s/::$//; s/, */\n/g' | > + sort | > + while read line > + do > + echo " \"$line\"," > + done This while-read-echo was moved from generate-cmdlist.sh, which has some logic to work with read-variable. We're moving it out, I think apply this diff on top of it will make the code easier to read. diff --git a/generate-configlist.sh b/generate-configlist.sh index eca6a00c30..163dbf30bb 100755 --- a/generate-configlist.sh +++ b/generate-configlist.sh @@ -10,10 +10,7 @@ EOF grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | sed '/deprecated/d; s/::$//; s/, */\n/g' | sort | - while read line - do - echo " \"$line\"," - done + sed 's/^/ "/; s/$/",/' cat <