[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.90-113-g59a8a9c
Ville Skyttä
ville.skytta at iki.fi
Tue Dec 27 19:53:59 UTC 2011
The following commit has been merged in the master branch:
commit 59a8a9c41b222d8bff2b053d7a95227ef512b2e1
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Tue Dec 27 21:52:58 2011 +0200
pgrep, pkill, killall: Base pkill on pgrep, add more option completions.
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 70cc7ca..ba3cfb0 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -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 ; \
diff --git a/completions/killall b/completions/killall
index d2f6dd4..ed502f9 100644
--- a/completions/killall
+++ b/completions/killall
@@ -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
diff --git a/completions/pgrep b/completions/pgrep
index 87df1a1..0a1c862 100644
--- a/completions/pgrep
+++ b/completions/pgrep
@@ -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
diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp
index 1ee3ade..feec933 100644
--- a/test/lib/completions/killall.exp
+++ b/test/lib/completions/killall.exp
@@ -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
--
bash-completion
More information about the Bash-completion-commits
mailing list