2009-01-19 22:05:01 +01:00
|
|
|
# bash completion for qemu
|
|
|
|
|
2011-04-05 00:35:51 +03:00
|
|
|
have qemu || return
|
|
|
|
|
2009-01-19 22:05:01 +01:00
|
|
|
_qemu()
|
|
|
|
{
|
2011-04-21 11:04:51 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-01-19 22:05:01 +01:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
case $prev in
|
2009-11-22 11:43:26 +01:00
|
|
|
-fd[ab]|-hd[abcd]|-cdrom|-option-rom|-kernel|-initrd|-bootp|-pidfile| \
|
|
|
|
-loadvm|-mtdblock|-sd|-pflash|-bios)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-tftp|-smb|-L|-chroot)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-boot)
|
|
|
|
COMPREPLY=( $( compgen -W 'a c d n' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-k)
|
|
|
|
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
|
|
|
|
;;
|
|
|
|
-soundhw)
|
|
|
|
COMPREPLY=( $( compgen -W "$( qemu -soundhw ? | awk \
|
|
|
|
'/^[[:lower:]]/ {print $1}' ) all" -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-M)
|
|
|
|
COMPREPLY=( $( compgen -W "$( qemu -M ? | awk \
|
|
|
|
'/^[[:lower:]]/ {print $1}' )" -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-cpu)
|
|
|
|
COMPREPLY=( $( compgen -W "$( qemu -cpu ? | awk \
|
|
|
|
'{print $2}' )" -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-usbdevice)
|
|
|
|
COMPREPLY=( $( compgen -W 'mouse tablet disk: host: \
|
|
|
|
serial: braille net' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-net)
|
|
|
|
COMPREPLY=( $( compgen -W 'nic user tap socket vde none dump' \
|
|
|
|
-- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-serial|-parallel|-monitor)
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'vc pty none null /dev/ \
|
|
|
|
file: stdio pipe: COM udp: tcp: telnet: unix: \
|
|
|
|
mon: braille' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-redir)
|
|
|
|
COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-bt)
|
|
|
|
COMPREPLY=( $( compgen -W 'hci vhci device' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-vga)
|
|
|
|
COMPREPLY=( $( compgen -W 'cirrus std vmware xenfb none' \
|
|
|
|
-- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-drive)
|
|
|
|
COMPREPLY=( $( compgen -S"=" -W 'file if bus unit index media \
|
|
|
|
cyls snapshot cache format serial addr' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-ballon)
|
|
|
|
COMPREPLY=( $( compgen -W 'none virtio' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-smbios)
|
|
|
|
COMPREPLY=( $( compgen -W 'file type' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-watchdog)
|
|
|
|
COMPREPLY=( $( compgen -W "$( qemu -watchdog ? 2>&1 | \
|
|
|
|
awk '{print $1}' )" -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-watchdog-action)
|
|
|
|
COMPREPLY=( $( compgen -W 'reset shutdown poweroff pause debug \
|
|
|
|
none' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-runas)
|
2010-10-31 21:23:26 +02:00
|
|
|
_allowed_users
|
2009-10-04 19:42:50 +02:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-01-19 22:05:01 +01:00
|
|
|
|
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:23:05 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help ) -fd{a,b}
|
|
|
|
-hd{a..d}' -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
else
|
|
|
|
_filedir
|
|
|
|
fi
|
2009-01-19 22:05:01 +01:00
|
|
|
} &&
|
2010-11-01 19:26:53 +02:00
|
|
|
complete -F _qemu qemu
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|