summaryrefslogtreecommitdiffstats
path: root/completions/strace
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
commitf2621414ee5f2f601424c22f00e207903e3b6104 (patch)
tree56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/strace
parentAdding debian version 1:2.11-8. (diff)
downloadbash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.tar.xz
bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.zip
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/strace')
-rw-r--r--completions/strace46
1 files changed, 23 insertions, 23 deletions
diff --git a/completions/strace b/completions/strace
index 2b46ce8..917f64d 100644
--- a/completions/strace
+++ b/completions/strace
@@ -1,9 +1,9 @@
# bash completion for strace -*- shell-script -*-
-_strace()
+_comp_cmd_strace()
{
- local cur prev words cword
- _init_completion -n = || return
+ local cur prev words cword comp_args
+ _comp_initialize -n = -- "$@" || return
# check if we're still completing strace
local offset=0 i
@@ -22,7 +22,7 @@ _strace()
done
if ((offset > 0)); then
- _command_offset $offset
+ _comp_command_offset $offset
else
case $prev in
@@ -38,11 +38,11 @@ _strace()
local define syscall rest
local -A syscalls
while read -r define syscall rest; do
- [[ $define == "#define" && \
- $syscall =~ ^__NR_(.+) ]] &&
- syscalls[${BASH_REMATCH[1]}]=1
+ [[ $define == "#define" &&
+ $syscall =~ ^__NR_(.+) ]] &&
+ syscalls[${BASH_REMATCH[1]}]=set
done 2>/dev/null </usr/include/asm/unistd.h
- if [[ ! $syscalls ]]; then
+ if ((${#syscalls[@]} == 0)); then
local unistd arch=$(command uname -m)
if [[ $arch == *86 ]]; then
unistd=/usr/include/asm/unistd_32.h
@@ -50,50 +50,50 @@ _strace()
unistd=/usr/include/asm/unistd_64.h
fi
while read -r define syscall rest; do
- [[ $define == "#define" && \
- $syscall =~ ^__NR_(.+) ]] &&
- syscalls[${BASH_REMATCH[1]}]=1
+ [[ $define == "#define" &&
+ $syscall =~ ^__NR_(.+) ]] &&
+ syscalls[${BASH_REMATCH[1]}]=set
done 2>/dev/null <$unistd
fi
- COMPREPLY=($(compgen -W '${!syscalls[@]} file
- process network signal ipc desc all none' \
- -- "$cur"))
+ _comp_compgen -- -W \
+ '${syscalls[@]+"${!syscalls[@]}"} file process
+ network signal ipc desc all none'
return
;;
esac
else
compopt -o nospace
- COMPREPLY=($(compgen -S"=" -W 'trace abbrev verbose raw
- signal read write' -- "$cur"))
+ _comp_compgen -- -S"=" -W 'trace abbrev verbose raw signal
+ read write'
fi
return
;;
-*o)
- _filedir
+ _comp_compgen_filedir
return
;;
-*p)
- _pids
+ _comp_compgen_pids
return
;;
-*S)
- COMPREPLY=($(compgen -W 'time calls name nothing' -- "$cur"))
+ _comp_compgen -- -W 'time calls name nothing'
return
;;
-*u)
- _allowed_users
+ _comp_compgen_allowed_users
return
;;
esac
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur"))
+ _comp_compgen_help -- -h
else
- COMPREPLY=($(compgen -c -- "$cur"))
+ _comp_compgen_commands
fi
fi
} &&
- complete -F _strace -o default strace
+ complete -F _comp_cmd_strace -o default strace
# ex: filetype=sh