-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add completions for Arcanist #3256
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
Conversation
share/completions/arc.fish
Outdated
| # fish completion for arc | ||
|
|
||
| function __fish_arc_needs_command | ||
| set cmd (commandline -opc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be a local variable :
set -l cmd (commandline -opc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I really don't know what that line does. I just copied it from git.fish.
19321d5 to
4df7edd
Compare
share/completions/arc.fish
Outdated
|
|
||
| function __fish_arc_needs_command | ||
| set -l cmd (commandline -opc) | ||
| if [ (count $cmd) -eq 1 -a $cmd[1] = 'arc' ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You really don't want this idiom. We removed it from the codebase (IIRC entirely) for a reason. This will break when you alias arc (because of the $cmd[1] = 'arc', when you do something; and arc or similar and when you enter an option before a command (which arc might or might not support).
What you want is, depending on how arc works, do something like
for token in $cmd
switch $token
case '-*'
continue
case '*'
return 1
end
return 0This will assume the first non-option is a command.
If you want to be more precise (because e.g. arc can take arguments to options before the command), take a look at the new git.fish.
share/completions/arc.fish
Outdated
| set -l skip_next 1 | ||
| # Skip first word because it's "arc" or a wrapper | ||
| for c in $cmd[2..-1] | ||
| test $skip_next -eq 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skip_next is never set to 0 and hence effectively unused.
Please remove it.
|
Those were my last two nitpicks, I think. Sorry for the delay. |
|
Merged, thanks! |
Add completions for Arcanist, the tool used to interact with Phabricator instance.