-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
_prlctl
105 lines (91 loc) · 1.93 KB
/
_prlctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#compdef prlctl
#
# Parallels prlctl zsh completion
#
# Using this PDF as a reference for the available commands and parameters:
# http://www.parallels.com/fileadmin/parallels/documents/support/pdfm/Parallels_Command_Line_Reference_Guide.pdf
local -a _1st_arguments
_1st_arguments=(
'set'
'backup'
'backup-delete'
'backup-list'
'capture'
'change-password'
'clone'
'create'
'delete'
'encrypt'
'decrypt'
'enter'
'exec'
'installtools'
'list'
'migrate'
'pause'
'suspend'
'resume'
'problem-report'
'register'
'unregister'
'restore'
'server'
'snapshot'
'snapshot-delete'
'snapshot-list'
'snapshot-switch'
'start'
'stop'
'reset'
)
_prlmachines() {
prlctl list --all --no-header -o name 2>/dev/null | while read machine; do
_wanted 'machine' expl 'machine' compadd $machine
done
}
_arguments '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "prctl commands" _1st_arguments -V1
return
fi
case "$words[1]" in
installtools)
_arguments \
:machine:_prlmachines
;;
list)
_arguments \
{-a,--all}'[List all, running, stopped, suspended, and paused virtual machines]' \
{-t,--template}'[List the available virtual machine templates]' \
'--no-header[Do not display column headers]' \
{-o,--output}'[Specify field(s) to output]:type:(uuid name status)' \
{-s,--sort}'[Sort output in ascending order by specified field]:type:(uuid name status)' \
{-i,--info}'[Display detailed information about a virtual machine]'
;;
start)
_arguments \
:machine:_prlmachines
;;
stop)
_arguments \
:machine:_prlmachines \
'--kill'
;;
reset)
_arguments \
:machine:_prlmachines
;;
pause)
_arguments \
:machine:_prlmachines
;;
suspend)
_arguments \
:machine:_prlmachines
;;
resume)
_arguments \
:machine:_prlmachines
;;
esac
# vim:ft=zsh:et:sts=2:sw=2