bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] compgen -V option (store output in array)


From: Koichi Murase
Subject: Re: [PATCH] compgen -V option (store output in array)
Date: Tue, 18 Apr 2023 05:35:26 +0900

2023年4月18日(火) 0:59 Chet Ramey <chet.ramey@case.edu>:
> Once you have -V, isn't -z superfluous? It's just
>
> compgen -V varname options word
> printf '%s\0' "${varname[@]}"
>
> right? What am I missing?

You are right. Actually, when I implemented -z, I also initially
thought about the possibility to add an option to store results in a
specified array. Then, after looking at the codebase of
bash-completion and thinking about the actual use cases, I decided to
switch to the flag -z, but I actually don't remember the exact reason
I finally switched to -z. (Maybe it was because when I submit a patch
to bash-completion, it is easier to explain the code using mapfile,
which is already used in bash-completion, than using printf '%s\0',
which the maintainer might not be comfortable with).

I thought about it again and I now feel -V is better if one needs to
choose one from -V and -z.

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]