forked from 99designs/aws-vault
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
They are based on the shell completion scripts generated by kingpin in alecthomas/kingpin#252. Modified to complete commands after '--'. Fixes 99designs#70
- Loading branch information
1 parent
c506333
commit 4340858
Showing
3 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
aws-vault | ||
aws-vault-* | ||
/aws-vault | ||
/aws-vault-* | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
_aws-vault_bash_autocomplete() { | ||
local i cur prev opts base | ||
|
||
for (( i=1; i < COMP_CWORD; i++ )); do | ||
if [[ ${COMP_WORDS[i]} == -- ]]; then | ||
_command_offset $i+1 | ||
return | ||
fi | ||
done | ||
|
||
COMPREPLY=() | ||
cur="${COMP_WORDS[COMP_CWORD]}" | ||
opts=$( ${COMP_WORDS[0]} --completion-bash "${COMP_WORDS[@]:1:$COMP_CWORD}" ) | ||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | ||
return 0 | ||
} | ||
complete -F _aws-vault_bash_autocomplete -o default aws-vault |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#compdef aws-vault | ||
|
||
_aws-vault() { | ||
local i | ||
for (( i=2; i < CURRENT; i++ )); do | ||
if [[ ${words[i]} == -- ]]; then | ||
shift $i words | ||
(( CURRENT -= i )) | ||
_normal | ||
return | ||
fi | ||
done | ||
|
||
local matches=($(${words[1]} --completion-bash "${(@)words[1,$CURRENT]}")) | ||
compadd -a matches | ||
|
||
if [[ $compstate[nmatches] -eq 0 && $words[$CURRENT] != -* ]]; then | ||
_files | ||
fi | ||
} | ||
|
||
if [[ "$(basename -- ${(%):-%x})" != "_aws-vault" ]]; then | ||
compdef _aws-vault aws-vault | ||
fi |