-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Comments
Works for me, so I'm assuming this has been fixed in the meantime. |
Sorry, still an issue, but the order is important. With the completions given above, |
What is the difference between |
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. |
Should we close this as wontfix? |
Still seems like a bug to me, we might fix it. |
Yeah that seems just broken. |
Consider a group of short options, like -xyz, where z takes an argument. This commit fixes completion of the argument. Fixes fish-shell#332
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
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
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
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
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
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
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]
The text was updated successfully, but these errors were encountered: