Skip to content

AutoComplete tips

Tristan edited this page Dec 7, 2018 · 8 revisions

Autocomplete that can be installed with:

$ complete -C /usr/local/bin/awskeyring awskeyring

To set your environment easily the following bash function helps:

awsenv() { eval "$(awskeyring env $@)"; }

And if you want autocompletion for the environment function try the following:

_awsenv_comp() {
  COMPREPLY=( $(compgen -W "$(awskeyring list) --no-token" -- "${COMP_WORDS[COMP_CWORD]}" ))
}
complete -F _awsenv_comp awsenv

Related to autocomplete is autocorrection. If you have Thor 0.20.3 with did_you_mean 1.0.3 installed and you make a typo you will get a helpful suggestion as to what should have been typed.

$ awskeyring halp
Could not find command "halp".
Did you mean?  "help"
Clone this wiki locally