From: Karel Zak Date: Thu, 2 Oct 2025 12:35:43 +0000 (+0200) Subject: bash-completion: add lsfd X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fd4790e0c8bd6b3600ae3cdb1dd47b5c7796ee8;p=thirdparty%2Futil-linux.git bash-completion: add lsfd Signed-off-by: Karel Zak --- diff --git a/bash-completion/Makemodule.am b/bash-completion/Makemodule.am index fe92addb1..3b75ef231 100644 --- a/bash-completion/Makemodule.am +++ b/bash-completion/Makemodule.am @@ -222,6 +222,9 @@ endif if BUILD_LSBLK dist_bashcompletion_DATA += bash-completion/lsblk endif +if BUILD_LSFD +dist_bashcompletion_DATA += bash-completion/lsfd +endif if BUILD_LSLOCKS dist_bashcompletion_DATA += bash-completion/lslocks endif diff --git a/bash-completion/lsfd b/bash-completion/lsfd new file mode 100644 index 000000000..193103dcc --- /dev/null +++ b/bash-completion/lsfd @@ -0,0 +1,67 @@ +_lsfd_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-o'|'--output') + local prefix realcur COLLIST + realcur="${cur##*,}" + prefix="${cur%$realcur}" + COLLIST="$(lsfd --list-columns 2>/dev/null | awk '{print $1}' | tail -n +2)" + COMPREPLY=( $(compgen -P "$prefix" -W "$COLLIST" -- $realcur) ) + return 0 + ;; + '-p'|'--pid') + COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) ) + return 0 + ;; + '-i'|'--inet') + COMPREPLY=( $(compgen -W "4 6" -- $cur) ) + return 0 + ;; + '-Q'|'--filter'|'-C'|'--counter') + COMPREPLY=( $(compgen -W "expr" -- $cur) ) + return 0 + ;; + '--summary') + COMPREPLY=( $(compgen -W "never only append" -- $cur) ) + return 0 + ;; + '--hyperlink') + COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version'|'-H'|'--list-columns') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --noheadings + --output + --version + --help + --json + --raw + --threads + --notruncate + --pid + --inet + --filter + --debug-filter + --summary + --counter + --dump-counters + --list-columns + --hyperlink + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _lsfd_module lsfd diff --git a/meson.build b/meson.build index 4c36e7f91..aff99dab9 100644 --- a/meson.build +++ b/meson.build @@ -3014,6 +3014,7 @@ exe = executable( if opt and not is_disabler(exe) exes += exe manadocs += lsfd_manadocs + bashcompletions += ['lsfd'] endif exe = executable(