Skip to content

Commit

Permalink
aws-keychain-completion.zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
pda committed Nov 21, 2014
1 parent f097e29 commit 011a2a5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions aws-keychain-completion.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#compdef aws-keychain

# Zsh completion for aws-keychain.
# Copy to a directory in your $fpath as a file named `_aws-keychain`

__subcommands() {
local -a commands
commands=(
"add:add a new key to the keychain"
"cat:output an key in credentials file format"
"env:output an key as shell exports for eval"
"ls:lists known keys"
"none:erase the current credentials file"
"rm:delete a key from the keychain"
"status:show the key ID currently active in credentials file"
"use:use the named key; write to credentials file"
)
_describe "aws-keychain subcommands" commands
}

__key_names() {
_alternative "keys:key names:($(aws-keychain ls))"
}

if (( CURRENT == 2 )); then
__subcommands
return
fi

if (( CURRENT == 3 )); then
case "${words[2]}" in
cat|env|rm|use) __key_names ;;
esac
fi

0 comments on commit 011a2a5

Please sign in to comment.