Re: [PATCH v3 29/42] completion: use __gitcomp_builtin in _git_notes

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

 



On Wed, Feb 14, 2018 at 9:29 PM, SZEDER Gábor <szeder.dev@xxxxxxxxx> wrote:
> On Fri, Feb 9, 2018 at 12:02 PM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index c7b8b37f19..60127daebf 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>
>> @@ -1851,15 +1851,17 @@ _git_notes ()
>>         add,--reedit-message=*|append,--reedit-message=*)
>>                 __git_complete_refs --cur="${cur#*=}"
>>                 ;;
>> -       add,--*|append,--*)
>> -               __gitcomp '--file= --message= --reedit-message=
>> -                               --reuse-message='
>> +       add,--*)
>> +               __gitcomp_builtin notes_add
>> +               ;;
>> +       append,--*)
>> +               __gitcomp_builtin notes_append
>>                 ;;
>>         copy,--*)
>> -               __gitcomp '--stdin'
>> +               __gitcomp_builtin notes_copy
>>                 ;;
>>         prune,--*)
>> -               __gitcomp '--dry-run --verbose'
>> +               __gitcomp_builtin notes_prune
>>                 ;;
>>         prune,*)
>>                 ;;
>
> This could be simplified to:
>
>   add,--*|append,--*|copy,--*|prune,--*)
>         __gitcomp_builtin notes_$subcommand
>         ;;
>
> And we could even go one step further:
>
>   *,--*)
>         __gitcomp_builtin notes_$subcommand
>         ;;
>
> This would have the benefit that if any of the remaining subcommands
> learn --options, then they would be completed right away, without the
> need to add that subcommand to the case arms.

You read my mind ;-) We won't do this in this series though (but I
will simplify the code as suggested). parse-options.c does not have
any concept about these subcommands. So a bit more work and can (and
will) be done separately.
-- 
Duy




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux