summaryrefslogtreecommitdiffstats
path: root/completion/genfstab.bash
diff options
context:
space:
mode:
Diffstat (limited to 'completion/genfstab.bash')
-rw-r--r--completion/genfstab.bash31
1 files changed, 31 insertions, 0 deletions
diff --git a/completion/genfstab.bash b/completion/genfstab.bash
new file mode 100644
index 0000000..69506d9
--- /dev/null
+++ b/completion/genfstab.bash
@@ -0,0 +1,31 @@
+_genfstab() {
+ compopt -o dirnames
+ local cur prev words cword
+ _init_completion || return
+
+ local opts="-f -L -p -P -t -U -h"
+
+ case ${prev} in
+ -f)
+ return 0
+ ;;
+ -t)
+ COMPREPLY=($(compgen -W "LABEL UUID PARTLABEL PARTUUID" -- "${cur}"))
+ return 0
+ ;;
+ esac
+
+ if [[ ${cur} = -* ]]; then
+ COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
+ return 0
+ fi
+
+ for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do
+ if [[ -d ${i} ]]; then
+ compopt +o dirnames
+ return 0
+ fi
+ done
+}
+
+complete -F _genfstab genfstab