]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - bash-completion/setterm
login: keep default MOTD_FILE= backwardly compatible
[thirdparty/util-linux.git] / bash-completion / setterm
index 33d2e56f60dd51ecbc79a43b45f4aab200989cc7..25213dfd09d4f949c575151d9fbe588f83b033d0 100644 (file)
@@ -1,11 +1,11 @@
 _setterm_module()
 {
-       local cur prev OPTS
+       local bright cur prev OPTS
        COMPREPLY=()
        cur="${COMP_WORDS[COMP_CWORD]}"
        prev="${COMP_WORDS[COMP_CWORD-1]}"
        case $prev in
-               '-term')
+               '--term')
                        local TERM_LIST I
                        TERM_LIST=''
                        for I in /usr/share/terminfo/?/*; do
@@ -14,99 +14,113 @@ _setterm_module()
                        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) )
+               '--foreground'|'--background')
+                       COMPREPLY=( $(compgen -W "black blue cyan default green magenta red white yellow" -- $cur) )
                        return 0
                        ;;
-               '-cursor'|'-repeat'|'-appcursorkeys'|'-linewrap'|'-inversescreen'|'-bold'|'-half-bright'|'-blink'|'-reverse'|'-underline'|'-msg')
+               '--ulcolor'|'--hbcolor'|'bright')
+                       if [ $prev != 'bright' ]; then
+                               bright='bright black grey'
+                       else
+                               bright=''
+                       fi
+                       COMPREPLY=( $(compgen -W "$bright 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')
+               '--clear')
                        COMPREPLY=( $(compgen -W "all rest" -- $cur) )
                        return 0
                        ;;
-               '-tabs'|'-clrtabs')
+               '--tabs'|'--clrtabs')
                        COMPREPLY=( $(compgen -W "tab1 tab2 tab3 tab160" -- $cur) )
                        return 0
                        ;;
-               '-regtabs')
-                       COMPREPLY=( $(compgen -W "$(echo {1..160})" -- $cur) )
+               '--regtabs')
+                       COMPREPLY=( $(compgen -W "{1..160}" -- $cur) )
                        return 0
                        ;;
-               '-blank')
-                       COMPREPLY=( $(compgen -W "$(echo {0..60}) force poke" -- $cur) )
+               '--blank')
+                       COMPREPLY=( $(compgen -W "{0..60} force poke" -- $cur) )
                        return 0
                        ;;
-               '-dump'|'-append')
+               '--dump'|'--append')
                        local NUM_CONS
-                       NUM_CONS=(/sys/class/tty/*)
-                       COMPREPLY=( $(compgen -W "$(echo {1..${#NUM_CONS[*]}})" -- $cur) )
+                       NUM_CONS=(/dev/vcsa?*)
+                       COMPREPLY=( $(compgen -W "{1..${#NUM_CONS[*]}}" -- $cur) )
                        return 0
                        ;;
-               '-file')
+               '--file')
+                       local IFS=$'\n'
                        compopt -o filenames
                        COMPREPLY=( $(compgen -f -- $cur) )
                        return 0
                        ;;
-               '-msglevel')
-                       COMPREPLY=( $(compgen -W "$(echo {1..8})" -- $cur) )
+               '--msglevel')
+                       COMPREPLY=( $(compgen -W "{0..8}" -- $cur) )
                        return 0
                        ;;
-               '-powersave')
+               '--powersave')
                        COMPREPLY=( $(compgen -W "on vsync hsync powerdown off" -- $cur) )
                        return 0
                        ;;
-               '-powerdown')
-                       COMPREPLY=( $(compgen -W "$(echo {0..60})" -- $cur) )
+               '--powerdown')
+                       COMPREPLY=( $(compgen -W "{0..60}" -- $cur) )
                        return 0
                        ;;
-               '-blength')
+               '--blength')
                        COMPREPLY=( $(compgen -W "0-2000" -- $cur) )
                        return 0
                        ;;
-               '-bfreq')
+               '--bfreq')
                        COMPREPLY=( $(compgen -W "freqnumber" -- $cur) )
                        return 0
                        ;;
+               '--help'|'--version')
+                       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"
+       OPTS="  --term
+               --reset
+               --resize
+               --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
 }