Ansible complete#4697
Conversation
faho
left a comment
There was a problem hiding this comment.
-
Split into one file per command
-
Shorter descriptions
-
More arguments
-
Use fish's functions
-
Cosmetics
| @@ -0,0 +1,106 @@ | |||
| # fish 2.2.0 does not include native snippet support. Upgrade to fish >= 2.3.0 | |||
There was a problem hiding this comment.
This comment is unnecessary, since this won't be available in fish 2.2.0.
| # ansible | ||
| complete -c ansible -s a -l args -r -f -d "module arguments" | ||
| complete -c ansible -l ask-vault-pass -f -d "ask for vault password" | ||
| complete -c ansible -s B -l background -r -f -d "run asynchronously, failing after X seconds (default=N/A)" |
There was a problem hiding this comment.
"failing after X seconds" - does that mean that this takes an argument? "default=N/A" - can that argument be the string "N/A"?
| complete -c ansible -s a -l args -r -f -d "module arguments" | ||
| complete -c ansible -l ask-vault-pass -f -d "ask for vault password" | ||
| complete -c ansible -s B -l background -r -f -d "run asynchronously, failing after X seconds (default=N/A)" | ||
| complete -c ansible -s C -l check -f -d "don't make any changes; instead, try to predict some of the changes that may occur" |
There was a problem hiding this comment.
This should be a bit shorter. Something like "Just check, don't make any changes"?
There was a problem hiding this comment.
(Thats a general thing - descriptions should be short, so we can fit more on a screen)
| complete -c ansible -l ask-vault-pass -f -d "ask for vault password" | ||
| complete -c ansible -s B -l background -r -f -d "run asynchronously, failing after X seconds (default=N/A)" | ||
| complete -c ansible -s C -l check -f -d "don't make any changes; instead, try to predict some of the changes that may occur" | ||
| complete -c ansible -s D -l diff -f -d "when changing (small) files and templates, show the differences in those files; works great with --check" |
There was a problem hiding this comment.
"Show the difference in changed files/templates"?
| # source $file | ||
| # end | ||
| # ansible | ||
| complete -c ansible -s a -l args -r -f -d "module arguments" |
There was a problem hiding this comment.
We capitalize the first word of the description - "Module arguments".
| complete -c ansible -s k -l ask-pass -f -d "ask for connection password" | ||
| complete -c ansible -l private-key -r -d "use this file to authenticate the connection" | ||
| complete -c ansible -l key-file -r -d "use this file to authenticate the connection" | ||
| complete -c ansible -s u -l user -f -d "connect as this user (default=None)" |
There was a problem hiding this comment.
We have __fish_complete_users, which can at least do local users.
There was a problem hiding this comment.
(Also goes for other things that may take users)
| complete -c ansible -s s -l sudo -f -d "run operations with sudo (nopasswd) (deprecated, use become)" | ||
| complete -c ansible -s U -l sudo-user -r -f -d "desired sudo user (default=root) (deprecated, use become)" | ||
| complete -c ansible -s S -l su -f -d "run operations with su (deprecated, use become)" | ||
| complete -c ansible -s R -l su-user -r -f -d "run operations with su as this user (default=root) (deprecated, use become)" |
There was a problem hiding this comment.
Remove the deprecated options - we want to steer users towards using those that will still be available in future.
| complete -c ansible -s S -l su -f -d "run operations with su (deprecated, use become)" | ||
| complete -c ansible -s R -l su-user -r -f -d "run operations with su as this user (default=root) (deprecated, use become)" | ||
| complete -c ansible -s b -l become -f -d "run operations with become (does not imply password prompting)" | ||
| complete -c ansible -l become-method -r -f -d "privilege escalation method to use (default=sudo), valid choices: [ sudo | su | pbrun | pfexec | runas | doas | dzdo ]" |
There was a problem hiding this comment.
Give the valid choices via -a "sudo su pbrun..." instead of in the description.
| complete -c ansible-playbook -l ask-su-pass -f -d "ask for su password (deprecated, use become)" | ||
| complete -c ansible-playbook -s K -l ask-become-pass -f -d "ask for privilege escalation password" | ||
| # ansible-galaxy | ||
| complete -c ansible-galaxy -a "delete import info init install list login remove search setup" |
| complete -c ansible-galaxy -s v -l verbose -d "verbose mode (-vvv for more, -vvvv to enable connection debugging)" | ||
| complete -c ansible-galaxy -l version -d "show program's version number and exit" | ||
| # ansible-vault | ||
| complete -c ansible-vault -l ask-vault-pass -f -d "ask for vault password" |
|
Another thing I hadn't checked: Most of these use "-r" or "-f". These didn't quite work as intended up until 2.7.0, so for a while people were adding them left and right. It should be checked whether all of these are actually correct or necessary. |
|
Merged, thanks! |
Provide ansible completions
https://github.com/fisherman/ansible-completion