-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix multiple fish completion issues (#1249)
* 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>
- Loading branch information
1 parent
16dea10
commit f132906
Showing
1 changed file
with
82 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters