Thread (1 message) 1 message, 1 author, 2021-10-23

Re: [PATCH v2 10/10] generate-cmdlist.sh: replace "cut", "tr" and "grep" with pure-shell

From: Junio C Hamano <hidden>
Date: 2021-10-23 22:26:07

Ævar Arnfjörð Bjarmason  [off-list ref] writes:
Extend the pure-shell parsing of command-list.txt by using having
using having???
command_list() take an argument indicating whether we're interested in
the "$cmd" part of the line, or just the "$rest".
OK, --no-cat stands for --no-category?  Even if (or especially if,
perhaps) you do not bother to parse the option in the command_list
helper, it would help the readers if it is spelled out.  I somehow
thought if this option has anything to do with "/bin/cat".
That takes care of the "cut -d", and printf's auto-repeat feature can
replace the "tr". We don't need the "grep -v" either, as we're not
emitting any empty lines here (the command-list.txt doesn't have any).
It may make sense to ensure that the case arm won't feed an empty 
line that made cmd an empty by tightening the condition.

	case "$cmd" in
	"#"*)
		continue
		;; 
-	*)
+	?*)
		case "$exclude_programs" in
		*:"$cmd":*)
			;;

If anything, that would serve as a clear documentation that we are
safe even when the input has an empty line.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help