saml2aws icon indicating copy to clipboard operation
saml2aws copied to clipboard

Adding autocomplete line to .zshrc breaks aws autocomplete

Open mph13 opened this issue 2 years ago • 1 comments

This may simply be an issue with my understanding of the "order" of items in my ~/.zshrc file, but adding the line you suggest for your auto-completion, eval "$(saml2aws --completion-script-zsh)" after the AWS CLI autocomplete lines as listed here, will break the usage of AWS CLI autocomplete. Thanks for any insight.

AWS asks to add these lines to your profile: autoload -Uz compinit && compinit autoload -U +X bashcompinit && bashcompinit

complete -C '/usr/local/bin/aws_completer' aws

mph13 avatar Aug 10 '22 00:08 mph13

You can just use the bash version after you load the aws completion. Like this:

autoload -Uz compinit && compinit
autoload -U +X bashcompinit && bashcompinit

complete -C '/usr/local/bin/aws_completer' aws
eval "$(saml2aws --completion-script-bash)"

patrickli avatar Oct 04 '22 21:10 patrickli

Yep, fixed it! Thank you! @patrickli

Any little tidbit of knowledge on WHY this worked? Thanks again.

mph13 avatar Oct 24 '22 22:10 mph13

The only difference between --completion-script-bash and --completion-script-zsh is the zsh version adds the autoload lines you already have above.

So this should work as well:

eval "$(saml2aws --completion-script-zsh)"
complete -C '/usr/local/bin/aws_completer' aws

patrickli avatar Oct 24 '22 22:10 patrickli

Thank you. Really appreciate the insight. Cheers!

mph13 avatar Oct 25 '22 15:10 mph13