diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2021-07-25 09:43:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2021-07-26 03:46:53 +0000 |
commit | d441345096b4042b6c158f3d94062ef89d424ddb (patch) | |
tree | 29951fc3cc294bb2f0a29191adc225b995ce4544 /share/bash-completion/container | |
parent | Updating example key in container key manpage examples. (diff) | |
download | compute-tools-d441345096b4042b6c158f3d94062ef89d424ddb.tar.xz compute-tools-d441345096b4042b6c158f3d94062ef89d424ddb.zip |
Adding sensible default lookups for container key bash-completion.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-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) |