aboutsummaryrefslogtreecommitdiffstats
path: root/bash-completion/sfdisk
diff options
context:
space:
mode:
authorKevin Locke <kevin@kevinlocke.name>2019-09-19 07:40:13 -0600
committerKevin Locke <kevin@kevinlocke.name>2019-09-19 08:16:32 -0600
commit6ead91ce1e8431bec5b6f10c37b54a82f0be078a (patch)
tree0db3afb96d3157253bac9b96c9e3ac3e11dfcf71 /bash-completion/sfdisk
parent559888c873a196c790137bbeee678dc5212c4430 (diff)
downloadutil-linux-6ead91ce1e8431bec5b6f10c37b54a82f0be078a.tar.gz
bash-completion: Add fallback for symlinks/images
For commands which support operating on files (i.e. disk images), it is desirable for bash-completion to complete matching file names. It is also desirable to complete on block device symlinks (e.g. under /dev/disk). To complete common use cases, often on canonical device names, continue to try completion using canonical device names, then fall back to matching any file incrementally as Bash does by default.[1] [1]: https://github.com/karelzak/util-linux/issues/842#issuecomment-523450243 Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Diffstat (limited to 'bash-completion/sfdisk')
-rw-r--r--bash-completion/sfdisk2
1 files changed, 2 insertions, 0 deletions
diff --git a/bash-completion/sfdisk b/bash-completion/sfdisk
index 9401f89ac0..8386c9fb52 100644
--- a/bash-completion/sfdisk
+++ b/bash-completion/sfdisk
@@ -6,6 +6,7 @@ _sfdisk_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-d'|'--dump'|'-J'|'--json'|'-l'|'--list'|'-F'|'--list-free'|'-r'|'--reorder'|'-s'|'--show-size'|'-V'|'--verify'|'-A'|'--activate'|'--delete')
+ compopt -o bashdefault -o default
COMPREPLY=( $(compgen -W "$(lsblk -dpnro name)" -- $cur) )
return 0
;;
@@ -90,6 +91,7 @@ _sfdisk_module()
return 0
;;
esac
+ compopt -o bashdefault -o default
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
return 0
}