-
Notifications
You must be signed in to change notification settings - Fork 2.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
Fish completion fails when command line starts with a space #1303
Comments
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Dec 27, 2020
Fixes spf13#1303 Signed-off-by: Marc Khouzam <[email protected]>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Jan 3, 2021
Fixes spf13#1303 Signed-off-by: Marc Khouzam <[email protected]>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Jan 25, 2021
Fixes spf13#1303 Signed-off-by: Marc Khouzam <[email protected]>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Jan 30, 2021
Fixes spf13#1303 Signed-off-by: Marc Khouzam <[email protected]>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Feb 14, 2021
Fixes spf13#1303 Signed-off-by: Marc Khouzam <[email protected]>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Feb 15, 2021
Fixes spf13#1303 Signed-off-by: Marc Khouzam <[email protected]>
This issue is being marked as stale due to a long period of inactivity |
Waiting for #1249 to be reviewed |
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Mar 4, 2021
Fixes spf13#1303 Signed-off-by: Marc Khouzam <[email protected]>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
May 3, 2021
Fixes spf13#1303 Signed-off-by: Marc Khouzam <[email protected]>
jpmcb
pushed a commit
that referenced
this issue
May 3, 2021
* Fix fish for ShellDirectiveNoSpace and file comp For fish shell we achieve ShellDirectiveNoSpace by outputing a fake second completion with an extra character. However, this extra character was being added after the description string, instead of before. This commit fixes that. It also cleans up the script of useless code, now that fish completion details are better understood. Signed-off-by: Marc Khouzam <[email protected]> * Handle case when completion starts with a space Fixes #1303 Signed-off-by: Marc Khouzam <[email protected]> * Support fish completion with env vars in the path Fixes #1214 Fixes #1306 Signed-off-by: Marc Khouzam <[email protected]> * Update based on review 1- We use `set -l` for local variable to make sure there are no conflicts with global variables 2- We use `commandline -opc` which: a) splits the command line into tokens (-o) b) only considers the current command (-p) (e.g., echo hello; helm <TAB>) c) stops at the cursor (-c) 3- We extract the last arg with `commandline -ct` and escape it to handle the case where it is a space, or unmatched quote. 4- We avoid looping when filtering on prefix. 5- We don't add a fake comp for ShellCompDirectiveNoSpace when the completion ends with any of @=/:., as fish won't add a space Signed-off-by: Marc Khouzam <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the current command line starts with a space the completion fails. It will only provide file completion.
Note: This is valid syntax used to prevent the shell from writing the command to the history.
BASH_COMP_DEBUG_FILE output:
I think this line causes the problem:
cobra/fish_completions.go
Line 33 in 7df62f7
We need to trim $argv before we can split on space
This bug was originally reported by @pastalian in containers/podman#8829
The text was updated successfully, but these errors were encountered: