From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 04/10] bash-completion: login-utils
Date: Wed, 27 Mar 2013 22:07:46 +0000 [thread overview]
Message-ID: <1364422072-23552-5-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/chfn | 31 +++++++++++++++++++++++++++++++
shell-completion/chsh | 23 +++++++++++++++++++++++
shell-completion/last | 38 ++++++++++++++++++++++++++++++++++++++
shell-completion/login | 27 +++++++++++++++++++++++++++
shell-completion/newgrp | 16 ++++++++++++++++
shell-completion/su | 45 +++++++++++++++++++++++++++++++++++++++++++++
shell-completion/sulogin | 24 ++++++++++++++++++++++++
shell-completion/utmpdump | 17 +++++++++++++++++
8 files changed, 221 insertions(+)
create mode 100644 shell-completion/chfn
create mode 100644 shell-completion/chsh
create mode 100644 shell-completion/last
create mode 100644 shell-completion/login
create mode 100644 shell-completion/newgrp
create mode 100644 shell-completion/su
create mode 100644 shell-completion/sulogin
create mode 100644 shell-completion/utmpdump
diff --git a/shell-completion/chfn b/shell-completion/chfn
new file mode 100644
index 0000000..1c5167a
--- /dev/null
+++ b/shell-completion/chfn
@@ -0,0 +1,31 @@
+_chfn_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f'|'--full-name')
+ COMPREPLY=( $(compgen -W "name" -- $cur) )
+ return 0
+ ;;
+ '-o'|'--office')
+ COMPREPLY=( $(compgen -W "office" -- $cur) )
+ return 0
+ ;;
+ '-p'|'--office-phone'|'-h'|'--home-phone')
+ COMPREPLY=( $(compgen -W "phone-nr" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-f --full-name -o --office -p --office-phone -h --home-phone -u --help -v --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+}
+complete -F _chfn_module chfn
diff --git a/shell-completion/chsh b/shell-completion/chsh
new file mode 100644
index 0000000..c0a194c
--- /dev/null
+++ b/shell-completion/chsh
@@ -0,0 +1,23 @@
+_chsh_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-s'|'--shell')
+ COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-s --shell -l --list-shells -V --version -u --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+}
+complete -F _chsh_module chsh
diff --git a/shell-completion/last b/shell-completion/last
new file mode 100644
index 0000000..493051e
--- /dev/null
+++ b/shell-completion/last
@@ -0,0 +1,38 @@
+_last_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-h')
+ COMPREPLY=( $(compgen -A hostname -- $cur) )
+ return 0
+ ;;
+ '-i')
+ COMPREPLY=( $(compgen -W "ipaddr" -- $cur) )
+ return 0
+ ;;
+ '-t')
+ local TTYS
+ TTYS=$(cd /sys/devices/virtual/tty && echo *)
+ COMPREPLY=( $(compgen -W "$TTYS" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-f -h -i -l -t -y"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+}
+complete -F _last_module last
diff --git a/shell-completion/login b/shell-completion/login
new file mode 100644
index 0000000..c075f64
--- /dev/null
+++ b/shell-completion/login
@@ -0,0 +1,27 @@
+_login_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f')
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+ ;;
+ '-h')
+ COMPREPLY=( $(compgen -A hostname -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-p -f -h -H -V"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+}
+complete -F _login_module login
diff --git a/shell-completion/newgrp b/shell-completion/newgrp
new file mode 100644
index 0000000..567c08c
--- /dev/null
+++ b/shell-completion/newgrp
@@ -0,0 +1,16 @@
+_newgrp_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -g -- $cur) )
+ return 0
+}
+complete -F _newgrp_module newgrp
diff --git a/shell-completion/su b/shell-completion/su
new file mode 100644
index 0000000..ded4b7b
--- /dev/null
+++ b/shell-completion/su
@@ -0,0 +1,45 @@
+_su_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-'|'-u'|'--user')
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+ ;;
+ '-g'|'--group'|'-G'|'--supp-group')
+ COMPREPLY=( $(compgen -g -- $cur) )
+ return 0
+ ;;
+ '-s'|'--shell')
+ COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS=" -u --user
+ -m -p --preserve-environment
+ -g --group
+ -G --supp-group
+ - -l --login
+ -c --command
+ - -c
+ --session-command
+ -- -c
+ -f --fast
+ -s --shell
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _su_module su
+complete -F _su_module runuser
diff --git a/shell-completion/sulogin b/shell-completion/sulogin
new file mode 100644
index 0000000..9fdc20e
--- /dev/null
+++ b/shell-completion/sulogin
@@ -0,0 +1,24 @@
+_sulogin_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--timeout')
+ COMPREPLY=( $(compgen -W "seconds" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-p --login-shell -t --timeout -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- ${cur:-"/dev/tty"}) )
+ return 0
+}
+complete -F _sulogin_module sulogin
diff --git a/shell-completion/utmpdump b/shell-completion/utmpdump
new file mode 100644
index 0000000..e306ef8
--- /dev/null
+++ b/shell-completion/utmpdump
@@ -0,0 +1,17 @@
+_utmpdump_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-f --follow -r --reverse -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _utmpdump_module utmpdump
--
1.8.2
next prev 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 ` Sami Kerola [this message]
2013-03-28 1:42 ` [PATCH 04/10] bash-completion: login-utils 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 ` [PATCH 09/10] bash-completion: text-utils Sami Kerola
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-5-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