-
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 does not work with env vars in the program path #1306
Comments
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Dec 31, 2020
Fixes spf13#1214 Fixes spf13#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
I've added a fix for this issue to #1249 |
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Jan 3, 2021
Fixes spf13#1214 Fixes spf13#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Jan 25, 2021
Fixes spf13#1214 Fixes spf13#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Jan 30, 2021
Fixes spf13#1214 Fixes spf13#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Feb 14, 2021
Fixes spf13#1214 Fixes spf13#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Feb 15, 2021
Fixes spf13#1214 Fixes spf13#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
This issue is being marked as stale due to a long period of inactivity |
Waiting for the review of #1249 |
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
Mar 4, 2021
Fixes spf13#1214 Fixes spf13#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
marckhouzam
added a commit
to VilledeMontreal/cobra
that referenced
this issue
May 3, 2021
Fixes spf13#1214 Fixes spf13#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
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 <marc.khouzam@montreal.ca> * Handle case when completion starts with a space Fixes #1303 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca> * Support fish completion with env vars in the path Fixes #1214 Fixes #1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca> * 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 <marc.khouzam@montreal.ca>
muscliary
pushed a commit
to muscliary/cobra
that referenced
this issue
Sep 12, 2023
* 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 <marc.khouzam@montreal.ca> * Handle case when completion starts with a space Fixes #1303 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca> * Support fish completion with env vars in the path Fixes spf13/cobra#1214 Fixes spf13/cobra#1306 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca> * 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 <marc.khouzam@montreal.ca>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using an environment variable or a
~
when using a path for the program breaks shell completion for fish.For instance:
currently don't work for fish. This is because of the use of
type -q
in the script.The text was updated successfully, but these errors were encountered: