Re: [RFC PATCH 1/1] completion: load completion file for external subcommand
- From
Florian Gamböck <mail@floga.de>
- Date
- Apr 9, 2018, 07:29 UTC
- Message-ID
- <20180409072909.GA30684@arbeitsviech>
- In-Reply-To
- <xmqq37059uez.fsf@gitster-ct.c.googlers.com>
On 2018-04-09 07:59, Junio C Hamano wrote:
Show 15 quoted lines
> > local completion_func="_git_${command//-/_}"
> > + if ! declare -f $completion_func >/dev/null 2>/dev/null; then
> > + declare -f __load_completion >/dev/null 2>/dev/null &&
> > + __load_completion "git-$command"
>
> wouldn't the above be easier to read if it were
>
> if ! declare ... $completion_func ... && declare -f __load_completion
> then
> __load_completion "git-$command"
> fi
>
> or is there a reason why it is better to &&-chain the check for
> __load_completion with its use? Same comment applies to the other
> hunk.Good point. I could go even further and ditch the if-construct:
! declare -f $completion_func && declare -f __load_completion &&
__load_completion "git-$command"I originally intended to do a if-else-construct, which I re-thought halfway through. I will change that in the next iteration.
Thank you!
-- Regards Florian