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

Ansible complete #4697

Merged
merged 9 commits into from Feb 6, 2018
Merged

Ansible complete #4697

merged 9 commits into from Feb 6, 2018

Conversation

@hamon-e
Copy link
Contributor

@hamon-e hamon-e commented Feb 1, 2018

Provide ansible completions

https://github.com/fisherman/ansible-completion

Copy link
Member

@faho faho left a comment

  • Split into one file per command

  • Shorter descriptions

  • More arguments

  • Use fish's functions

  • Cosmetics

Loading

@@ -0,0 +1,106 @@
# fish 2.2.0 does not include native snippet support. Upgrade to fish >= 2.3.0
Copy link
Member

@faho faho Feb 1, 2018

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.

Loading

# 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)"
Copy link
Member

@faho faho Feb 1, 2018

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"?

Loading

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"
Copy link
Member

@faho faho Feb 1, 2018

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"?

Loading

Copy link
Member

@faho faho Feb 1, 2018

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)

Loading

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"
Copy link
Member

@faho faho Feb 1, 2018

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"?

Loading

# source $file
# end
# ansible
complete -c ansible -s a -l args -r -f -d "module arguments"
Copy link
Member

@faho faho Feb 1, 2018

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".

Loading

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)"
Copy link
Member

@faho faho Feb 1, 2018

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.

Loading

Copy link
Member

@faho faho Feb 1, 2018

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)

Loading

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)"
Copy link
Member

@faho faho Feb 1, 2018

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.

Loading

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 ]"
Copy link
Member

@faho faho Feb 1, 2018

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.

Loading

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"
Copy link
Member

@faho faho Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, new file.

Loading

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"
Copy link
Member

@faho faho Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New file.

Loading

@faho faho added this to the fish-3.0 milestone Feb 1, 2018
@faho
Copy link
Member

@faho faho commented Feb 1, 2018

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.

Loading

@faho faho merged commit 54c9d57 into fish-shell:master Feb 6, 2018
1 check passed
Loading
@faho
Copy link
Member

@faho faho commented Feb 6, 2018

Merged, thanks!

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants