-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Conversation
99cb4de
to
24896de
Compare
The failing tests are being fixed in #889. After it is checked in, this commit will be all green |
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.
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
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'] ```
Also attempt to standardize the bash and zsh implementations Next up: tests!
This PR is being marked as stale due to a long period of inactivity |
This is pretty cool! I believe this can be closed. |
Hey Marc! Let me take a look at the new features, I'll close this for now and open a new branch on top of 1.0 in case I find anything missing, but it looks like I won't have to |
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.