On Fri, Apr 13, 2012 at 1:54 PM, Maxim Gonchar <gma...@gmail.com> wrote:

> On Fri, 13 Apr 2012 15:39:20 +0400, Gustaf Johansson <gusta...@gmail.com>
> wrote:
>
>  Given the description of 'complete' I would have expected it to behave
>> differently, given:
>>
>>    complete (-c|--command|-p|--path) COMMAND [(-s|--short-option)
>> SHORT_OPTION] [(-l|--long-option|-o|--old-**option) LONG_OPTION
>> [(-a||--arguments) OPTION_ARGUMENTS] [(-d|--description) DESCRIPTION]
>>
>> (which I interpret as  ...[(-l|--long-option|-o|--**old-option)
>> LONG_OPTION
>> [(-a||--arguments) OPTION_ARGUMENTS]]... (note the added ] at the end),
>> but
>> perhaps my bracket placement is incorrect)
>>
>> I would have expected your second line:
>>
>>    complete --command foo --no-files --arguments '(sleep 5s)'
>> --description 'slept'
>>
>> To be invalid since '-a' does not follow either '-l' or '-o'
>>
> The help message is not clear enough. -a do not need to follow -l or -s
> options.
> There are commands, which use subcommands: svn, git, amixer, rfkill.
> For example:
> complete -c svn -a 'add move commit etc'
>
>
>  and I also dont see the logic in that a script given to '-a' ever
>> returning a list of options.
>>
> That is also very useful when the list of options is system dependent.
> Or if command know it's options, then you do not need to type them
> explicitly.
> For example type:
>
>> su <tab>
>>
> to see the list of users in the system. The list is generated by
> complete -c su -a '(__fish_complete_users)'
>
> Maxim
>

I can definitely see the benefit of using it that way, however I think its
incorrect, and just exploiting a flaw in the complete command.
There should be a distinction between option arguments and command
arguments, and given the explanation in the help:

    OPTION_ARGUMENTS is parameter containing a space-separated list of
possible option-arguments, which may contain subshells

I would say '-a' is only to be used for option arguments.
A new flag could be created for the use cases you describe above.
(Of course it could be done the other way around as well, that does not
really matter, as long as the help is updated and reflects the behavior)

But thats just my 2c, this could be solved in many ways ;)

I would like a solution which supports at least:
1: Command arguments
2: Option arguments
3: Has the possibility to cache data generated if wanted (with some way of
updating the cache)

BR Gustaf
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to