PageRenderTime 153ms CodeModel.GetById 149ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion.d/qemu

http://github.com/brinkman83/bashrc
#! | 132 lines | 126 code | 6 blank | 0 comment | 0 complexity | 9262fe9015aa06919a73879060e546d5 MD5 | raw file
  1# bash completion for qemu
  2
  3have qemu &&
  4_qemu()
  5{
  6    local cur prev
  7
  8    COMPREPLY=()
  9    cur=`_get_cword`
 10    prev=${COMP_WORDS[COMP_CWORD-1]}
 11
 12    case $prev in
 13        -@(fd[ab]|hd[abcd]|cdrom|option-rom|kernel|initrd|bootp|pidfile|loadvm|mtdblock|sd|pflash|bios))
 14            _filedir
 15            return 0
 16            ;;
 17        -@(tftp|smb|L|chroot))
 18            _filedir -d
 19            return 0
 20            ;;
 21        -boot)
 22            COMPREPLY=( $( compgen -W 'a c d n' -- "$cur" ) )
 23            return 0
 24            ;;
 25        -k)
 26            COMPREPLY=( $( compgen -W 'ar de-ch es fo fr-ca hu ja \
 27                mk no pt-br sv da en-gb et fr fr-ch is lt nl pl\
 28                ru th de en-us fi fr-be hr it lv nl-be pt sl tr' -- "$cur" ) )
 29            return 0
 30            ;;
 31        -soundhw)
 32            COMPREPLY=( $( compgen -W "$( qemu -soundhw ? | awk \
 33                '/^[[:lower:]]/ {print $1}' ) all" -- "$cur" ) )
 34            return 0
 35            ;;
 36        -M)
 37            COMPREPLY=( $( compgen -W "$( qemu -M ? | awk \
 38                '/^[[:lower:]]/ {print $1}' )" -- "$cur" ) )
 39            return 0
 40            ;;
 41        -cpu)
 42            COMPREPLY=( $( compgen -W "$( qemu -cpu ? | awk \
 43                '{print $2}' )" -- "$cur" ) )
 44            return 0
 45            ;;
 46        -usbdevice)
 47            COMPREPLY=( $( compgen -W 'mouse tablet disk: host: \
 48                serial: braille net' -- "$cur" ) )
 49            return 0
 50            ;;
 51        -net)
 52            COMPREPLY=( $( compgen -W 'nic user tap socket vde none dump' \
 53                -- "$cur" ) )
 54            return 0
 55            ;;
 56        -@(serial|parallel|monitor))
 57            COMPREPLY=( $( compgen -W 'vc pty none null /dev/ \
 58                file: stdio pipe: COM udp: tcp: telnet: unix: \
 59                mon: braille' -- "$cur" ) )
 60            return 0
 61            ;;
 62        -redir)
 63            COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- "$cur" ) )
 64            return 0
 65            ;;
 66        -bt)
 67            COMPREPLY=( $( compgen -W 'hci vhci device' -- "$cur" ) )
 68            return 0
 69            ;;
 70        -vga)
 71            COMPREPLY=( $( compgen -W 'cirrus std vmware xenfb none' \
 72                -- "$cur" ) )
 73            return 0
 74            ;;
 75        -drive)
 76            COMPREPLY=( $( compgen -S"=" -W 'file if bus unit index media \
 77                cyls snapshot cache format serial addr' -- "$cur" ) )
 78            return 0
 79            ;;
 80        -ballon)
 81            COMPREPLY=( $( compgen -W 'none virtio' -- "$cur" ) )
 82            return 0
 83            ;;
 84        -smbios)
 85            COMPREPLY=( $( compgen -W 'file type' -- "$cur" ) )
 86            return 0
 87            ;;
 88        -watchdog)
 89            COMPREPLY=( $( compgen -W "$( qemu -watchdog ? 2>&1 | \
 90                awk '{print $1}' )" -- "$cur" ) )
 91            return 0
 92            ;;
 93        -watchdog-action)
 94            COMPREPLY=( $( compgen -W 'reset shutdown poweroff pause debug \
 95                none' -- "$cur" ) )
 96            return 0
 97            ;;
 98        -runas)
 99            COMPREPLY=( $( compgen -u -- "$cur" ) )
100            return 0
101            ;;
102    esac
103
104
105    if [[ "$cur" == -* ]]; then
106        COMPREPLY=( $( compgen -W '-M -fda -fdb -hda -hdb -hdc -hdd \
107            -cdrom -boot -snapshot -no-fd-bootchk -m -smp -nographic -vnc \
108            -k -audio-help -soundhw -localtime -full-screen -pidfile \
109            -daemonize -win2k-hack -option-rom -usb -usbdevice -net -tftp \
110            -smb -redir -kernel -append -initrd -serial -parallel -monitor \
111            -s -p -S -d -hdachs -L -std-vga -no-acpi -no-reboot -loadvm \
112            -semihosting -cpu -bt -vga -drive -startdate -name -curses \
113            -no-frame -no-quit -bootp -echr -no-shutdown -icount -g \
114            -prom-env -h -help -version -numa -mtdblock -sd -pflash \
115            -device -uuid -alt-grab -sdl -portrait -rtc-td-hack -no-hpet \
116            -balloon -acpitable -smbios -singlestep -gdb -hdachs -bios \
117            -kernel-kqemu -enable-kqemu -enable-kvm -clock -watchdog \
118            -watchdog-action -virtioconsole -show-cursor -tb-size -incoming \
119            -chroot -runas' -- "$cur" ) )
120    else
121        _filedir
122    fi
123} &&
124complete -F _qemu $filenames qemu
125
126# Local variables:
127# mode: shell-script
128# sh-basic-offset: 4
129# sh-indent-comment: t
130# indent-tabs-mode: nil
131# End:
132# ex: ts=4 sw=4 et filetype=sh