diff options
Diffstat (limited to 'Completion/BSD/Command')
-rw-r--r-- | Completion/BSD/Command/_cu | 4 | ||||
-rw-r--r-- | Completion/BSD/Command/_fstat | 2 | ||||
-rw-r--r-- | Completion/BSD/Command/_powerd | 20 | ||||
-rw-r--r-- | Completion/BSD/Command/_vmctl | 59 |
4 files changed, 54 insertions, 31 deletions
diff --git a/Completion/BSD/Command/_cu b/Completion/BSD/Command/_cu index 1fe08601f..df38d6ed7 100644 --- a/Completion/BSD/Command/_cu +++ b/Completion/BSD/Command/_cu @@ -32,7 +32,7 @@ case $variant in '(-E --escape)'{-E+,--escape=}'[specify escape character]:escape character [~]' '(-a -p --port)'{-a+,-p+,--port=}'[specify the port]:port' '(-c --phone -n --prompt)'{-c+,--phone=}'[specify phone number to call]:phone number' - '(1 -l -z --system)--line=[specify line to use]:line:(/dev/(cuaU#<->|ttyS<->|tty.*)(N%c))' + '(1 -l -z --system)--line=[specify line to use]:line:(/dev/(cuaU#<->|ttyS<->|tty.*|cu.*)(N%c))' ) ;| taylor) @@ -63,5 +63,5 @@ esac _arguments -s $args \ '(--speed)-s+[set line speed for the connection]:line speed [9600]:_baudrates' \ - '(1 --line -z --system)-l+[specify line to use]:line:(/dev/(cuaU#<->|ttyS<->|tty.*)(N%c))' \ + '(1 --line -z --system)-l+[specify line to use]:line:(/dev/(cuaU#<->|ttyS<->|tty.*|cu.*)(N%c))' \ '1: :_guard "^-*" system' diff --git a/Completion/BSD/Command/_fstat b/Completion/BSD/Command/_fstat index 5487e6c0f..153378441 100644 --- a/Completion/BSD/Command/_fstat +++ b/Completion/BSD/Command/_fstat @@ -9,4 +9,4 @@ _arguments -s \ '-p+[report all files open by the specified process]:process id:_pids' \ '-u+[report all files open by the specified user]:user:_users' \ '-v[verbose mode]' \ -'*:files:_files' +'*: :_files' diff --git a/Completion/BSD/Command/_powerd b/Completion/BSD/Command/_powerd index 05c03ab15..c64abb5bc 100644 --- a/Completion/BSD/Command/_powerd +++ b/Completion/BSD/Command/_powerd @@ -3,13 +3,13 @@ local powerd_mode powerd_mode=(minimum maximum adaptative) _arguments -s \ - "-a[mode to use while on AC power]:mode:($powerd_mode)" \ - "-b[mode to use while on battery power]:mode:($powerd_mode)" \ - '-i[CPU idle percent level when begin to degrade performance]:percent:' \ - '-m[minimum frequency to throttle down to]:frequency (MHz)' \ - '-M[maximum frequency to throttle up to]:frequency (MHz)' \ - "-n[mode to use normally when the AC line state is unknown]:mode:($powerd_mode)" \ - '-p[polling interval (in milliseconds) for AC line state and system idle levels]:interval:' \ - '-P[alternative pidfile]:pidfile:_files' \ - '-r[CPU idle percent level where to increase performance]:percent:' \ - '-v[verbose mode]' + "-a+[mode to use while on AC power]:mode:($powerd_mode)" \ + "-b+[mode to use while on battery power]:mode:($powerd_mode)" \ + '-i+[CPU idle percent level when begin to degrade performance]:percent [75]' \ + '-m+[minimum frequency to throttle down to]:frequency (MHz)' \ + '-M+[maximum frequency to throttle up to]:frequency (MHz)' \ + "-n+[mode to use normally when the AC line state is unknown]:mode:($powerd_mode)" \ + '-p+[polling interval for AC line state and system idle levels]:interval (ms) [250]:' \ + '-P+[alternative pidfile]:pidfile:_files' \ + '-r+[CPU idle percent level where to increase performance]:percent' \ + '-v[verbose mode]' diff --git a/Completion/BSD/Command/_vmctl b/Completion/BSD/Command/_vmctl index 4e66c2383..66d9081b0 100644 --- a/Completion/BSD/Command/_vmctl +++ b/Completion/BSD/Command/_vmctl @@ -1,16 +1,18 @@ #compdef vmctl -local context line state state_descr -local -a subcommands vmctl_status -local -A opt_args +local -a subcommands alts -_vm_name() { - compadd "$@" - ${${${(@f)"$(_call_program vmctl_status vmctl status)"}[2,-1]}##* } +_vm_names() { + local expl + _description virtual-machines expl 'virtual machine' + compadd "$@" "$expl[@]" - ${${${(@f)"$(_call_program virtual-machines vmctl status)"}[2,-1]}##* } } -_vm_switch() { +_vm_switches() { + local expl + _description virtual-switches expl 'virtual switch' [[ -r /etc/vm.conf ]] && - compadd "$@" - ${${${(M)${(f)"$(</etc/vm.conf)"}:#switch *}##switch ##\"#}%%\"# *} + compadd "$@" "$expl[@]" - ${${${(M)${(f)"$(</etc/vm.conf)"}:#switch *}##switch ##\"#}%%\"# *} } subcommands=( @@ -26,22 +28,30 @@ subcommands=( {show,status}:'list VMs running or just the specified id' start:'start a VM' stop:'stop a VM' - unpause:'unpause a VM' + unpause:'resume a VM' ) if (( CURRENT == 2 )); then _describe subcommand subcommands else + local curcontext="${curcontext%:*}-${words[2]}:" shift words; (( CURRENT-- )) case $words[1] in - console|pause|send|show|status|stop|unpause) - _arguments ':id:_vm_name' + console|pause|send|show|status|unpause) + _vm_names ;; create) - _arguments \ - ':path:_files' \ - ': :(-s)' \ - ':disk size in megabytes: ' + if (( CURRENT == 2 )); then + compset -P '(raw|qcow2):' || alts=( + 'prefixes:prefix:compadd -S: raw qcow2' + ) + _alternative 'files:path:_files' $alts + else + shift words; (( CURRENT-- )) + _arguments \ + '-s+[specify size]:size' \ + '-b+[specify base disk]:base image:_files' + fi ;; load) _arguments ':configuration file:_files' @@ -61,7 +71,7 @@ else ;; start) if (( CURRENT == 2 )); then - _vm_name + _vm_names else shift words; (( CURRENT-- )) _arguments -s \ @@ -71,9 +81,22 @@ else '-i+[number of network interfaces]:number: ' \ '-L[add a local network interface]' \ '-m+[memory size in megabytes]:megabytes: ' \ - '-n+[specify switch to attach]:switch:_vm_switch' \ - '-r+[ISO image file for virtual CD-ROM]:ISO image:_files' + '-n+[specify switch to attach]: :_vm_switches' \ + '-r+[ISO image file for virtual CD-ROM]:ISO image:_files' \ + '-t+[use existing VM as a template]: :_vm_names' fi - ;; + ;; + stop) + if (( CURRENT == 2 )); then + _alternative \ + 'all:all:(-a)' \ + 'virtual-machines: :_vm_names' + else + shift words; (( CURRENT-- )) + _arguments \ + '-f[forcefully stop without attempting a graceful shutdown]' \ + '-w[wait until the VM has been terminated]' + fi + ;; esac fi |