summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-07-25 09:43:24 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-07-26 03:46:53 +0000
commitd441345096b4042b6c158f3d94062ef89d424ddb (patch)
tree29951fc3cc294bb2f0a29191adc225b995ce4544 /share
parentUpdating example key in container key manpage examples. (diff)
downloadcompute-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 'share')
-rw-r--r--share/bash-completion/container22
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)