blob: 9edd8d3043dfbff67028c0c07c7501a21a195461 (
plain) (
blame)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
|
#compdef VBoxManage=vboxmanage VBoxHeadless=vboxheadless vboxmanage=vboxmanage vboxheadless=vboxheadless
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for VirtualBox (https://www.virtualbox.org/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
_virtualbox() {
local ret=1
_call_function ret _$service
return ret
}
(( $+functions[_vboxmanage] )) ||
_vboxmanage() {
local context state line expl
local -A opt_args
local ret=1
_arguments -C \
'1: :_vboxmanage_commands' \
'*:: :->subcmds' \
&& ret=0
case $state in
(subcmds)
case "$words[1]" in
(list)
_arguments \
'--long[Show detailed information about each information]' \
'--sorted[Sorts the list of information entries alphabetically]' \
'1: :_vboxmanage_list_args' \
&& ret=0
;;
(showvminfo)
_arguments \
'--details[Includes detailed information about the VM]' \
'--machinereadable[Specifies that the VM information be in a machine-readable format]' \
'--password-id[Specifies password id of the VM if it is encrypted]:id' \
'--password[Specifies password of the VM if it is encrypted]: :_files' \
'--log=[Specifies a numerical index that identifies the log file]:id' \
'1:machine:_vboxmachines' \
&& ret=0
;;
(registervm)
_arguments \
'--password[Use the --password to supply the encryption password of the VM]: :_files' \
'1: :_files' \
&& ret=0
;;
(unregistervm)
_arguments \
'--delete[Deletes the following files related to the VM automatically]' \
'1:machine:_vboxmachines' \
&& ret=0
;;
(createvm)
_arguments \
'--name[Specifies a new name for the new VM]:name' \
'--basefolder=[Specifies the name of the folder in which to save the machine configuration file for the new VM]: :_files -/' \
'--default[Applies a default hardware configuration for the specified guest OS]' \
'--group=[Assigns the VM to the specified groups]:group_id' \
'--ostype=[Specifies the guest OS to run in the VM]:_vboxostypes' \
'--register[Registers the VM with your Oracle VM VirtualBox installation]' \
'--uuid=[Specifies the Universally Unique Identifier(UUID) of the VM]:uuid' \
'--ciper=[Specifies the cipher to use for encryption]: :(AES-128 AES-256)' \
'--password-id=[Specifies a new password identifier]:password_id' \
'--password=[Use the --password to supply the encryption password of the VM]: :_files' \
&& ret=0
;;
(clonevm)
_arguments \
'--basefolder=[Specifies the name of the folder in which to save the configuration for the new VM]: :_files -/' \
'--groups=[Assigns the clone to the specified group or groups]:group' \
'--mode=[Specifies which of the following cloning modes to use]: :(machine machineandchildren all)' \
'--name=[Specifies a new name for the new VM]:name' \
'--options=[Specifies how to create the new clone]' \
'--register[Automatically registers the new clone in this Oracle VM VirtualBox installation]' \
'--snapshot=[Specifies the snapshot on which to base the new VM]:name' \
'--uuid=[Specifies the UUID for the new VM]:uuid' \
'1:machine:_vboxmachines' \
&& ret=0
;;
(movevm)
_arguments \
'--type=[Specifies the type of the move operation]: :(basic)' \
'--folder=[Specifies a full path name or relative path name of the new location on the host file system]: :_files -/' \
'1:machine:_vboxmachines' \
&& ret=0
;;
(encryptvm)
_vboxmanage_encryptvm && ret=0
;;
(cloud)
# TODO
;;
(cloudprofile)
_vboxmanage_cloudprofile && ret=0
;;
(import)
_arguments \
'--dry-run[Performs a dry run of the VBoxManage import command]' \
'--options=[Enables you to fine tune the import operation]: :(keepallmacs keepnatmacs importtovdi)' \
'--ostype=[Specifies the guest operating system (OS) information for the VM]: :_vboxostypes' \
'--vmname=[Specifies the name of the VM to be used by Oracle VM VirtualBox]:name' \
'--basefolder=[Specifies the folder where the files of the imported VM are stored]: :_files -/' \
'--memory=[Specifies the memory size in Megabytes for the imported VM]:memory' \
'--cpus=[Specifies the number of CPUs for the imported VM]:cpus' \
'--description=[Specifies the description text]:desc' \
'--vsys=[Specifies the index selecting a specific VM within the appliance]:index' \
'--unit=[Specifies the index selecting a specific unit of a VM within the appliance]:index' \
'--settingsfile=[Specifies the name of the VM config file]: :_files' \
'--group=[Specifies the primary group of the imported VM]:group' \
'--eula=[Enables you to show or accept the license conditions]: :(show accept)' \
'--ignore[Ignores the current unit of an imported VM]' \
'--scsitype=[Enables you to select the type of the SCSI controller]: :(BusLogic LsiLogic)' \
'--cloud[Specifies that the import should be from the cloud]' \
'--cloudprofile=[Specifies the cloud profile]:profile' \
'--cloudinstanceid=[Specifies the ID of an existing instance in the cloud]:id' \
'--cloudbucket=[Specifies the bucket name in which to store the object created]:bucket' \
'1:ovf file:_files -g \*.{ovf,ova}' \
&& ret=0
;;
(signova)
_arguments \
'--certificate=[File containing the certificate that the OVA should be signed with]: :_files' \
'--private-key=[The file containing the private key]: :_files' \
'--private-key-password-file=[File containing the private key password]: :_files' \
'--digest-type=[Select the cryptographic digest algorithm to use in the signing]: :(SHA-256 SHA-512 SHA-1)' \
'(--pkcs7 --no-pkcs7)--pkcs7[Enables the creation of an additional PKCS#7/CMS signature]' \
'(--pkcs7 --no-pkcs7)--no-pkcs7[Disables the creation of an additional PKCS#7/CMS signature]' \
'--intermediate-cert=[File containing an intermediary certificate]: :_files' \
'--force[Overwrite existing signature if present]' \
'--dry-run[Do not actually modify the OVA, just test-run the signing operation]' \
'(--verbose --quiet)--verbose[Verbose the command execution]' \
'(--verbose --quiet)--quiet[Quiet the command execution]' \
'1:ova' \
&& ret=0
;;
(startvm)
_arguments \
'*--putenv=[Assigns a value to an environment variable as a name-value pair]:value' \
'--type=[Specifies the frontend used to start the VM]: :(gui headless sdl separate)' \
'--password[Use the --password to supply the encryption password]: :_files' \
'--password-id=[Use the --password-id option to specify the id]:id' \
'1:machine:_vboxmachines' \
&& ret=0
;;
(unattended)
_vboxmanage_unattended
;;
(adoptstate)
_arguments \
'1:machine:_vboxmachines' \
'*:sav file:_files -g "*.sav"' \
&& ret=0
;;
(snapshot)
_vboxmanage_snapshot
;;
(closemedium)
_arguments \
'--delete[Deletes the image file]' \
'1:type:(disk dvd floppy)' \
'*:file:_files' \
&& ret=0
;;
(storageattach)
_arguments \
'--storagectl=[Specifies the name of the storage controller]:name' \
'--port=[Specifies the port number of the storage controller to modify]:port' \
"--device=[Specifies the port's device number to modify]:num" \
'--type=[Specifies the drive type to which the medium is associated]: :(dvddrive fdd hdd)' \
'--medium=[Specifies media]:media' \
'--mtype=[Specifies how this medium behaves]: :(normal writethrough immutable shareable readonly multiattach)' \
'--comment=[Specifies an optional description to store with the medium]:text' \
'--setuuid=[Modifies the UUID of a medium before attaching it to a VM]:uuid' \
'--setparentuuid=[Modifies the parent UUID of a medium before attaching it to a VM]:uuid' \
'--passthrough=[For a virtual DVD drive only]: :(on off)' \
'--tempeject=[For a virtual DVD drive only]: :(on off)' \
'--nonrotational=[Enables you to specify that the virtual hard disk is non-rotational]: :(on off)'\
'--discard=[Specifies whether to enable the auto-discard feature for a virtual hard disk]: :(on off)' \
'--bandwidthgroup=[Specifies the bandwidth group to use for the device]:name' \
'--forceunmount[For a virtual DVD or floppy drive only]' \
'--server=[Specifies the host name or IP address of the iSCSI target]:addr' \
'--target=[Specifies the target name string]:name' \
'--tport=[Specifies the TCP/IP port number of the iSCSI service on the target]:port' \
'--lun=[Specifies the logical unit number (LUN) of the target resource]:lun' \
'--encodedlun=[Specifies the hexadecimal-encoded of the target resource]:lun' \
'--username=[Specifies the user name to use for target authentication]:name' \
'--password=[Specifies the password used for target authentication]:password' \
'--passwordfile=[Specifies a file that contains the target authentication password as clear text]: :_files' \
'--iniitator=[Specifies the iSCSI initiator]:initiator' \
'--intnet[Specifies whether to connect to the iSCSI target that uses internal networking]' \
'1:machine:_vboxmachines' \
&& ret=0
;;
(storagectl)
_arguments \
'--name=[Specifies the name of the storage controller]:name' \
'--add=[Specifies the type of the system bus]: :(floppy ide pcie sas sata scsi usb)' \
'--controller=[Specifies the chipset type]: :(BusLogic I82078 ICH6 IntelAHCI LSILogic LSILogicSAS NVMe PIIX3 PIIX4 USB)' \
'--portcount=[Specifies the number of ports that the storage controller supports]:count' \
'--hostiocache=[Specifies whether to use the host I/O cache]: :(on off)' \
'--bootable=[Specifies whether this controller is bootable]: :(on off)' \
'--rename=[Specifies a new name for the storage controller]:name' \
'--remove[Removes a storage controller from the VM configuration]' \
'1:machine:_vboxmachines' \
&& ret=0
;;
(bandwidthctl)
_vboxmanage_bandwidthctl
;;
(showmediuminfo)
_arguments \
'1:medium:(disk dvd floppy)' \
'2:machine:_vboxmachines' \
&& ret=0
;;
(createmedium)
_arguments \
'--filename=[Specifies the absolute path name to a file on the host file system]: :_files'\
'--size=[Specifies the image capacity in one megabyte units]:size' \
'--sizebyte=[Specifies the image capacity in one byte units]:size' \
'--diffparent=[Specifies the UUID or absolute path name of parent file]:uuid_or_file' \
'--format=[Specifies the file format of the output file]: :(VDI VMDK VHD)' \
'--variant[Specifies the file format variant for the target medium]:variant' \
'*--property=[Specifies any required file format dependent parameters in key=value form]:value' \
'--property-file=[Specifies any propertyrequired file]: :_files' \
'1:medium:(disk dvd floppy)' \
&& ret=0
;;
(modifymedium)
_arguments \
'--autoreset=[Specifies whether to automatically reset]: :(on off)' \
'--compact[Compresses disk images by removing blocks that contain only zeroes]' \
'--description=[Specifies a text description of the medium]:desc' \
'--move=[Specifies a relative or absolute path to a medium on the host system]: :_files' \
'*--property=[Specifies any required file format dependent parameters in key=value form]:value' \
'--resize=[Specifes the new capacity of an existing image in MB]:size' \
'--resizebyte=[Specifes the new capacity of an existing image in bytes]:size' \
'--setlocation=[Specifies the new location of the medium]: :_files' \
'--type=[Specifies the new mode type of an existing image]: :(normal immutable writethrough multi-attach shareable readonly)' \
'1:medium:(disk dvd floppy)' \
'2:machine:_vboxmachines' \
&& ret=0
;;
(clonemedium)
_arguments \
'--existing[Performs the clone operation by overwriting an existing target medium]' \
'--format=[Specifies the file format of the target medium]: :(VDI VMDK VHD RAW)' \
'--variant=[Specifies the file format variant for the target medium]:variant' \
'1:medium:(disk dvd floppy)' \
'2:machine:_vboxmachines' \
'3:machine:_vboxmachines' \
&& ret=0
;;
(encryptmedium)
_arguments \
'--newpassword=[Specifies the new encryption password]:password' \
'--oldpassword=[Specifies the original encryption password]:password' \
'--cipher=[Specifies the cipher to use for encryption]: :(AES-XTS128-PLAIN64 AES-XTS256-PLAIN64)' \
'--newpasswordid=[Specifies a new password identifier]:password' \
'1:machine:_vboxmachines' \
&& ret=0
;;
(convertfromraw)
_arguments \
'--format=[Specifies the format of the disk image to create]: :(VDI VMDK VHD)' \
'--uuid=[Specifies the Universally Unique Identifier (UUID) of the output file]:uuid' \
'--variant=[Specifies any required file format variants for the output file]:variant' \
'*: :_files' \
&& ret=0
;;
(mediumio)
_vboxmanage_mediumio
;;
(setproperty)
_arguments \
'1: :(autostartdbpath defaultfrontend hwvirtexclusive launguage logginglevel loghistorycount machinefolder proxymode proxyurl vrdeauthlibrary vrdeextpack websrvauthlibrary)' \
'2:value:_vboxmanage_setproperty_value' \
&& ret=0
;;
(usbfilter)
# TODO
;;
(sharedfolder)
# TODO
;;
(guestproperty)
# TODO
;;
(guestcontrol)
# TODO
;;
(debugvm)
# TODO
;;
(metrics)
# TODO
;;
(natnetwork)
# TODO
;;
(hostonlyif)
# TODO
;;
(hostonlynet)
# TODO
;;
(dhcpserver)
# TODO
;;
(usbdevsource)
# TODO
;;
(extpack)
# TODO
;;
(updatecheck)
# TODO
;;
(modifynvram)
# TODO
;;
(discardstate|getextradata|setextradata)
_arguments \
'1:machine:_vboxmachines' \
&& ret=0
;;
(modifyvm|export)
local -a options=(${(@f)"$(vboxmanage $words[1] | perl -wln -e 'm{(--[a-zA-Z_-]+) [^]|]+} and print qq{$1:arg}')"})
_arguments \
$options \
':machine:_vboxmachines'
;;
(controlvm)
local -a subcommands=(${(@f)"$(vboxmanage $words[1] | perl -wln -e 'm{^\s+([a-z][a-z-]+)} and print $1')"})
_arguments \
'1:commands:'"($subcommands)" \
':machine:_vboxmachines'
;;
esac
;;
esac
return 0
}
(( $+functions[_vboxmanage_commands] )) ||
_vboxmanage_commands() {
local -a commands=(
"list:gives information about VirtualBox's current settings"
'showvminfo:shows information about a particular virtual machine'
'registervm:import a virtual machine definition in an XML file into VirtualBox'
'unregistervm:unregisters a virtual machine'
'createvm:creates a new XML virtual machine definition file'
'modifyvm:changes the properties of a registered virtual machine which is not running'
'clonevm:Create a clone of an existing virtual machine'
'movevm:Move a virtual machine to a new location on the host system'
'encryptvm:Change encryption and passwords of the VM'
'cloud:Manage the cloud entities'
'cloudprofile:Manage the cloud profiles'
'import:imports a virtual appliance in OVF format by copying the virtual disk images and creating virtual machines in VirtualBox'
'export:exports one or more virtual machines from VirtualBox into a virtual appliance in OVF format'
'signova:Digitally sign an OVA'
'startvm:starts a virtual machine that is currently in the "Powered off" or "Saved" states'
'controlvm:change the state of a virtual machine that is currently running'
'unattended:Unattended guest OS installation'
'discardstate:discards the saved state of a virtual machine which is not currently running'
'adoptstate:adopt a saved state file (.sav)'
'snapshot:control snapshots'
'closemedium:removes a hard disk, DVD or floppy image from a VirtualBox media registry'
'storageattach:attaches/modifies/removes a storage medium connected to a storage controller'
'storagectl:attaches/modifies/removes a storage controller'
'bandwidthctl:creates/deletes/modifies bandwidth groups'
'showmediuminfo:shows information about a virtual hard disk image'
'createmedium:creates a new virtual hard disk image'
'modifymedium:change the characteristics of a disk image after it has been created'
'clonemedium:duplicates a registered virtual hard disk image to a new image file with a new unique identifier'
'mediumproperty:Manage medium properties'
'encryptmedium:Manage a DEK-encrypted medium or image'
'checkmediumpwd:Check encryption password on a DEK-encrypted medium or a disk image'
'convertfromraw:converts a raw disk image to a VirtualBox Disk Image (VDI) file'
'mediumio:Medium content access'
'getextradata:retrieve string data to a virtual machine or to a VirtualBox configuration'
'setextradata:attach string data to a virtual machine or to a VirtualBox configuration'
'setproperty:change global settings which affect the entire VirtualBox installation'
'usbfilter:used for working with USB filters in virtual machines, or global filters'
'sharedfolder:share folders on the host computer with guest operating systems'
'guestproperty:get or set properties of a running virtual machine'
'guestcontrol:control certain things inside a guest from the host'
'debugvm:for experts who want to tinker with the exact details of virtual machine execution'
'metrics:monitor the usage of system resources'
'natnetwork:add,modify,remove or start NatNetworks'
'hostonlyif:change the IP configuration of a host-only network interface'
'hostonlynet:Host Only Network management'
'dhcpserver:control the DHCP server that is built into VirtualBox'
'usbdevsource:Add and remove USB device sources'
'extpack:add or remove VirtualBox extension pacnks'
'updatecheck:Checks for a new version of Virtualbox'
'modifynvram:List and modify the NVRAM content of a virtual machine'
)
_describe -t subcommands 'subcommand' commands
}
(( $+functions[_vboxmanage_encryptvm] )) ||
_vboxmanage_encryptvm() {
local ret=1
_arguments -C \
'1: :_vboxmachines' \
'2: :(setencryption checkpassword addpassword removepassword)' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
local subcommand=$words[2]
if (( $+functions[_vboxmanage_encryptvm_${subcommand}] )); then
compset -n 2
_vboxmanage_encryptvm_${subcommand} && ret=0
else
_arguments '*: :_files' && ret=0
fi
;;
esac
return $ret
}
(( $+functions[_vboxmanage_encryptvm_setencryption] )) ||
_vboxmanage_encryptvm_setencryption() {
_arguments \
'--cipher[specify the new cipher for encryption of the VM]: :(AES-128 AES-256)' \
'--new-password[specify the new password for encryption of the VM]: :_files' \
'--new-password-id[specify the new ID for the password for encryption of the VM]:id' \
'--force[make the system to reencrypt the VM instead of the simple changing the password]'
}
(( $+functions[_vboxmanage_encryptvm_addpassword] )) ||
_vboxmanage_encryptvm_addpassword() {
_arguments \
'--new-password[specify the new password for encryption of the VM]: :_files' \
'--new-password-id[specify the new ID for the password for encryption of the VM]:id'
}
(( $+functions[_vboxmanage_cloudprofile] )) ||
_vboxmanage_cloudprofile() {
local ret=1
_arguments -C \
'1: :(add update delete show)' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
case $words[1] in
(add|update)
_arguments \
'--provider=[Short cloud provider name]:provider' \
'--profile=[Cloud profile name]:profile' \
'--clouduser=[The name which fully identifies the user in the specified cloud provider]:user' \
'--fingerprint=[Fingerprint for the key pair being used]:finger_print' \
'--keyfile=[Full path and filename of the private key]: :_files' \
'--passphrase=[Passphrase used for the key, if it is encrypted]:pass' \
'--tenancy=[ID of your tenancy]:tenancy' \
'--compartment=[ID of your compartment]:compartment' \
'--region=[region name]:region' && ret=0
;;
(*)
_arguments \
'--provider=[Short cloud provider name]:provider' \
'--profile=[Cloud profile name]:profile'
;;
esac
;;
esac
return $ret
}
(( $+functions[_vboxmanage_unattended] )) ||
_vboxmanage_unattended() {
local ret=1
_arguments -C \
'1: :(detect install)' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
case $words[1] in
(detect)
_arguments \
'--iso=[The installation ISO to run the detection on]: :_files' \
'--machine-readable[Produce output that is simpler to parse from a script]' \
&& ret=0
;;
(install)
_arguments \
'--iso=[The installation ISO to run the detection on]: :_files' \
'--user=[The login name]:user' \
'--password=[The login password]:password' \
'--full-user-name=[The full user name]:full_name' \
'--key=[The guest OS product key]:key' \
'--install-additions[Install the VirtualBox guest additions]' \
'--additions-iso=[Path to the VirtualBox guest additions ISO]: :_files' \
'--install-txs[Whether to install the test execution service from the VirtualBox ValidationKit]' \
'--validation-kit-iso=[Path to the VirtualBox ValidationKit ISO]: :_files' \
'--locale=[The base locale specification for the guest]:locale' \
'--country=[The two letter country code]:country' \
'--time-zone=[The time zone to set up the guest OS with]:timezone' \
'--hostname=[The fully qualified domain name of the guest machine]:hostname' \
'--package-selection-adjustment=[Adjustments to the guest OS packages/components selection]:adjustment' \
'--dry-run[Do not create any files or make any changes to the VM configuration]' \
'--start-vm=[Start the VM using the front end given by session-type]:session_type' \
'--auxiliary-base-path=[The path prefix to the media related files generated for the installation]: :_files' \
'--image-index=[Windows installation image index]:index' \
'--script-template=[The unattended installation script template]: :_files' \
'--post-install-template=[The post installation script template]: :_files' \
'--post-install-command=[A single command to run after the installation is completed]:command' \
'--extra-install-kernel-parameter=[List of extra linux kernel parameters to use during the installation]:param' \
'--language=[Specifies the UI language for a Windows installation]:language' \
'1:machine:_vboxmachines' \
&& ret=0
;;
esac
;;
esac
return $ret
}
(( $+functions[_vboxmanage_snapshot] )) ||
_vboxmanage_snapshot() {
local ret=1
_arguments -C \
'1: :_vboxmachines' \
'2: :(take delete restore restorecurrent edit list showvminfo)' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
local subcommand=$words[2]
compset -n 2
case $words[1] in
(take)
_arguments \
'--description=[Specifies a description of the snapshot]:description' \
'--live[Specifies that the VM is not stopped while you create the snapshot]' \
'--uniquename=[unique name]' \
&& ret=0
;;
(edit)
_arguments \
'--current[Specifies that you update the current version of the snapshot]' \
'--description=[Specifies a new description for the snapshot]:description' \
'--name=[Specifies a new name for the snapshot]:name' \
&& ret=0
;;
(list)
_arguments \
'--details[Specifies that the output shows detailed information about the snapshot]' \
'--machinereadable[Specifies that the output is shown in a machine-readable format]' \
&& ret=0
;;
esac
;;
esac
return $ret
}
(( $+functions[_vboxmanage_bandwidthctl] )) ||
_vboxmanage_bandwidthctl() {
local ret=1
_arguments -C \
'1: :_vboxmachines' \
'2: :(add list remove set)' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
local subcommand=$words[2]
if (( $+functions[_vboxmanage_bandwidthctl_${subcommand}] )); then
compset -n 2
_vboxmanage_bandwidthctl_${subcommand} && ret=0
else
_arguments '*: :_files' && ret=0
fi
;;
esac
return $ret
}
(( $+functions[_vboxmanage_bandwidthctl_add] )) ||
_vboxmanage_bandwidthctl_add() {
_arguments \
'--limit=[Specifies the bandwidth limit for a bandwidth group]:limit' \
'--type=[Specifies the type of the bandwidth group]: :(disk network)'
}
(( $+functions[_vboxmanage_bandwidthctl_list] )) ||
_vboxmanage_bandwidthctl_list() {
_arguments \
'--machinereadable[Outputs the information about the bandwidth groups in name-value pairs]'
}
(( $+functions[_vboxmanage_bandwidthctl_set] )) ||
_vboxmanage_bandwidthctl_set() {
_arguments \
'--limit=[Specifies the bandwidth limit for a bandwidth group]:limit'
}
(( $+functions[_vboxmanage_mediumio] )) ||
_vboxmanage_mediumio() {
local ret=1
_arguments -C \
'1: :(formatfat cat stream)' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
local subcommand=$words[1]
if (( $+functions[_vboxmanage_mediumio_${subcommand}] )); then
_vboxmanage_mediumio_${subcommand} && ret=0
fi
;;
esac
return $ret
}
(( $+functions[_vboxmanage_mediumio_formatfat] )) ||
_vboxmanage_mediumio_formatfat() {
_arguments \
'--disk=[Either the UUID or filename of a harddisk image]: :_files' \
'--dvd=[Either the UUID or filename of a DVD image]: :_files' \
'--floppy=[Either the UUID or filename of a floppy image]: :_files' \
'--password-file=[The name of a file containing the medium encryption password]: :_files' \
'--quick[Quickformat the medium]'
}
(( $+functions[_vboxmanage_mediumio_cat] )) ||
_vboxmanage_mediumio_cat() {
_arguments \
'--disk=[Either the UUID or filename of a harddisk image]: :_files' \
'--dvd=[Either the UUID or filename of a DVD image]: :_files' \
'--floppy=[Either the UUID or filename of a floppy image]: :_files' \
'--password-file=[The name of a file containing the medium encryption password]: :_files' \
'--hex[Dump as hex bytes]' \
'--offset=[The byte offset in the medium to start]:offset' \
'--size=[The number of bytes to dump]:size' \
'--output=[The output filename]: :_files'
}
(( $+functions[_vboxmanage_mediumio_stream] )) ||
_vboxmanage_mediumio_stream() {
_arguments \
'--disk=[Either the UUID or filename of a harddisk image]: :_files' \
'--dvd=[Either the UUID or filename of a DVD image]: :_files' \
'--floppy=[Either the UUID or filename of a floppy image]: :_files' \
'--password-file=[The name of a file containing the medium encryption password]: :_files' \
'--format=[The format of the destination image]:format' \
'--variant=[The medium variant for the destination]:variant' \
'--output=[The output filename]: :_files'
}
(( $+functions[_vboxheadless] )) ||
_vboxheadless() {
local ret=1
_arguments \
'--startvm[Start given VM]:machine:_vboxmachines' \
"--vrde[Enable (default) or disable the VRDE server or don't change the setting]: :(on off config)" \
'--vrdeproperty[Set a VRDE property]:name' \
'(--settingspw --settingspwfile)--settingspw[Specify the settings password]:password' \
'(--settingspw --settingspwfile)--settingspwfile[Specify a containing the settings password]: :_files' \
'--stat-paused[Start the VM in paused state]' \
'--capture[Record the VM screen output to a file]' \
'--width[Frame width when recording]:width' \
'--height[Frame height when recording]:height' \
'--bitrate[Recording bit rate when recording]:bitrate' \
'--filename[File name when recording.]:filename:_files' \
&& ret=0
return $ret
}
(( $+functions[_vboxmanage_list_args] )) ||
_vboxmanage_list_args() {
local -a args=(vms runningvms ostypes hostdvds hostfloppies
intnets bridgedifs hostonlyifs natnets dhcpservers
hostinfo hostcpuids hddbackends hdds dvds floppies
usbhost usbfilters systemproperties extpacks
groups webcams screenshotformats cloudproviders
cloudprofiles cloudnets)
_values 'args' $args
}
(( $+functions[_vboxmachines] )) ||
_vboxmachines() {
local -a machines=(${(@f)"$(vboxmanage list vms | grep -v '<inaccessible>' | perl -wln -e 'm{^"([^"]+)"} and print $1')"})
_values 'machines' $machines
}
(( $+functions[_vboxostypes] )) ||
_vboxostypes() {
local -a os=(${(@f)"$(vboxmanage list ostypes | awk '/^ID:/{ print $2 }')"})
_values 'machines' $os
}
(( $+functions[_vboxmanage_setproperty_value] )) ||
_vboxmanage_setproperty_value() {
case $words[2] in
(autostartdbpath)
_arguments '*: :_files'
;;
(machinefolder)
_arguments '*: :_files -/'
;;
(proxymode)
local -a mode=(manual noproxy system)
_values 'proxymode' $mode
;;
esac
}
_virtualbox "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et
|