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
Ansible complete #4697
Ansible complete #4697
Conversation
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.
-
Split into one file per command
-
Shorter descriptions
-
More arguments
-
Use fish's functions
-
Cosmetics
share/completions/ansible.fish
Outdated
@@ -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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is unnecessary, since this won't be available in fish 2.2.0.
share/completions/ansible.fish
Outdated
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"failing after X seconds" - does that mean that this takes an argument? "default=N/A" - can that argument be the string "N/A"?
share/completions/ansible.fish
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a bit shorter. Something like "Just check, don't make any changes"?
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.
(Thats a general thing - descriptions should be short, so we can fit more on a screen)
share/completions/ansible.fish
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Show the difference in changed files/templates"?
share/completions/ansible.fish
Outdated
# source $file | ||
# end | ||
# ansible | ||
complete -c ansible -s a -l args -r -f -d "module arguments" |
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.
We capitalize the first word of the description - "Module arguments".
share/completions/ansible.fish
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have __fish_complete_users
, which can at least do local users.
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.
(Also goes for other things that may take users)
share/completions/ansible.fish
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the deprecated options - we want to steer users towards using those that will still be available in future.
share/completions/ansible.fish
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give the valid choices via -a "sudo su pbrun..."
instead of in the description.
share/completions/ansible.fish
Outdated
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" |
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.
Again, new file.
share/completions/ansible.fish
Outdated
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" |
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.
New file.
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