]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
bash-completion: term-utils
authorSami Kerola <kerolasa@iki.fi>
Mon, 25 Mar 2013 21:37:36 +0000 (21:37 +0000)
committerSami Kerola <kerolasa@iki.fi>
Mon, 1 Apr 2013 16:41:55 +0000 (17:41 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
shell-completion/mesg [new file with mode: 0644]
shell-completion/script [new file with mode: 0644]
shell-completion/scriptreplay [new file with mode: 0644]
shell-completion/setterm [new file with mode: 0644]
shell-completion/wall [new file with mode: 0644]
shell-completion/write [new file with mode: 0644]

diff --git a/shell-completion/mesg b/shell-completion/mesg
new file mode 100644 (file)
index 0000000..62c98ca
--- /dev/null
@@ -0,0 +1,16 @@
+_mesg_module()
+{
+       local cur OPTS
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       case $cur in
+               -*)
+                       OPTS="-v --verbose -V --version -h --help"
+                       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       COMPREPLY=( $(compgen -W "y n" -- $cur) )
+       return 0
+}
+complete -F _mesg_module mesg
diff --git a/shell-completion/script b/shell-completion/script
new file mode 100644 (file)
index 0000000..48f50c3
--- /dev/null
@@ -0,0 +1,36 @@
+_script_module()
+{
+       local cur prev OPTS
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       prev="${COMP_WORDS[COMP_CWORD-1]}"
+       case $prev in
+               '-c'|'--command')
+                       compopt -o bashdefault
+                       COMPREPLY=( $(compgen -c -- $cur) )
+                       return 0
+                       ;;
+       esac
+       case $cur in
+               '=')
+                       cur=${cur#=}
+                       ;;
+               -*)
+                       OPTS="-a --append
+                               -c --command
+                               -e --return
+                               -f --flush
+                                  --force
+                               -q --quiet
+                               -t= --timing=
+                               -V --version
+                               -h --help"
+                       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       compopt -o filenames
+       COMPREPLY=( $(compgen -f -- $cur) )
+       return 0
+}
+complete -F _script_module script
diff --git a/shell-completion/scriptreplay b/shell-completion/scriptreplay
new file mode 100644 (file)
index 0000000..78e5b23
--- /dev/null
@@ -0,0 +1,28 @@
+_scriptreplay_module()
+{
+       local cur prev OPTS
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       prev="${COMP_WORDS[COMP_CWORD-1]}"
+       case $prev in
+               '-d'|'--divisor')
+                       COMPREPLY=( $(compgen -W "digit" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       case $cur in
+               -*)
+                       OPTS="-t --timing
+                               -s --typescript
+                               -d --divisor
+                               -V --version
+                               -h --help"
+                       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       compopt -o filenames
+       COMPREPLY=( $(compgen -f -- $cur) )
+       return 0
+}
+complete -F _scriptreplay_module scriptreplay
diff --git a/shell-completion/setterm b/shell-completion/setterm
new file mode 100644 (file)
index 0000000..33d2e56
--- /dev/null
@@ -0,0 +1,113 @@
+_setterm_module()
+{
+       local cur prev OPTS
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       prev="${COMP_WORDS[COMP_CWORD-1]}"
+       case $prev in
+               '-term')
+                       local TERM_LIST I
+                       TERM_LIST=''
+                       for I in /usr/share/terminfo/?/*; do
+                               TERM_LIST+="${I##*/} "
+                       done
+                       COMPREPLY=( $(compgen -W "$TERM_LIST" -- $cur) )
+                       return 0
+                       ;;
+               '-foreground'|'-background'|'-ulcolor'|'-hbcolor')
+                       COMPREPLY=( $(compgen -W "default black blue cyan green magenta red white yellow" -- $cur) )
+                       return 0
+                       ;;
+               '-cursor'|'-repeat'|'-appcursorkeys'|'-linewrap'|'-inversescreen'|'-bold'|'-half-bright'|'-blink'|'-reverse'|'-underline'|'-msg')
+                       COMPREPLY=( $(compgen -W "off on" -- $cur) )
+                       return 0
+                       ;;
+               '-clear')
+                       COMPREPLY=( $(compgen -W "all rest" -- $cur) )
+                       return 0
+                       ;;
+               '-tabs'|'-clrtabs')
+                       COMPREPLY=( $(compgen -W "tab1 tab2 tab3 tab160" -- $cur) )
+                       return 0
+                       ;;
+               '-regtabs')
+                       COMPREPLY=( $(compgen -W "$(echo {1..160})" -- $cur) )
+                       return 0
+                       ;;
+               '-blank')
+                       COMPREPLY=( $(compgen -W "$(echo {0..60}) force poke" -- $cur) )
+                       return 0
+                       ;;
+               '-dump'|'-append')
+                       local NUM_CONS
+                       NUM_CONS=(/sys/class/tty/*)
+                       COMPREPLY=( $(compgen -W "$(echo {1..${#NUM_CONS[*]}})" -- $cur) )
+                       return 0
+                       ;;
+               '-file')
+                       compopt -o filenames
+                       COMPREPLY=( $(compgen -f -- $cur) )
+                       return 0
+                       ;;
+               '-msglevel')
+                       COMPREPLY=( $(compgen -W "$(echo {1..8})" -- $cur) )
+                       return 0
+                       ;;
+               '-powersave')
+                       COMPREPLY=( $(compgen -W "on vsync hsync powerdown off" -- $cur) )
+                       return 0
+                       ;;
+               '-powerdown')
+                       COMPREPLY=( $(compgen -W "$(echo {0..60})" -- $cur) )
+                       return 0
+                       ;;
+               '-blength')
+                       COMPREPLY=( $(compgen -W "0-2000" -- $cur) )
+                       return 0
+                       ;;
+               '-bfreq')
+                       COMPREPLY=( $(compgen -W "freqnumber" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       OPTS="  -term
+               -reset
+               -initialize
+               -cursor
+               -repeat
+               -appcursorkeys
+               -linewrap
+               -default
+               -foreground
+               -background
+               -ulcolor
+               -hbcolor
+               -ulcolor
+               -hbcolor
+               -inversescreen
+               -bold
+               -half-bright
+               -blink
+               -reverse
+               -underline
+               -store
+               -clear
+               -tabs
+               -clrtabs
+               -regtabs
+               -blank
+               -dump
+               -append
+               -file
+               -msg
+               -msglevel
+               -powersave
+               -powerdown
+               -blength
+               -bfreq
+               -version
+               -help"
+       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+       return 0
+}
+complete -F _setterm_module setterm
diff --git a/shell-completion/wall b/shell-completion/wall
new file mode 100644 (file)
index 0000000..d3cbbd5
--- /dev/null
@@ -0,0 +1,24 @@
+_wall_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="-n --nobanner -t --timeout -V --version -h --help"
+                       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       compopt -o filenames
+       COMPREPLY=( $(compgen -f -- $cur) )
+       return 0
+}
+complete -F _wall_module wall
diff --git a/shell-completion/write b/shell-completion/write
new file mode 100644 (file)
index 0000000..d41159b
--- /dev/null
@@ -0,0 +1,22 @@
+_write_module()
+{
+       local cur
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       case $COMP_CWORD in
+               1)
+                       COMPREPLY=( $(compgen -u -- $cur) )
+                       return 0
+                       ;;
+               2)
+                       local I TERMS=''
+                       for I in /sys/class/tty/*; do
+                               TERMS+="/dev${I##/sys/class/tty} "
+                       done
+                       COMPREPLY=( $(compgen -W "$TERMS" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       return 0
+}
+complete -F _write_module write