]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
bash-completion: add a function for fincore command
authorMasatake YAMATO <yamato@redhat.com>
Tue, 7 Mar 2017 02:33:52 +0000 (11:33 +0900)
committerKarel Zak <kzak@redhat.com>
Thu, 23 Mar 2017 11:46:41 +0000 (12:46 +0100)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
bash-completion/Makemodule.am
bash-completion/fincore [new file with mode: 0644]

index 3ffd124dcf5d00fc15af94506bfbc632a0b2bdea..ff7b052b5fd68ea83947d6ff5251e38982a1853d 100644 (file)
@@ -18,6 +18,9 @@ endif
 if BUILD_COLUMN
 dist_bashcompletion_DATA += bash-completion/column
 endif
+if BUILD_FINCORE
+dist_bashcompletion_DATA += bash-completion/fincore
+endif
 if BUILD_FINDMNT
 dist_bashcompletion_DATA += bash-completion/findmnt
 endif
diff --git a/bash-completion/fincore b/bash-completion/fincore
new file mode 100644 (file)
index 0000000..d213586
--- /dev/null
@@ -0,0 +1,25 @@
+_fincore_module()
+{
+       local cur prev OPTS
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       prev="${COMP_WORDS[COMP_CWORD-1]}"
+       case $prev in
+               '-h'|'--help'|'-V'|'--version')
+                       return 0
+                       ;;
+       esac
+       case $cur in
+           -*)
+                       OPTS="--help
+                               --version"
+                       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       local IFS=$'\n'
+       compopt -o filenames
+       COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
+       return 0
+}
+complete -F _fincore_module fincore