[Bash-completion-devel] [PATCH][bash-completion-Bugs][311403] DBTS 501837: don't use uname for pidof completion, just check for its presence
Igor Murzov
e-mail at date.by
Tue Nov 15 21:24:52 UTC 2011
Proposed patch for Alioth #311403:
From 0aa2c008320bdc68888bf56a1bec8558a1754c23 Mon Sep 17 00:00:00 2001
From: Igor Murzov <e-mail at date.by>
Date: Tue, 15 Nov 2011 23:46:25 +0300
Subject: [PATCH] pidof: Don't check OS type (Alioth #311403)
Also drop non-existent option arguments completion.
---
completions/.gitignore | 1 -
completions/Makefile.am | 6 +-----
completions/pgrep | 3 ---
completions/pidof | 17 +++++++++++++++++
test/completion/pidof.exp | 1 +
test/lib/completions/pidof.exp | 20 ++++++++++++++++++++
6 files changed, 39 insertions(+), 9 deletions(-)
create mode 100644 completions/pidof
create mode 100644 test/completion/pidof.exp
create mode 100644 test/lib/completions/pidof.exp
diff --git a/completions/.gitignore b/completions/.gitignore
index 427fdff..9ce8b5a 100644
--- a/completions/.gitignore
+++ b/completions/.gitignore
@@ -94,7 +94,6 @@ pbzip2
pccardctl
perldoc
phing
-pidof
pigz
pinfo
ping6
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 95afddb..90447a5 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -210,6 +210,7 @@ bashcomp_DATA = a2x \
passwd \
perl \
pgrep \
+ pidof \
pine \
ping \
pkg-config \
@@ -425,7 +426,6 @@ CLEANFILES = \
pccardctl \
perldoc \
phing \
- pidof \
pigz \
pinfo \
ping6 \
@@ -684,10 +684,6 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) perl $(targetdir)/$$file ; \
done
- for file in pidof ; do \
- rm -f $(targetdir)/$$file && \
- $(LN_S) pgrep $(targetdir)/$$file ; \
- done
for file in alpine ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) pine $(targetdir)/$$file ; \
diff --git a/completions/pgrep b/completions/pgrep
index 9e66fb9..87df1a1 100644
--- a/completions/pgrep
+++ b/completions/pgrep
@@ -32,7 +32,4 @@ _pgrep()
} &&
complete -F _pgrep pgrep
-# Linux pidof(8) completion.
-[[ $OSTYPE == *linux* ]] && complete -F _pgrep pidof
-
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pidof b/completions/pidof
new file mode 100644
index 0000000..5964922
--- /dev/null
+++ b/completions/pidof
@@ -0,0 +1,17 @@
+# pidof(8) completion -*- shell-script -*-
+
+_pidof()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ return
+ fi
+
+ _pnames
+} &&
+complete -F _pidof pidof
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/pidof.exp b/test/completion/pidof.exp
new file mode 100644
index 0000000..c66ee9f
--- /dev/null
+++ b/test/completion/pidof.exp
@@ -0,0 +1 @@
+assert_source_completions pidof
diff --git a/test/lib/completions/pidof.exp b/test/lib/completions/pidof.exp
new file mode 100644
index 0000000..8fdab97
--- /dev/null
+++ b/test/lib/completions/pidof.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pidof "
+
+
+sync_after_int
+
+
+teardown
--
1.7.5.1
More information about the Bash-completion-devel
mailing list