public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 09/10] bash-completion: text-utils
Date: Wed, 27 Mar 2013 22:07:51 +0000	[thread overview]
Message-ID: <1364422072-23552-10-git-send-email-kerolasa@iki.fi> (raw)
In-Reply-To: <1364422072-23552-1-git-send-email-kerolasa@iki.fi>

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 shell-completion/col     | 24 ++++++++++++++++++++++++
 shell-completion/colcrt  | 20 ++++++++++++++++++++
 shell-completion/colrm   | 23 +++++++++++++++++++++++
 shell-completion/column  | 34 ++++++++++++++++++++++++++++++++++
 shell-completion/hexdump | 32 ++++++++++++++++++++++++++++++++
 shell-completion/more    | 22 ++++++++++++++++++++++
 shell-completion/pg      | 29 +++++++++++++++++++++++++++++
 shell-completion/rev     | 17 +++++++++++++++++
 shell-completion/tailf   | 24 ++++++++++++++++++++++++
 shell-completion/ul      | 25 +++++++++++++++++++++++++
 10 files changed, 250 insertions(+)
 create mode 100644 shell-completion/col
 create mode 100644 shell-completion/colcrt
 create mode 100644 shell-completion/colrm
 create mode 100644 shell-completion/column
 create mode 100644 shell-completion/hexdump
 create mode 100644 shell-completion/more
 create mode 100644 shell-completion/pg
 create mode 100644 shell-completion/rev
 create mode 100644 shell-completion/tailf
 create mode 100644 shell-completion/ul

diff --git a/shell-completion/col b/shell-completion/col
new file mode 100644
index 0000000..9ad3a67
--- /dev/null
+++ b/shell-completion/col
@@ -0,0 +1,24 @@
+_col_module()
+{
+	local cur prev OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	prev="${COMP_WORDS[COMP_CWORD-1]}"
+	case $prev in
+		'-l'|'--lines')
+			COMPREPLY=( $(compgen -W "number" -- $cur) )
+			return 0
+			;;
+	esac
+	OPTS="-b --no-backspaces
+		-f --fine
+		-p --pass
+		-h --tabs
+		-x --spaces
+		-l --lines
+		-V --version
+		-H --help"
+	COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+	return 0
+}
+complete -F _col_module col
diff --git a/shell-completion/colcrt b/shell-completion/colcrt
new file mode 100644
index 0000000..628416e
--- /dev/null
+++ b/shell-completion/colcrt
@@ -0,0 +1,20 @@
+_colcrt_module()
+{
+	local cur OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	case $cur in
+		-*)
+			OPTS="	-  --no-underlining
+				-2 --half-lines
+				-V --version
+				-h --help"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
+	return 0
+}
+complete -F _colcrt_module colcrt
diff --git a/shell-completion/colrm b/shell-completion/colrm
new file mode 100644
index 0000000..aa57c02
--- /dev/null
+++ b/shell-completion/colrm
@@ -0,0 +1,23 @@
+_colrm_module()
+{
+	local cur OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	case $cur in
+		-*)
+			OPTS="-V --version -h --help"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	case $COMP_CWORD in
+		1)
+			COMPREPLY=( $(compgen -W "startcol" -- $cur) )
+			;;
+		2)
+			COMPREPLY=( $(compgen -W "endcol" -- $cur) )
+			;;
+	esac
+	return 0
+}
+complete -F _colrm_module colrm
diff --git a/shell-completion/column b/shell-completion/column
new file mode 100644
index 0000000..94e1a51
--- /dev/null
+++ b/shell-completion/column
@@ -0,0 +1,34 @@
+_column_module()
+{
+	local cur prev OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	prev="${COMP_WORDS[COMP_CWORD-1]}"
+	case $prev in
+		'-c'|'--columns')
+			COMPREPLY=( $(compgen -W "number" -- $cur) )
+			return 0
+			;;
+		'-s'|'--separator'|'-o'|'--output-separator')
+			COMPREPLY=( $(compgen -W "string" -- $cur) )
+			return 0
+			;;
+	esac
+	case $cur in
+		-*)
+			OPTS="-c --columns
+				-t --table
+				-s --separator
+				-o --output-separator
+				-x --fillrows
+				-h --help
+				-V --version"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
+	return 0
+}
+complete -F _column_module column
diff --git a/shell-completion/hexdump b/shell-completion/hexdump
new file mode 100644
index 0000000..1a6786b
--- /dev/null
+++ b/shell-completion/hexdump
@@ -0,0 +1,32 @@
+_hexdump_module()
+{
+	local cur prev OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	prev="${COMP_WORDS[COMP_CWORD-1]}"
+	case $prev in
+		'-e')
+			COMPREPLY=( $(compgen -W "format" -- $cur) )
+			return 0
+			;;
+		'-n')
+			COMPREPLY=( $(compgen -W "length" -- $cur) )
+			return 0
+			;;
+		'-s')
+			COMPREPLY=( $(compgen -W "offset" -- $cur) )
+			return 0
+			;;
+	esac
+	case $cur in
+		-*)
+			OPTS="-b -c -C -d -o -x -e -f -n -s -v -V"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
+	return 0
+}
+complete -F _hexdump_module hexdump
diff --git a/shell-completion/more b/shell-completion/more
new file mode 100644
index 0000000..f32770d
--- /dev/null
+++ b/shell-completion/more
@@ -0,0 +1,22 @@
+_more_module()
+{
+	local cur OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	case $cur in
+		-*)
+			OPTS="-d -f -l -p -c -u -s -number -V"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+		+*)
+			OPTS="+number +/string"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
+	return 0
+}
+complete -F _more_module more
diff --git a/shell-completion/pg b/shell-completion/pg
new file mode 100644
index 0000000..4ae8887
--- /dev/null
+++ b/shell-completion/pg
@@ -0,0 +1,29 @@
+_pg_module()
+{
+	local cur prev OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	prev="${COMP_WORDS[COMP_CWORD-1]}"
+	case $prev in
+		'-p')
+			COMPREPLY=( $(compgen -W "prompt" -- $cur) )
+			return 0
+			;;
+	esac
+	case $cur in
+		-*)
+			OPTS="-number -c -e -f -n -p -r -s -h -V"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+		+*)
+			OPTS="+number +/pattern/"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
+	return 0
+}
+complete -F _pg_module pg
diff --git a/shell-completion/rev b/shell-completion/rev
new file mode 100644
index 0000000..f891f19
--- /dev/null
+++ b/shell-completion/rev
@@ -0,0 +1,17 @@
+_rev_module()
+{
+	local cur OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	case $cur in
+		-*)
+			OPTS="-V --version -h --help"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
+	return 0
+}
+complete -F _rev_module rev
diff --git a/shell-completion/tailf b/shell-completion/tailf
new file mode 100644
index 0000000..29c5bed
--- /dev/null
+++ b/shell-completion/tailf
@@ -0,0 +1,24 @@
+_tailf_module()
+{
+	local cur prev OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	prev="${COMP_WORDS[COMP_CWORD-1]}"
+	case $prev in
+		'-n'|'--lines')
+			COMPREPLY=( $(compgen -W "number" -- $cur) )
+			return 0
+			;;
+	esac
+	case $cur in
+		-*)
+			OPTS="-n --lines -number -V --version -h --help"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
+	return 0
+}
+complete -F _tailf_module tailf
diff --git a/shell-completion/ul b/shell-completion/ul
new file mode 100644
index 0000000..89e2800
--- /dev/null
+++ b/shell-completion/ul
@@ -0,0 +1,25 @@
+_ul_module()
+{
+	local cur prev OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	prev="${COMP_WORDS[COMP_CWORD-1]}"
+	case $prev in
+		'-t'|'--terminal')
+			# FIXME: terminal type list would be nice
+			COMPREPLY=( $(compgen -W "vt100 xterm linux screen etc" -- $cur) )
+			return 0
+			;;
+	esac
+	case $cur in
+		-*)
+			OPTS="-t --terminal -i --indicated -V --version -h --help"
+			COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+			return 0
+			;;
+	esac
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
+	return 0
+}
+complete -F _ul_module ul
-- 
1.8.2


  parent reply	other threads:[~2013-03-27 22:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27 22:07 [PATCH 00/10] [pull] bash-completion Sami Kerola
2013-03-27 22:07 ` [PATCH 01/10] bash-completion: add bash completetion configure option Sami Kerola
2013-03-28 11:22   ` Sami Kerola
2013-03-29  9:42     ` Karel Zak
2013-03-27 22:07 ` [PATCH 02/10] bash-completion: disk-utils Sami Kerola
2013-03-28  1:42   ` Dave Reisner
2013-04-01 15:54     ` Sami Kerola
2013-03-28  9:54   ` Karel Zak
2013-04-01 17:00     ` Sami Kerola
2013-03-27 22:07 ` [PATCH 03/10] bash-completion: fdisks Sami Kerola
2013-03-28 10:01   ` Karel Zak
2013-03-27 22:07 ` [PATCH 04/10] bash-completion: login-utils Sami Kerola
2013-03-28  1:42   ` Dave Reisner
2013-04-01 16:05     ` Sami Kerola
2013-03-28 10:05   ` Karel Zak
2013-04-01 16:06     ` Sami Kerola
2013-03-27 22:07 ` [PATCH 05/10] bash-completion: misc-utils Sami Kerola
2013-03-28  1:42   ` Dave Reisner
2013-04-01 16:52     ` Sami Kerola
2013-03-27 22:07 ` [PATCH 06/10] bash-completion: schedutils Sami Kerola
2013-03-27 22:07 ` [PATCH 07/10] bash-completion: sys-utils Sami Kerola
2013-03-29 16:33   ` Karel Zak
2013-04-01 16:32     ` Sami Kerola
2013-04-05 14:44   ` Karel Zak
2013-03-27 22:07 ` [PATCH 08/10] bash-completion: term-utils Sami Kerola
2013-03-28 10:06   ` Karel Zak
2013-03-27 22:07 ` Sami Kerola [this message]
2013-03-27 22:07 ` [PATCH 10/10] bash-completion: add completion files to Makefile.am Sami Kerola
2013-03-28  1:42 ` [PATCH 00/10] [pull] bash-completion Dave Reisner
2013-03-28  9:37 ` Karel Zak
2013-03-31 23:49   ` Sami Kerola
2013-04-01 15:44   ` Sami Kerola
2013-04-05 14:11 ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364422072-23552-10-git-send-email-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox