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

Add framework for dynamic tab completions #883

Closed
wants to merge 5 commits into from

Commits on Feb 21, 2020

  1. Add framework for dynamic tab completions

    By setting the COBRA_FLAG_COMPLETION environment variable, the normal execution path of the command
    is short circuited, and instead the function registered by `MarkCustomFlagCompletion` is executed.
    
    All flags other than the one being completed get parsed according to whatever type they are defined
    as, but the flag being completed is parsed as a raw string and passed into the custom compeltion.
    PapaCharlie committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    c87d78c View commit details
    Browse the repository at this point in the history
  2. Fix broken test

    The breakage was caused by the change at line 336, which changed the completion from
    ```
    --option[Help message]:
    ```
    to
    ```
    --option[Help message]:option
    ```
    Semantically this does not change the behavior of the completion, but it does tell zsh to tell you
    which flag it is currently completing
    PapaCharlie committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    684fd47 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    979059b View commit details
    Browse the repository at this point in the history
  4. Remove extra splat for zsh arrays

    It turns out that zsh will simply use the elements of an array as the parameters when referenced in
    the shell without quotes
    ```
    % cat t.py
    import sys
    print sys.argv
    
    % typeset -a args
    % args+=("./t.py")
    % args+=("123
    321")
    % $args
    ['./t.py', '123\n321']
    ```
    PapaCharlie committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    53e4e28 View commit details
    Browse the repository at this point in the history
  5. Use the empty string as a parameter to the flag being completed

    Also attempt to standardize the bash and zsh implementations
    
    Next up: tests!
    PapaCharlie committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    ee1287c View commit details
    Browse the repository at this point in the history