Skip to content

Commit

Permalink
fix(shell-completion): add missing options
Browse files Browse the repository at this point in the history
  • Loading branch information
aafeijoo-suse authored and johannbg committed May 11, 2022
1 parent 0b339d7 commit 1199f99
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 22 additions & 5 deletions shell-completion/bash/dracut
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,32 @@ _dracut() {
--xz --zstd --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline --reproducible --uefi
--enhanced-cpio'
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
--enhanced-cpio --rebuild --aggresive-strip --hostonly-cmdline
--no-hostonly-cmdline --no-hostonly-default-device --nofscks
--hostonly-i18n --no-hostonly-i18n --lzo --lz4 --no-reproducible
--no-uefi --no-machineid --version
'
[ARG]='-a -m -o -d -I -k -c -L -r -i
--kver --add --force-add --add-drivers --force-drivers
--omit-drivers --modules --omit --drivers --filesystems --install
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
--fwdir --libdirs --fscks --add-fstab --mount --device
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
--kernel-cmdline --sshkey --persistent-policy --install-optional
--loginstall --uefi-stub --kernel-image --squash-compressor
--sysroot --hostonly-mode --hostonly-nics --include --logfile
--uefi-splash-image
'
)

# shellcheck disable=SC2086
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--kmoddir | -k | --fwdir | --confdir | --tmpdir)
--kmoddir | -k | --fwdir | --confdir | --tmpdir | -r | --sysroot)
comps=$(compgen -d -- "$cur")
compopt -o filenames
;;
-c | --conf | --sshkey | --add-fstab | --add-device | -I | --install | --install-optional)
-c | --conf | --sshkey | --add-fstab | --add-device | -I | \
--install | --install-optional | --uefi-splash-image)
comps=$(compgen -f -- "$cur")
compopt -o filenames
;;
Expand All @@ -69,6 +77,15 @@ _dracut() {
echo [0-9]*
)
;;
--hostonly-mode)
comps="sloppy strict"
;;
--hostonly-nics)
comps=$(
cd /sys/class/net/ || return 0
printf -- "%s " *
)
;;
*)
return 0
;;
Expand Down
2 changes: 1 addition & 1 deletion shell-completion/bash/lsinitrd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ __contains_word() {
_lsinitrd() {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD - 1]}
local -A OPTS=(
[STANDALONE]='-s --size -h --help'
[STANDALONE]='-s --size -h --help --unpack --unpackearly -v --verbose'
[ARG]='-f --file -k --kver'
)

Expand Down

0 comments on commit 1199f99

Please sign in to comment.