From 41e5a92cf1cd8950df8b02fdd2ea8be571dbab02 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 23 Mar 2013 16:49:52 +0000 Subject: bash-completion: login-utils Signed-off-by: Sami Kerola --- shell-completion/last | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 shell-completion/last (limited to 'shell-completion/last') diff --git a/shell-completion/last b/shell-completion/last new file mode 100644 index 000000000..493051e64 --- /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 -- cgit v1.2.3-55-g7522