Re: [PATCH] completion: add option completion for most builtin commands
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 22, 2018, 17:11 UTC
- Message-ID
- <xmqqy3ikkpba.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CACsJy8CWWSixQpXDh+q108j4xF8vpm5gsj2u3gJEgW=2bnXQHA@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 9 quoted lines
>> And that pattern repeats throughout the patch. I wonder if we can >> express the same a lot more concisely by updating the caller that >> calls these command specific helpers? > > Yeah. I almost went to just generate and eval these functions. But we > still need to keep a list of "bultin with --git-completion-helper" > support somewhere, and people may want to complete arguments without > double dashes (e.g. read-tree should take a ref...) which can't be > helped by --git-completion-helper.
Hmph, I actually did not have 'eval' in mind.
Rather, I was wondering if it is cleaner to update __git_main where it computes $completion_func by mangling $command and then calls it---instead call __gitcomp_builtin directly when the $command appears in such a "list of builtins that knows --completion-helper and no custom completion".