]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
waitpid: adapt bash-completion for current functionality
authorThomas Weißschuh <thomas@t-8ch.de>
Sat, 7 Jan 2023 04:30:18 +0000 (04:30 +0000)
committerThomas Weißschuh <thomas@t-8ch.de>
Mon, 9 Jan 2023 13:16:30 +0000 (13:16 +0000)
bash-completion/waitpid

index 762c30d7112fd0dd1550b4ae389cc5e54fa3a0d8..67601bb8f7b7bf6f1bb3edda7a820ac2010e39a5 100644 (file)
@@ -1 +1,33 @@
-complete -F _pids waitpid
+_waitpid_module()
+{
+       local cur prev OPTS
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       prev="${COMP_WORDS[COMP_CWORD-1]}"
+       case $prev in
+               '-t'|'--timeout')
+                       COMPREPLY=( $(compgen -W "seconds" -- $cur) )
+                       return 0
+                       ;;
+               '-h'|'--help'|'-V'|'--version')
+                       return 0
+                       ;;
+       esac
+       case $cur in
+               -*)
+                       OPTS="--verbose
+                               --timeout
+                               --exited
+                               --help
+                               --version"
+                       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+                       return 0
+                       ;;
+               *)
+                       _pids
+                       return 0
+                       ;;
+       esac
+       return 0
+}
+complete -F _waitpid_module waitpid