diff options
-rw-r--r-- | share/bash-completion/container | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/share/bash-completion/container b/share/bash-completion/container index 44a48e7..bb3eb41 100644 --- a/share/bash-completion/container +++ b/share/bash-completion/container @@ -136,9 +136,25 @@ _container() ;; key) - opts="-a --add -l --list -r --remove" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 + case "${prev}" in + -a|--add) + opts="$(cd /usr/share/compute-tools/keys 2>/dev/null && ls *.pub 2>/dev/null | sed -e 's|.*/||g' -e 's|.pub$||g')" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + -r|--remove) + opts="$(gpg --homedir /etc/compute-tools/keys --list-keys | grep ^uid | sed -e 's|.*<||' -e 's|>||')" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + opts="-a --add -r --remove -l --list" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac ;; limit) |