git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Florian Gamböck" <mail@floga.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Szeder Gábor" <szeder.dev@gmail.com>
Subject: Re: [RFC PATCH 1/1] completion: load completion file for external subcommand
Date: Mon, 9 Apr 2018 09:29:09 +0200	[thread overview]
Message-ID: <20180409072909.GA30684@arbeitsviech> (raw)
In-Reply-To: <xmqq37059uez.fsf@gitster-ct.c.googlers.com>

On 2018-04-09 07:59, Junio C Hamano wrote:
> >  	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

  reply	other threads:[~2018-04-09  7:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08 18:26 [RFC PATCH 0/1] completion: Dynamic completion loading Florian Gamböck
2018-04-08 18:26 ` [RFC PATCH 1/1] completion: Load completion file for external subcommand Florian Gamböck
2018-04-08 18:29   ` Florian Gamböck
2018-04-09 18:26   ` Stefan Beller
2018-04-09 18:26     ` Stefan Beller
2018-04-09 19:49     ` Florian Gamböck
2018-04-19 14:12       ` SZEDER Gábor
2018-04-08 18:26 ` [RFC PATCH 1/1] completion: load " Florian Gamböck
2018-04-08 22:59   ` Junio C Hamano
2018-04-09  7:29     ` Florian Gamböck [this message]
2018-04-09  9:36       ` Junio C Hamano
2018-04-09 13:36         ` Florian Gamböck
2018-04-09 22:06           ` Junio C Hamano
2018-04-10  9:37             ` Florian Gamböck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180409072909.GA30684@arbeitsviech \
    --to=mail@floga.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).