git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2 01/41] parse-options: support --git-completion-helper
Date: Thu, 1 Feb 2018 17:21:38 +0700	[thread overview]
Message-ID: <CACsJy8D5iGVDHKoMeQjm+Seea_pTixsb8Xq6D1w17Y9M42iAPw@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cSLYDJaxCyAH_zK0cat2-60OZGWGy_ZLHwitHfZ7oA78w@mail.gmail.com>

On Thu, Feb 1, 2018 at 4:54 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Wed, Jan 31, 2018 at 7:05 PM, Duy Nguyen <pclouds@gmail.com> wrote:
>> On Thu, Feb 1, 2018 at 4:04 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>>> On Wed, Jan 31, 2018 at 6:05 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>>>> Dangerous/Unpopular
>>>> options could be hidden with the new "NOCOMPLETE" flag.
>>>
>>> I wonder if this option should be named DANGEROUS rather than
>>> NOCOMPLETE to better reflect its intention.
>>
>> It's not only for dangerous options (I forgot to mention this in the
>> commit message, I will in v3). The --continue|--abort|--skip should
>> only show up when you are in a middle of rebase/am/cherry-pick.
>> git-completion.bash handles this case separately and only put them in
>> the completion list  when appropriate. --git-completion-helper must
>> not include these or the trick done by git-completion.bash becomes
>> useless.
>>
>> Interesting. So we now have two classes of "no complete". One can't be
>> configurable (--continue|--abort|--skip) and one can. I'll use two
>> separate flags for these, though I'm not adding the configuration
>> option right now.
>
> I don't see that as convincing argument for two classes of "no
> complete". Since git-completion.bash already special-cases
> rebase/am/cherry-pick for --continue|--abort|--skip, it is not far
> fetched that that special-case treatment can be extended slightly to
> also filter out those three options from the list returned by
> --git-completion-helper.

I agree that is possible, but it's a bit tricky to do the filtering
right in bash (all options are sent back as one line instead of one
per line, which is easier to process by command line tools).

On top of  that, I think we want git-completion.bash to be fast, the
more commands we execute there, the unhappier Windows users are. It is
too possible to do this kind of filtering just once, before caching.
It does not fit well to how I designed __gitcomp_builtin so I need to
sit back and see how to sort that out.

Long term though, I think we would want more and more completion logic
built in. One of those things I have in mind is to let
--git-completion-helper (or some other new option) to provide
completion for possible option values (e.g. true/false, values for
"git merge --strategy=", "git status --untrack-files="....). That may
also include completion of --continue|--abort|.. in C code, something
like this roughly

# separate command blocks because we still need to cache them in shell
if [ -f .git/rebase-apply ]; then
    __gitcomp $(git $cmd --git-completion-helper=in-progress)
else
    __gitcomp $(git $cmd --git-completion-helper)
fi

which means eventually we have to flag these options differently.

Having said all that, these are the things I imagine we _might_ do. I
have not really thought it through and nor do I have a clear plan
forward at this point, so they may end up being just rubbish thoughts.

> So, if that special case is handled entirely by the completion script,
> then that leaves only the "dangerous" options, which requires only a
> single flag.
-- 
Duy

  reply	other threads:[~2018-02-01 10:22 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 11:05 [PATCH v2 00/41] Automate updating git-completion.bash a bit Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 01/41] parse-options: support --git-completion-helper Nguyễn Thái Ngọc Duy
2018-01-31 20:22   ` Eric Sunshine
2018-01-31 21:04   ` Eric Sunshine
2018-02-01  0:05     ` Duy Nguyen
2018-02-01  9:54       ` Eric Sunshine
2018-02-01 10:21         ` Duy Nguyen [this message]
2018-02-01 19:16           ` Eric Sunshine
2018-02-05  9:56             ` Duy Nguyen
2018-02-06  5:04               ` Eric Sunshine
2018-02-07 23:41                 ` SZEDER Gábor
2018-02-05 10:46     ` Ævar Arnfjörð Bjarmason
2018-02-05 11:22       ` Duy Nguyen
2018-01-31 11:05 ` [PATCH v2 02/41] parse-options: add OPT_xxx_F() variants Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 03/41] parse-options: let OPT__FORCE take optional flags argument Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 04/41] git-completion.bash: introduce __gitcomp_builtin Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 05/41] completion: use __gitcomp_builtin in _git_add Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 06/41] completion: use __gitcomp_builtin in _git_am Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 07/41] completion: use __gitcomp_builtin in _git_apply Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 08/41] completion: use __gitcomp_builtin in _git_branch Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 09/41] completion: use __gitcomp_builtin in _git_checkout Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 10/41] completion: use __gitcomp_builtin in _git_cherry_pick Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 11/41] completion: use __gitcomp_builtin in _git_clean Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 12/41] completion: use __gitcomp_builtin in _git_clone Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 13/41] completion: use __gitcomp_builtin in _git_commit Nguyễn Thái Ngọc Duy
2018-01-31 20:42   ` Eric Sunshine
2018-01-31 11:05 ` [PATCH v2 14/41] completion: use __gitcomp_builtin in _git_config Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 15/41] completion: use __gitcomp_builtin in _git_describe Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 16/41] completion: use __gitcomp_builtin in _git_difftool Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 17/41] completion: use __gitcomp_builtin in _git_fetch Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 18/41] completion: use __gitcomp_builtin in _git_fsck Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 19/41] completion: use __gitcomp_builtin in _git_gc Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 20/41] completion: use __gitcomp_builtin in _git_grep Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 21/41] completion: use __gitcomp_builtin in _git_help Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 22/41] completion: use __gitcomp_builtin in _git_init Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 23/41] completion: use __gitcomp_builtin in _git_ls_files Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 24/41] completion: use __gitcomp_builtin in _git_ls_remote Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 25/41] completion: use __gitcomp_builtin in _git_merge Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 26/41] completion: use __gitcomp_builtin in _git_merge_base Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 27/41] completion: use __gitcomp_builtin in _git_mv Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 28/41] completion: use __gitcomp_builtin in _git_name_rev Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 29/41] completion: use __gitcomp_builtin in _git_notes Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 30/41] completion: use __gitcomp_builtin in _git_pull Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 31/41] completion: use __gitcomp_builtin in _git_push Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 32/41] completion: use __gitcomp_builtin in _git_remote Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 33/41] remote: force completing --mirror= instead of --mirror Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 34/41] completion: use __gitcomp_builtin in _git_replace Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 35/41] completion: use __gitcomp_builtin in _git_reset Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 36/41] completion: use __gitcomp_builtin in _git_revert Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 37/41] completion: use __gitcomp_builtin in _git_rm Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 38/41] completion: use __gitcomp_builtin in _git_show_branch Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 39/41] completion: use __gitcomp_builtin in _git_status Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 40/41] completion: use __gitcomp_builtin in _git_tag Nguyễn Thái Ngọc Duy
2018-01-31 11:05 ` [PATCH v2 41/41] completion: use __gitcomp_builtin in _git_worktree Nguyễn Thái Ngọc Duy
2018-01-31 15:01 ` [PATCH v2 00/41] Automate updating git-completion.bash a bit Ævar Arnfjörð Bjarmason
2018-02-07 19:23 ` Junio C Hamano
2018-02-08 12:05   ` Duy Nguyen
2018-02-09 11:01 ` [PATCH v3 00/42] " Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 01/42] parse-options: support --git-completion-helper Nguyễn Thái Ngọc Duy
2018-12-02 13:41     ` Ævar Arnfjörð Bjarmason
2018-12-09 10:27       ` [PATCH] parse-options: fix SunCC compiler warning Nguyễn Thái Ngọc Duy
2018-12-10  6:36         ` Junio C Hamano
2018-12-10 15:26           ` Duy Nguyen
2018-12-11  2:13             ` Junio C Hamano
2018-12-11 15:40               ` Duy Nguyen
2018-12-12  7:50                 ` Junio C Hamano
2018-12-11 15:35         ` [PATCH v2] " Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 02/42] parse-options: add OPT_xxx_F() variants Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 03/42] parse-options: let OPT__FORCE take optional flags argument Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 04/42] git-completion.bash: introduce __gitcomp_builtin Nguyễn Thái Ngọc Duy
2018-02-09 18:59     ` Junio C Hamano
2018-02-14 15:35     ` SZEDER Gábor
2018-02-23 10:30       ` Duy Nguyen
2018-02-09 11:01   ` [PATCH v3 05/42] completion: use __gitcomp_builtin in _git_add Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 06/42] completion: use __gitcomp_builtin in _git_am Nguyễn Thái Ngọc Duy
2018-02-14 12:53     ` SZEDER Gábor
2018-02-22  9:13       ` Duy Nguyen
2018-02-22 18:19         ` Junio C Hamano
2018-02-23 10:17           ` Duy Nguyen
2018-02-23 18:08             ` Junio C Hamano
2018-02-24 13:58               ` Duy Nguyen
2018-02-09 11:01   ` [PATCH v3 07/42] completion: use __gitcomp_builtin in _git_apply Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 08/42] completion: use __gitcomp_builtin in _git_branch Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 09/42] completion: use __gitcomp_builtin in _git_checkout Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 10/42] completion: use __gitcomp_builtin in _git_cherry_pick Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 11/42] completion: use __gitcomp_builtin in _git_clean Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 12/42] completion: use __gitcomp_builtin in _git_clone Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 13/42] completion: use __gitcomp_builtin in _git_commit Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 14/42] completion: use __gitcomp_builtin in _git_config Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 15/42] completion: use __gitcomp_builtin in _git_describe Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 16/42] completion: use __gitcomp_builtin in _git_difftool Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 17/42] completion: use __gitcomp_builtin in _git_fetch Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 18/42] completion: use __gitcomp_builtin in _git_fsck Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 19/42] completion: use __gitcomp_builtin in _git_gc Nguyễn Thái Ngọc Duy
2018-02-09 11:01   ` [PATCH v3 20/42] completion: use __gitcomp_builtin in _git_grep Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 21/42] completion: use __gitcomp_builtin in _git_help Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 22/42] completion: use __gitcomp_builtin in _git_init Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 23/42] completion: use __gitcomp_builtin in _git_ls_files Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 24/42] completion: use __gitcomp_builtin in _git_ls_remote Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 25/42] completion: use __gitcomp_builtin in _git_merge Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 26/42] completion: use __gitcomp_builtin in _git_merge_base Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 27/42] completion: use __gitcomp_builtin in _git_mv Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 28/42] completion: use __gitcomp_builtin in _git_name_rev Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 29/42] completion: use __gitcomp_builtin in _git_notes Nguyễn Thái Ngọc Duy
2018-02-14 14:29     ` SZEDER Gábor
2018-02-23 10:33       ` Duy Nguyen
2018-02-23 10:59         ` Duy Nguyen
2018-02-14 15:15     ` SZEDER Gábor
2018-02-23 10:40       ` Duy Nguyen
2018-02-09 11:02   ` [PATCH v3 30/42] completion: use __gitcomp_builtin in _git_pull Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 31/42] completion: use __gitcomp_builtin in _git_push Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 32/42] completion: use __gitcomp_builtin in _git_remote Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 33/42] remote: force completing --mirror= instead of --mirror Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 34/42] completion: use __gitcomp_builtin in _git_replace Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 35/42] completion: use __gitcomp_builtin in _git_reset Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 36/42] completion: use __gitcomp_builtin in _git_revert Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 37/42] completion: use __gitcomp_builtin in _git_rm Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 38/42] completion: use __gitcomp_builtin in _git_show_branch Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 39/42] completion: use __gitcomp_builtin in _git_status Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 40/42] completion: use __gitcomp_builtin in _git_tag Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 41/42] completion: use __gitcomp_builtin in _git_worktree Nguyễn Thái Ngọc Duy
2018-02-09 11:02   ` [PATCH v3 42/42] git-completion.bash: add GIT_COMPLETION_OPTIONS=all config Nguyễn Thái Ngọc Duy
2018-02-09 14:19     ` Ævar Arnfjörð Bjarmason
2018-02-10  9:29       ` Duy Nguyen
2018-02-11 14:47         ` Ævar Arnfjörð Bjarmason
2018-02-11  1:59     ` Eric Sunshine
2018-02-12  0:34       ` Duy Nguyen

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=CACsJy8D5iGVDHKoMeQjm+Seea_pTixsb8Xq6D1w17Y9M42iAPw@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.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).