Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument to short option not expanded when options are concatenated #332

Closed
SanskritFritz opened this issue Sep 29, 2012 · 7 comments · Fixed by #6103
Closed

Argument to short option not expanded when options are concatenated #332

SanskritFritz opened this issue Sep 29, 2012 · 7 comments · Fixed by #6103
Labels
bug Something that's not working as intended completions
Milestone

Comments

@SanskritFritz
Copy link
Contributor

complete --command foo --no-files --short-option a --description 'example A'
complete --command foo --no-files --short-option b --arguments 'arg1 arg2 arg3' --description 'example B'

This works:
foo -a -b [tab]

This doesnt:
foo -ab [tab]

@faho
Copy link
Member

faho commented Aug 24, 2015

Works for me, so I'm assuming this has been fixed in the meantime.

@faho faho closed this as completed Aug 24, 2015
@faho
Copy link
Member

faho commented Aug 24, 2015

Sorry, still an issue, but the order is important.

With the completions given above, foo -a -b and foo -ba would complete properly, foo -ab wouldn't.

@faho faho reopened this Aug 24, 2015
@pickfire
Copy link
Contributor

What is the difference between foo -ab and foo -ba?

@faho
Copy link
Member

faho commented Aug 25, 2015

The order of the option. The arguments for "-b" kick in when it's first, i.e. when there's the actual string "-b" in there.

@krader1961 krader1961 added the bug Something that's not working as intended label Mar 19, 2017
@krader1961 krader1961 added enhancement and removed bug Something that's not working as intended labels Apr 1, 2017
@SanskritFritz
Copy link
Contributor Author

Should we close this as wontfix?

@ridiculousfish
Copy link
Member

Still seems like a bug to me, we might fix it.

@floam floam added bug Something that's not working as intended and removed enhancement labels Dec 9, 2018
@floam
Copy link
Member

floam commented Dec 9, 2018

Yeah that seems just broken.

krobelus added a commit to krobelus/fish-shell that referenced this issue Sep 10, 2019
Consider a group of short options, like -xyz, where z takes an argument. This commit fixes
completion of the argument.

Fixes fish-shell#332
krobelus added a commit to krobelus/fish-shell that referenced this issue Sep 22, 2019
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes fish-shell#332
krobelus added a commit to krobelus/fish-shell that referenced this issue Sep 24, 2019
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes fish-shell#332
krobelus added a commit to krobelus/fish-shell that referenced this issue Sep 24, 2019
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes fish-shell#332
krobelus added a commit to krobelus/fish-shell that referenced this issue Oct 3, 2019
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes fish-shell#332
krobelus added a commit to krobelus/fish-shell that referenced this issue Oct 5, 2019
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes fish-shell#332
krobelus added a commit to krobelus/fish-shell that referenced this issue Oct 16, 2019
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes fish-shell#332
@zanchey zanchey modified the milestones: fish-future, fish 3.1.0 Oct 20, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended completions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants