]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
enosys: add bash completion
authorThomas Weißschuh <thomas@t-8ch.de>
Thu, 4 May 2023 18:15:04 +0000 (20:15 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Tue, 16 May 2023 20:44:50 +0000 (22:44 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
bash-completion/Makemodule.am
bash-completion/enosys [new file with mode: 0644]
meson.build

index eb10f6f7055673b5a89a5b31ebb3c0f09ebed324..ac8926f2d0ad90bdbec4eb71fdda5e22ac6bbf58 100644 (file)
@@ -344,5 +344,8 @@ endif
 if BUILD_WAITPID
 dist_bashcompletion_DATA += bash-completion/waitpid
 endif
+if BUILD_ENOSYS
+dist_bashcompletion_DATA += bash-completion/enosys
+endif
 
 endif # BUILD_BASH_COMPLETION
diff --git a/bash-completion/enosys b/bash-completion/enosys
new file mode 100644 (file)
index 0000000..4f63e66
--- /dev/null
@@ -0,0 +1,33 @@
+_waitpid_module()
+{
+       local cur prev OPTS
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       prev="${COMP_WORDS[COMP_CWORD-1]}"
+       case $prev in
+               '-s'|'--syscall')
+                       return 0
+                       ;;
+               '-h'|'--help'|'-V'|'--version')
+                       return 0
+                       ;;
+       esac
+       case $cur in
+               -*)
+                       OPTS="--syscall
+                               --help
+                               --version"
+                       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+                       return 0
+                       ;;
+               *)
+                       _pids
+                       return 0
+                       ;;
+       esac
+       local IFS=$'\n'
+       compopt -o filenames
+       COMPREPLY=( $(compgen -u -- $cur) )
+       return 0
+}
+complete -F _enosys_module enosys
index 42f255d62b3c7801aa9e079494138175382898b6..3a535339aa074b45f6c938dee2827e37fb1d1616 100644 (file)
@@ -2865,6 +2865,7 @@ exe = executable(
   install : true)
 if not is_disabler(exe)
   exes += exe
+  bashcompletions += ['enosys']
 endif
 
 ############################################################