# bash completion for qemu -*- shell-script -*- proc _qemu { local cur prev words cword _init_completion || return match $prev { with -fd[ab]|-hd[abcd]|-cdrom|-option-rom|-kernel|-initrd|-bootp|-pidfile| \ -loadvm|-mtdblock|-sd|-pflash|-bios _filedir return 0 with -tftp|-smb|-L|-chroot _filedir -d return 0 with -boot setglobal COMPREPLY = ''( $( compgen -W 'a c d n' -- "$cur" ) ) return 0 with -k setglobal COMPREPLY = ''( $( compgen -W 'ar de-ch es fo fr-ca hu ja mk no pt-br sv da en-gb et fr fr-ch is lt nl pl ru th de en-us fi fr-be hr it lv nl-be pt sl tr' -- "$cur" ) ) return 0 with -soundhw setglobal COMPREPLY = ''( $( compgen -W "$( $1 -soundhw ? | awk \ '/^[[:lower:]]/ {print $1}' ) all" -- "$cur" ) ) return 0 with -M setglobal COMPREPLY = ''( $( compgen -W "$( $1 -M ? | awk \ '/^[[:lower:]]/ {print $1}' )" -- "$cur" ) ) return 0 with -cpu setglobal COMPREPLY = ''( $( compgen -W "$( $1 -cpu ? | awk \ '{print $2}' )" -- "$cur" ) ) return 0 with -usbdevice setglobal COMPREPLY = ''( $( compgen -W 'mouse tablet disk: host: serial: braille net' -- "$cur" ) ) return 0 with -net setglobal COMPREPLY = ''( $( compgen -W 'nic user tap socket vde none dump' \ -- "$cur" ) ) return 0 with -serial|-parallel|-monitor setglobal COMPREPLY = ''( $( compgen -W 'vc pty none null /dev/ file: stdio pipe: COM udp: tcp: telnet: unix: mon: braille' -- "$cur" ) ) return 0 with -redir setglobal COMPREPLY = ''( $( compgen -S":" -W 'tcp udp' -- "$cur" ) ) return 0 with -bt setglobal COMPREPLY = ''( $( compgen -W 'hci vhci device' -- "$cur" ) ) return 0 with -vga setglobal COMPREPLY = ''( $( compgen -W 'cirrus std vmware xenfb none' \ -- "$cur" ) ) return 0 with -drive setglobal COMPREPLY = ''( $( compgen -S"=" -W 'file if bus unit index media cyls snapshot cache format serial addr' -- "$cur" ) ) return 0 with -balloon setglobal COMPREPLY = ''( $( compgen -W 'none virtio' -- "$cur" ) ) return 0 with -smbios setglobal COMPREPLY = ''( $( compgen -W 'file type' -- "$cur" ) ) return 0 with -watchdog setglobal COMPREPLY = ''( $( compgen -W "$( $1 -watchdog ? 2>&1 | \ awk '{print $1}' )" -- "$cur" ) ) return 0 with -watchdog-action setglobal COMPREPLY = ''( $( compgen -W 'reset shutdown poweroff pause debug none' -- "$cur" ) ) return 0 with -runas _allowed_users return 0 } if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_help "$1" -help ) -fd{a,b} -hd{a..d}' -- "$cur" ) ) } else { _filedir } } && complete -F _qemu qemu qemu-kvm qemu-system-i386 qemu-system-x86_64 # ex: ts=4 sw=4 et filetype=sh