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

Fix multiple fish completion issues #1249

Merged
merged 4 commits into from May 3, 2021

Commits on May 3, 2021

  1. 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>
    marckhouzam committed May 3, 2021
    Copy the full SHA
    57ec686 View commit details
    Browse the repository at this point in the history
  2. Handle case when completion starts with a space

    Fixes spf13#1303
    
    Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
    marckhouzam committed May 3, 2021
    Copy the full SHA
    d6f0283 View commit details
    Browse the repository at this point in the history
  3. Support fish completion with env vars in the path

    Fixes spf13#1214
    Fixes spf13#1306
    
    Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
    marckhouzam committed May 3, 2021
    Copy the full SHA
    281d573 View commit details
    Browse the repository at this point in the history
  4. 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>
    marckhouzam committed May 3, 2021
    Copy the full SHA
    9ab0247 View commit details
    Browse the repository at this point in the history