summaryrefslogtreecommitdiffstats
path: root/shell-completion
diff options
context:
space:
mode:
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>2024-11-21 12:50:26 +0100
committerLennart Poettering <lennart@poettering.net>2024-11-22 10:38:19 +0100
commit2ccacdd57ca07d9c6512c773dda4255cb776204c (patch)
treef35b799fc1a3750e328990d16ed9b8044ee99c96 /shell-completion
parentcore/service: service_add_fd_store() consumes passed fd (diff)
downloadsystemd-2ccacdd57ca07d9c6512c773dda4255cb776204c.tar.xz
systemd-2ccacdd57ca07d9c6512c773dda4255cb776204c.zip
bash-completion: add --list-devices to systemd-cryptenroll
And also use it to list suitable block devices.
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/bash/systemd-cryptenroll11
1 files changed, 2 insertions, 9 deletions
diff --git a/shell-completion/bash/systemd-cryptenroll b/shell-completion/bash/systemd-cryptenroll
index 7a11a3f3dc..6ae9bb3840 100644
--- a/shell-completion/bash/systemd-cryptenroll
+++ b/shell-completion/bash/systemd-cryptenroll
@@ -38,19 +38,12 @@ __get_tpm2_devices() {
done
}
-__get_block_devices() {
- local i
- for i in /dev/*; do
- [ -b "$i" ] && printf '%s\n' "$i"
- done
-}
-
_systemd_cryptenroll() {
local comps
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
local -A OPTS=(
[STANDALONE]='-h --help --version
- --password --recovery-key'
+ --password --recovery-key --list-devices'
[ARG]='--unlock-key-file
--unlock-fido2-device
--unlock-tpm2-device
@@ -116,7 +109,7 @@ _systemd_cryptenroll() {
return 0
fi
- comps=$(__get_block_devices)
+ comps=$(systemd-cryptenroll --list-devices)
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
}