pgrep, pkill, killall: Base pkill on pgrep, add more option completions.
parent
5fcaad8756
commit
59a8a9c41b
|
@ -643,10 +643,6 @@ symlinks:
|
|||
rm -f $(targetdir)/$$file && \
|
||||
$(LN_S) java $(targetdir)/$$file ; \
|
||||
done
|
||||
for file in pkill ; do \
|
||||
rm -f $(targetdir)/$$file && \
|
||||
$(LN_S) killall $(targetdir)/$$file ; \
|
||||
done
|
||||
for file in arm-koji ppc-koji s390-koji sparc-koji ; do \
|
||||
rm -f $(targetdir)/$$file && \
|
||||
$(LN_S) koji $(targetdir)/$$file ; \
|
||||
|
@ -713,6 +709,10 @@ symlinks:
|
|||
rm -f $(targetdir)/$$file && \
|
||||
$(LN_S) pkg_delete $(targetdir)/$$file ; \
|
||||
done
|
||||
for file in pkill ; do \
|
||||
rm -f $(targetdir)/$$file && \
|
||||
$(LN_S) pgrep $(targetdir)/$$file ; \
|
||||
done
|
||||
for file in pm-suspend pm-suspend-hybrid ; do \
|
||||
rm -f $(targetdir)/$$file && \
|
||||
$(LN_S) pm-hibernate $(targetdir)/$$file ; \
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# killall(1) and pkill(1) completion -*- shell-script -*-
|
||||
# killall(1) completion -*- shell-script -*-
|
||||
|
||||
[[ $OSTYPE == *@(linux|freebsd|darwin)* ]] || return 1
|
||||
|
||||
_killall()
|
||||
{
|
||||
|
@ -10,7 +12,7 @@ _killall()
|
|||
return
|
||||
;;
|
||||
-s|--signal)
|
||||
[[ $1 == *killall ]] && _signals
|
||||
_signals
|
||||
return
|
||||
;;
|
||||
-u|--user)
|
||||
|
@ -21,15 +23,14 @@ _killall()
|
|||
|
||||
$split && return
|
||||
|
||||
if [[ $cword -eq 1 && "$cur" == -* ]]; then
|
||||
_signals -
|
||||
else
|
||||
_pnames
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
[[ $cword -eq 1 ]] && _signals -
|
||||
return
|
||||
fi
|
||||
|
||||
return 0
|
||||
_pnames
|
||||
} &&
|
||||
complete -F _killall pkill
|
||||
[[ $OSTYPE == *@(linux|freebsd|darwin)* ]] && complete -F _killall killall || :
|
||||
complete -F _killall killall
|
||||
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# pgrep(1) completion -*- shell-script -*-
|
||||
# pgrep(1) and pkill(1) completion -*- shell-script -*-
|
||||
|
||||
_pgrep()
|
||||
{
|
||||
|
@ -6,13 +6,21 @@ _pgrep()
|
|||
_init_completion || return
|
||||
|
||||
case $prev in
|
||||
-d|-g|-s|-t)
|
||||
-c|-d|-g|-J|-M|-N|-s|-t|-T|-z)
|
||||
return
|
||||
;;
|
||||
-F)
|
||||
_filedir
|
||||
return
|
||||
;;
|
||||
-G)
|
||||
_gids
|
||||
return
|
||||
;;
|
||||
-j)
|
||||
COMPREPLY=( $( compgen -W 'any none' -- "$cur" ) )
|
||||
return
|
||||
;;
|
||||
-P)
|
||||
_pids
|
||||
return
|
||||
|
@ -24,12 +32,15 @@ _pgrep()
|
|||
esac
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( "$1" --usage 2>&1 |
|
||||
sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//" |
|
||||
_parse_usage - )' -- "$cur" ) )
|
||||
[[ $cword -eq 1 && $1 == *pkill ]] && _signals -
|
||||
return
|
||||
fi
|
||||
|
||||
_pnames
|
||||
} &&
|
||||
complete -F _pgrep pgrep
|
||||
complete -F _pgrep pgrep pkill
|
||||
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
||||
|
|
|
@ -17,7 +17,7 @@ assert_complete_any "killall "
|
|||
sync_after_int
|
||||
|
||||
|
||||
assert_complete [get_signals -] "killall -"
|
||||
assert_complete [get_signals] "killall --signal "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
|
Loading…
Reference in New Issue