VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp@ 44960

Last change on this file since 44960 was 44948, checked in by vboxsync, 12 years ago

Main/SystemProperties+Machine: new config setting for default VM frontend.
Frontend/VirtualBox+VBoxManage: changes to use the default VM frontend when starting a VM, other minor cleanups
Main/xml/*.xsd: attempt to bring the XML schema close to reality
doc/manual: document the new possibilities, and fix a few long standing inaccuracies

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 43.7 KB
Line 
1/* $Id: VBoxManageHelp.cpp 44948 2013-03-07 10:36:42Z vboxsync $ */
2/** @file
3 * VBoxManage - help and other message output.
4 */
5
6/*
7 * Copyright (C) 2006-2013 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include <VBox/version.h>
23
24#include <iprt/buildconfig.h>
25#include <iprt/ctype.h>
26#include <iprt/err.h>
27#include <iprt/getopt.h>
28#include <iprt/stream.h>
29
30#include "VBoxManage.h"
31
32
33
34void showLogo(PRTSTREAM pStrm)
35{
36 static bool s_fShown; /* show only once */
37
38 if (!s_fShown)
39 {
40 RTStrmPrintf(pStrm, VBOX_PRODUCT " Command Line Management Interface Version "
41 VBOX_VERSION_STRING "\n"
42 "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
43 "All rights reserved.\n"
44 "\n");
45 s_fShown = true;
46 }
47}
48
49void printUsage(USAGECATEGORY u64Cmd, PRTSTREAM pStrm)
50{
51 bool fDumpOpts = false;
52#ifdef RT_OS_LINUX
53 bool fLinux = true;
54#else
55 bool fLinux = false;
56#endif
57#ifdef RT_OS_WINDOWS
58 bool fWin = true;
59#else
60 bool fWin = false;
61#endif
62#ifdef RT_OS_SOLARIS
63 bool fSolaris = true;
64#else
65 bool fSolaris = false;
66#endif
67#ifdef RT_OS_FREEBSD
68 bool fFreeBSD = true;
69#else
70 bool fFreeBSD = false;
71#endif
72#ifdef RT_OS_DARWIN
73 bool fDarwin = true;
74#else
75 bool fDarwin = false;
76#endif
77#ifdef VBOX_WITH_VBOXSDL
78 bool fVBoxSDL = true;
79#else
80 bool fVBoxSDL = false;
81#endif
82
83 if (u64Cmd == USAGE_DUMPOPTS)
84 {
85 fDumpOpts = true;
86 fLinux = true;
87 fWin = true;
88 fSolaris = true;
89 fFreeBSD = true;
90 fDarwin = true;
91 fVBoxSDL = true;
92 u64Cmd = USAGE_ALL;
93 }
94
95 RTStrmPrintf(pStrm,
96 "Usage:\n"
97 "\n");
98
99 if (u64Cmd == USAGE_ALL)
100 RTStrmPrintf(pStrm,
101 " VBoxManage [<general option>] <command>\n"
102 " \n \n"
103 "General Options:\n \n"
104 " [-v|--version] print version number and exit\n"
105 " [-q|--nologo] suppress the logo\n"
106 " [--settingspw <pw>] provide the settings password\n"
107 " [--settingspwfile <file>] provide a file containing the settings password\n"
108 " \n \n"
109 "Commands:\n \n");
110
111 const char *pcszSep1 = " ";
112 const char *pcszSep2 = " ";
113 if (u64Cmd != USAGE_ALL)
114 {
115 pcszSep1 = "VBoxManage";
116 pcszSep2 = "";
117 }
118
119#define SEP pcszSep1, pcszSep2
120
121 if (u64Cmd & USAGE_LIST)
122 RTStrmPrintf(pStrm,
123 "%s list [--long|-l]%s vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
124#if defined(VBOX_WITH_NETFLT)
125 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
126#else
127 " bridgedifs|dhcpservers|hostinfo|\n"
128#endif
129 " hostcpuids|hddbackends|hdds|dvds|floppies|\n"
130 " usbhost|usbfilters|systemproperties|extpacks|\n"
131 " groups\n"
132 "\n", SEP);
133
134 if (u64Cmd & USAGE_SHOWVMINFO)
135 RTStrmPrintf(pStrm,
136 "%s showvminfo %s <uuid>|<name> [--details]\n"
137 " [--machinereadable]\n"
138 "%s showvminfo %s <uuid>|<name> --log <idx>\n"
139 "\n", SEP, SEP);
140
141 if (u64Cmd & USAGE_REGISTERVM)
142 RTStrmPrintf(pStrm,
143 "%s registervm %s <filename>\n"
144 "\n", SEP);
145
146 if (u64Cmd & USAGE_UNREGISTERVM)
147 RTStrmPrintf(pStrm,
148 "%s unregistervm %s <uuid>|<name> [--delete]\n"
149 "\n", SEP);
150
151 if (u64Cmd & USAGE_CREATEVM)
152 RTStrmPrintf(pStrm,
153 "%s createvm %s --name <name>\n"
154 " [--groups <group>, ...]\n"
155 " [--ostype <ostype>]\n"
156 " [--register]\n"
157 " [--basefolder <path>]\n"
158 " [--uuid <uuid>]\n"
159 "\n", SEP);
160
161 if (u64Cmd & USAGE_MODIFYVM)
162 {
163 RTStrmPrintf(pStrm,
164 "%s modifyvm %s <uuid|name>\n"
165 " [--name <name>]\n"
166 " [--groups <group>, ...]\n"
167 " [--ostype <ostype>]\n"
168 " [--memory <memorysize in MB>]\n"
169 " [--pagefusion on|off]\n"
170 " [--vram <vramsize in MB>]\n"
171 " [--acpi on|off]\n"
172#ifdef VBOX_WITH_PCI_PASSTHROUGH
173 " [--pciattach 03:04.0]\n"
174 " [--pciattach 03:04.0@02:01.0]\n"
175 " [--pcidetach 03:04.0]\n"
176#endif
177 " [--ioapic on|off]\n"
178 " [--pae on|off]\n"
179 " [--hpet on|off]\n"
180 " [--hwvirtex on|off]\n"
181 " [--hwvirtexexcl on|off]\n"
182 " [--nestedpaging on|off]\n"
183 " [--largepages on|off]\n"
184 " [--vtxvpid on|off]\n"
185 " [--synthcpu on|off]\n"
186 " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
187 " [--cpuidremove <leaf>]\n"
188 " [--cpuidremoveall]\n"
189 " [--hardwareuuid <uuid>]\n"
190 " [--cpus <number>]\n"
191 " [--cpuhotplug on|off]\n"
192 " [--plugcpu <id>]\n"
193 " [--unplugcpu <id>]\n"
194 " [--cpuexecutioncap <1-100>]\n"
195 " [--rtcuseutc on|off]\n"
196 " [--monitorcount <number>]\n"
197 " [--accelerate3d on|off]\n"
198#ifdef VBOX_WITH_VIDEOHWACCEL
199 " [--accelerate2dvideo on|off]\n"
200#endif
201 " [--firmware bios|efi|efi32|efi64]\n"
202 " [--chipset ich9|piix3]\n"
203 " [--bioslogofadein on|off]\n"
204 " [--bioslogofadeout on|off]\n"
205 " [--bioslogodisplaytime <msec>]\n"
206 " [--bioslogoimagepath <imagepath>]\n"
207 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
208 " [--biossystemtimeoffset <msec>]\n"
209 " [--biospxedebug on|off]\n"
210 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
211 " [--nic<1-N> none|null|nat|bridged|intnet"
212#if defined(VBOX_WITH_NETFLT)
213 "|hostonly"
214#endif
215 "|\n"
216 " generic"
217 "]\n"
218 " [--nictype<1-N> Am79C970A|Am79C973"
219#ifdef VBOX_WITH_E1000
220 "|\n 82540EM|82543GC|82545EM"
221#endif
222#ifdef VBOX_WITH_VIRTIO
223 "|\n virtio"
224#endif /* VBOX_WITH_VIRTIO */
225 "]\n"
226 " [--cableconnected<1-N> on|off]\n"
227 " [--nictrace<1-N> on|off]\n"
228 " [--nictracefile<1-N> <filename>]\n"
229 " [--nicproperty<1-N> name=[value]]\n"
230 " [--nicspeed<1-N> <kbps>]\n"
231 " [--nicbootprio<1-N> <priority>]\n"
232 " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
233 " [--nicbandwidthgroup<1-N> none|<name>]\n"
234 " [--bridgeadapter<1-N> none|<devicename>]\n"
235#if defined(VBOX_WITH_NETFLT)
236 " [--hostonlyadapter<1-N> none|<devicename>]\n"
237#endif
238 " [--intnet<1-N> <network name>]\n"
239 " [--natnet<1-N> <network>|default]\n"
240 " [--nicgenericdrv<1-N> <driver>\n"
241 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
242 " [<sockrcv>],[<tcpsnd>],\n"
243 " [<tcprcv>]]\n"
244 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
245 " <hostport>,[<guestip>],<guestport>]\n"
246 " [--natpf<1-N> delete <rulename>]\n"
247 " [--nattftpprefix<1-N> <prefix>]\n"
248 " [--nattftpfile<1-N> <file>]\n"
249 " [--nattftpserver<1-N> <ip>]\n"
250 " [--natbindip<1-N> <ip>\n"
251 " [--natdnspassdomain<1-N> on|off]\n"
252 " [--natdnsproxy<1-N> on|off]\n"
253 " [--natdnshostresolver<1-N> on|off]\n"
254 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
255 " [sameports]]\n"
256 " [--macaddress<1-N> auto|<mac>]\n"
257 " [--mouse ps2|usb|usbtablet\n"
258 " [--keyboard ps2|usb\n"
259 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
260 " [--uartmode<1-N> disconnected|\n"
261 " server <pipe>|\n"
262 " client <pipe>|\n"
263 " file <file>|\n"
264 " <devicename>]\n"
265#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
266 " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
267 " [--lptmode<1-N> <devicename>]\n"
268#endif
269 " [--guestmemoryballoon <balloonsize in MB>]\n"
270 " [--gueststatisticsinterval <seconds>]\n"
271 " [--audio none|null", SEP);
272 if (fWin)
273 {
274#ifdef VBOX_WITH_WINMM
275 RTStrmPrintf(pStrm, "|winmm|dsound");
276#else
277 RTStrmPrintf(pStrm, "|dsound");
278#endif
279 }
280 if (fSolaris)
281 {
282 RTStrmPrintf(pStrm, "|solaudio"
283#ifdef VBOX_WITH_SOLARIS_OSS
284 "|oss"
285#endif
286 );
287 }
288 if (fLinux)
289 {
290 RTStrmPrintf(pStrm, "|oss"
291#ifdef VBOX_WITH_ALSA
292 "|alsa"
293#endif
294#ifdef VBOX_WITH_PULSE
295 "|pulse"
296#endif
297 );
298 }
299 if (fFreeBSD)
300 {
301 /* Get the line break sorted when dumping all option variants. */
302 if (fDumpOpts)
303 {
304 RTStrmPrintf(pStrm, "|\n"
305 " oss");
306 }
307 else
308 RTStrmPrintf(pStrm, "|oss");
309#ifdef VBOX_WITH_PULSE
310 RTStrmPrintf(pStrm, "|pulse");
311#endif
312 }
313 if (fDarwin)
314 {
315 RTStrmPrintf(pStrm, "|coreaudio");
316 }
317 RTStrmPrintf(pStrm, "]\n");
318 RTStrmPrintf(pStrm,
319 " [--audiocontroller ac97|hda|sb16]\n"
320 " [--clipboard disabled|hosttoguest|guesttohost|\n"
321 " bidirectional]\n"
322 " [--draganddrop disabled|hosttoguest\n");
323 RTStrmPrintf(pStrm,
324 " [--vrde on|off]\n"
325 " [--vrdeextpack default|<name>\n"
326 " [--vrdeproperty <name=[value]>]\n"
327 " [--vrdeport <hostport>]\n"
328 " [--vrdeaddress <hostip>]\n"
329 " [--vrdeauthtype null|external|guest]\n"
330 " [--vrdeauthlibrary default|<name>\n"
331 " [--vrdemulticon on|off]\n"
332 " [--vrdereusecon on|off]\n"
333 " [--vrdevideochannel on|off]\n"
334 " [--vrdevideochannelquality <percent>]\n");
335 RTStrmPrintf(pStrm,
336 " [--usb on|off]\n"
337 " [--usbehci on|off]\n"
338 " [--snapshotfolder default|<path>]\n"
339 " [--teleporter on|off]\n"
340 " [--teleporterport <port>]\n"
341 " [--teleporteraddress <address|empty>\n"
342 " [--teleporterpassword <password>]\n"
343 " [--teleporterpasswordfile <file>|stdin]\n"
344 " [--tracing-enabled on|off]\n"
345 " [--tracing-config <config-string>]\n"
346 " [--tracing-allow-vm-access on|off]\n"
347#if 0
348 " [--iocache on|off]\n"
349 " [--iocachesize <I/O cache size in MB>]\n"
350#endif
351#if 0
352 " [--faulttolerance master|standby]\n"
353 " [--faulttoleranceaddress <name>]\n"
354 " [--faulttoleranceport <port>]\n"
355 " [--faulttolerancesyncinterval <msec>]\n"
356 " [--faulttolerancepassword <password>]\n"
357#endif
358#ifdef VBOX_WITH_USB_VIDEO
359 " [--usbwebcam on|off]\n"
360#endif
361#ifdef VBOX_WITH_USB_CARDREADER
362 " [--usbcardreader on|off]\n"
363#endif
364 " [--autostart-enabled on|off]\n"
365 " [--autostart-delay <seconds>]\n"
366#if 0 /* Disabled until the feature is implemented. */
367 " [--autostop-type disabled|savestate|poweroff|\n"
368 " acpishutdown]\n"
369#endif
370 " [--defaultfrontend default|<name]\n"
371 "\n");
372 }
373
374 if (u64Cmd & USAGE_CLONEVM)
375 RTStrmPrintf(pStrm,
376 "%s clonevm %s <uuid>|<name>\n"
377 " [--snapshot <uuid>|<name>]\n"
378 " [--mode machine|machineandchildren|all]\n"
379 " [--options link|keepallmacs|keepnatmacs|\n"
380 " keepdisknames]\n"
381 " [--name <name>]\n"
382 " [--groups <group>, ...]\n"
383 " [--basefolder <basefolder>]\n"
384 " [--uuid <uuid>]\n"
385 " [--register]\n"
386 "\n", SEP);
387
388 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
389 RTStrmPrintf(pStrm,
390 "%s import %s <ovf/ova>\n"
391 " [--dry-run|-n]\n"
392 " [--options keepallmacs|keepnatmacs]\n"
393 " [more options]\n"
394 " (run with -n to have options displayed\n"
395 " for a particular OVF)\n\n", SEP);
396
397 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
398 RTStrmPrintf(pStrm,
399 "%s export %s <machines> --output|-o <name>.<ovf/ova>\n"
400 " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
401 " [--manifest]\n"
402 " [--vsys <number of virtual system>]\n"
403 " [--product <product name>]\n"
404 " [--producturl <product url>]\n"
405 " [--vendor <vendor name>]\n"
406 " [--vendorurl <vendor url>]\n"
407 " [--version <version info>]\n"
408 " [--eula <license text>]\n"
409 " [--eulafile <filename>]\n"
410 "\n", SEP);
411
412 if (u64Cmd & USAGE_STARTVM)
413 {
414 RTStrmPrintf(pStrm,
415 "%s startvm %s <uuid>|<name>...\n"
416 " [--type gui", SEP);
417 if (fVBoxSDL)
418 RTStrmPrintf(pStrm, "|sdl");
419 RTStrmPrintf(pStrm, "|headless]\n");
420 RTStrmPrintf(pStrm,
421 "\n");
422 }
423
424 if (u64Cmd & USAGE_CONTROLVM)
425 {
426 RTStrmPrintf(pStrm,
427 "%s controlvm %s <uuid>|<name>\n"
428 " pause|resume|reset|poweroff|savestate|\n"
429 " acpipowerbutton|acpisleepbutton|\n"
430 " keyboardputscancode <hex> [<hex> ...]|\n"
431 " setlinkstate<1-N> on|off |\n"
432#if defined(VBOX_WITH_NETFLT)
433 " nic<1-N> null|nat|bridged|intnet|hostonly|generic"
434 "\n"
435 " [<devicename>] |\n"
436#else /* !VBOX_WITH_NETFLT */
437 " nic<1-N> null|nat|bridged|intnet|generic\n"
438 " [<devicename>] |\n"
439#endif /* !VBOX_WITH_NETFLT */
440 " nictrace<1-N> on|off\n"
441 " nictracefile<1-N> <filename>\n"
442 " nicproperty<1-N> name=[value]\n"
443 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
444 " <hostport>,[<guestip>],<guestport>\n"
445 " natpf<1-N> delete <rulename>\n"
446 " guestmemoryballoon <balloonsize in MB>]\n"
447 " gueststatisticsinterval <seconds>]\n"
448 " usbattach <uuid>|<address> |\n"
449 " usbdetach <uuid>|<address> |\n"
450 " clipboard disabled|hosttoguest|guesttohost|\n"
451 " bidirectional]\n"
452 " draganddrop disabled|hosttoguest]\n"
453 " vrde on|off |\n"
454 " vrdeport <port> |\n"
455 " vrdeproperty <name=[value]> |\n"
456 " vrdevideochannelquality <percent>\n"
457 " setvideomodehint <xres> <yres> <bpp>\n"
458 " [[<display>] [<enabled:yes|no>\n"
459 " [<xorigin> <yorigin>]]] |\n"
460 " screenshotpng <file> [display] |\n"
461 " setcredentials <username>\n"
462 " --passwordfile <file> | <password>\n"
463 " <domain>\n"
464 " [--allowlocallogon <yes|no>] |\n"
465 " teleport --host <name> --port <port>\n"
466 " [--maxdowntime <msec>]\n"
467 " [--passwordfile <file> |\n"
468 " --password <password>]\n"
469 " plugcpu <id>\n"
470 " unplugcpu <id>\n"
471 " cpuexecutioncap <1-100>\n"
472 "\n", SEP);
473 }
474
475 if (u64Cmd & USAGE_DISCARDSTATE)
476 RTStrmPrintf(pStrm,
477 "%s discardstate %s <uuid>|<name>\n"
478 "\n", SEP);
479
480 if (u64Cmd & USAGE_ADOPTSTATE)
481 RTStrmPrintf(pStrm,
482 "%s adoptstate %s <uuid>|<name> <state_file>\n"
483 "\n", SEP);
484
485 if (u64Cmd & USAGE_SNAPSHOT)
486 RTStrmPrintf(pStrm,
487 "%s snapshot %s <uuid>|<name>\n"
488 " take <name> [--description <desc>] [--pause] |\n"
489 " delete <uuid>|<name> |\n"
490 " restore <uuid>|<name> |\n"
491 " restorecurrent |\n"
492 " edit <uuid>|<name>|--current\n"
493 " [--name <name>]\n"
494 " [--description <desc>] |\n"
495 " list [--details|--machinereadable]\n"
496 " showvminfo <uuid>|<name>\n"
497 "\n", SEP);
498
499 if (u64Cmd & USAGE_CLOSEMEDIUM)
500 RTStrmPrintf(pStrm,
501 "%s closemedium %s disk|dvd|floppy <uuid>|<filename>\n"
502 " [--delete]\n"
503 "\n", SEP);
504
505 if (u64Cmd & USAGE_STORAGEATTACH)
506 RTStrmPrintf(pStrm,
507 "%s storageattach %s <uuid|vmname>\n"
508 " --storagectl <name>\n"
509 " [--port <number>]\n"
510 " [--device <number>]\n"
511 " [--type dvddrive|hdd|fdd]\n"
512 " [--medium none|emptydrive|additions|\n"
513 " <uuid>|<filename>|host:<drive>|iscsi]\n"
514 " [--mtype normal|writethrough|immutable|shareable|\n"
515 " readonly|multiattach]\n"
516 " [--comment <text>]\n"
517 " [--setuuid <uuid>]\n"
518 " [--setparentuuid <uuid>]\n"
519 " [--passthrough on|off]\n"
520 " [--tempeject on|off]\n"
521 " [--nonrotational on|off]\n"
522 " [--discard on|off]\n"
523 " [--bandwidthgroup <name>]\n"
524 " [--forceunmount]\n"
525 " [--server <name>|<ip>]\n"
526 " [--target <target>]\n"
527 " [--tport <port>]\n"
528 " [--lun <lun>]\n"
529 " [--encodedlun <lun>]\n"
530 " [--username <username>]\n"
531 " [--password <password>]\n"
532 " [--initiator <initiator>]\n"
533 " [--intnet]\n"
534 "\n", SEP);
535
536 if (u64Cmd & USAGE_STORAGECONTROLLER)
537 RTStrmPrintf(pStrm,
538 "%s storagectl %s <uuid|vmname>\n"
539 " --name <name>\n"
540 " [--add ide|sata|scsi|floppy|sas]\n"
541 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
542 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
543 " [--sataportcount <1-30>]\n"
544 " [--hostiocache on|off]\n"
545 " [--bootable on|off]\n"
546 " [--remove]\n"
547 "\n", SEP);
548
549 if (u64Cmd & USAGE_BANDWIDTHCONTROL)
550 RTStrmPrintf(pStrm,
551 "%s bandwidthctl %s <uuid|vmname>\n"
552 " add <name> --type disk|network\n"
553 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
554 " set <name>\n"
555 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
556 " remove <name> |\n"
557 " list [--machinereadable]\n"
558 " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
559 " K=kilobyte, M=megabyte, G=gigabyte)\n"
560 "\n", SEP);
561
562 if (u64Cmd & USAGE_SHOWHDINFO)
563 RTStrmPrintf(pStrm,
564 "%s showhdinfo %s <uuid>|<filename>\n"
565 "\n", SEP);
566
567 if (u64Cmd & USAGE_CREATEHD)
568 RTStrmPrintf(pStrm,
569 "%s createhd %s --filename <filename>\n"
570 " [--size <megabytes>|--sizebyte <bytes>]\n"
571 " [--diffparent <uuid>|<filename>\n"
572 " [--format VDI|VMDK|VHD] (default: VDI)\n"
573 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
574 "\n", SEP);
575
576 if (u64Cmd & USAGE_MODIFYHD)
577 RTStrmPrintf(pStrm,
578 "%s modifyhd %s <uuid>|<filename>\n"
579 " [--type normal|writethrough|immutable|shareable|\n"
580 " readonly|multiattach]\n"
581 " [--autoreset on|off]\n"
582 " [--compact]\n"
583 " [--resize <megabytes>|--resizebyte <bytes>]\n"
584 "\n", SEP);
585
586 if (u64Cmd & USAGE_CLONEHD)
587 RTStrmPrintf(pStrm,
588 "%s clonehd %s <uuid>|<filename> <uuid>|<outputfile>\n"
589 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
590 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
591 " [--existing]\n"
592 "\n", SEP);
593
594 if (u64Cmd & USAGE_CONVERTFROMRAW)
595 RTStrmPrintf(pStrm,
596 "%s convertfromraw %s <filename> <outputfile>\n"
597 " [--format VDI|VMDK|VHD]\n"
598 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
599 " [--uuid <uuid>]\n"
600 "%s convertfromraw %s stdin <outputfile> <bytes>\n"
601 " [--format VDI|VMDK|VHD]\n"
602 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
603 " [--uuid <uuid>]\n"
604 "\n", SEP, SEP);
605
606 if (u64Cmd & USAGE_GETEXTRADATA)
607 RTStrmPrintf(pStrm,
608 "%s getextradata %s global|<uuid>|<name>\n"
609 " <key>|enumerate\n"
610 "\n", SEP);
611
612 if (u64Cmd & USAGE_SETEXTRADATA)
613 RTStrmPrintf(pStrm,
614 "%s setextradata %s global|<uuid>|<name>\n"
615 " <key>\n"
616 " [<value>] (no value deletes key)\n"
617 "\n", SEP);
618
619 if (u64Cmd & USAGE_SETPROPERTY)
620 RTStrmPrintf(pStrm,
621 "%s setproperty %s machinefolder default|<folder> |\n"
622 " vrdeauthlibrary default|<library> |\n"
623 " websrvauthlibrary default|null|<library> |\n"
624 " vrdeextpack null|<library> |\n"
625 " autostartdbpath null|<folder> |\n"
626 " loghistorycount <value>\n"
627 " defaultfrontend default|<name>\n"
628 "\n", SEP);
629
630 if (u64Cmd & USAGE_USBFILTER_ADD)
631 RTStrmPrintf(pStrm,
632 "%s usbfilter %s add <index,0-N>\n"
633 " --target <uuid>|<name>|global\n"
634 " --name <string>\n"
635 " --action ignore|hold (global filters only)\n"
636 " [--active yes|no] (yes)\n"
637 " [--vendorid <XXXX>] (null)\n"
638 " [--productid <XXXX>] (null)\n"
639 " [--revision <IIFF>] (null)\n"
640 " [--manufacturer <string>] (null)\n"
641 " [--product <string>] (null)\n"
642 " [--remote yes|no] (null, VM filters only)\n"
643 " [--serialnumber <string>] (null)\n"
644 " [--maskedinterfaces <XXXXXXXX>]\n"
645 "\n", SEP);
646
647 if (u64Cmd & USAGE_USBFILTER_MODIFY)
648 RTStrmPrintf(pStrm,
649 "%s usbfilter %s modify <index,0-N>\n"
650 " --target <uuid>|<name>|global\n"
651 " [--name <string>]\n"
652 " [--action ignore|hold] (global filters only)\n"
653 " [--active yes|no]\n"
654 " [--vendorid <XXXX>|\"\"]\n"
655 " [--productid <XXXX>|\"\"]\n"
656 " [--revision <IIFF>|\"\"]\n"
657 " [--manufacturer <string>|\"\"]\n"
658 " [--product <string>|\"\"]\n"
659 " [--remote yes|no] (null, VM filters only)\n"
660 " [--serialnumber <string>|\"\"]\n"
661 " [--maskedinterfaces <XXXXXXXX>]\n"
662 "\n", SEP);
663
664 if (u64Cmd & USAGE_USBFILTER_REMOVE)
665 RTStrmPrintf(pStrm,
666 "%s usbfilter %s remove <index,0-N>\n"
667 " --target <uuid>|<name>|global\n"
668 "\n", SEP);
669
670 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
671 RTStrmPrintf(pStrm,
672 "%s sharedfolder %s add <vmname>|<uuid>\n"
673 " --name <name> --hostpath <hostpath>\n"
674 " [--transient] [--readonly] [--automount]\n"
675 "\n", SEP);
676
677 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
678 RTStrmPrintf(pStrm,
679 "%s sharedfolder %s remove <vmname>|<uuid>\n"
680 " --name <name> [--transient]\n"
681 "\n", SEP);
682
683#ifdef VBOX_WITH_GUEST_PROPS
684 if (u64Cmd & USAGE_GUESTPROPERTY)
685 usageGuestProperty(pStrm, SEP);
686#endif /* VBOX_WITH_GUEST_PROPS defined */
687
688#ifdef VBOX_WITH_GUEST_CONTROL
689 if (u64Cmd & USAGE_GUESTCONTROL)
690 usageGuestControl(pStrm, SEP);
691#endif /* VBOX_WITH_GUEST_CONTROL defined */
692
693 if (u64Cmd & USAGE_DEBUGVM)
694 {
695 RTStrmPrintf(pStrm,
696 "%s debugvm %s <uuid>|<name>\n"
697 " dumpguestcore --filename <name> |\n"
698 " info <item> [args] |\n"
699 " injectnmi |\n"
700 " log [--release|--debug] <settings> ...|\n"
701 " logdest [--release|--debug] <settings> ...|\n"
702 " logflags [--release|--debug] <settings> ...|\n"
703 " osdetect |\n"
704 " osinfo |\n"
705 " getregisters [--cpu <id>] <reg>|all ... |\n"
706 " setregisters [--cpu <id>] <reg>=<value> ... |\n"
707 " show [--human-readable|--sh-export|--sh-eval|\n"
708 " --cmd-set] \n"
709 " <logdbg-settings|logrel-settings>\n"
710 " [[opt] what ...] |\n"
711 " statistics [--reset] [--pattern <pattern>]\n"
712 " [--descriptions]\n"
713 "\n", SEP);
714 }
715 if (u64Cmd & USAGE_METRICS)
716 RTStrmPrintf(pStrm,
717 "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
718 " (comma-separated)\n\n"
719 "%s metrics %s setup\n"
720 " [--period <seconds>] (default: 1)\n"
721 " [--samples <count>] (default: 1)\n"
722 " [--list]\n"
723 " [*|host|<vmname> [<metric_list>]]\n\n"
724 "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
725 "%s metrics %s enable\n"
726 " [--list]\n"
727 " [*|host|<vmname> [<metric_list>]]\n\n"
728 "%s metrics %s disable\n"
729 " [--list]\n"
730 " [*|host|<vmname> [<metric_list>]]\n\n"
731 "%s metrics %s collect\n"
732 " [--period <seconds>] (default: 1)\n"
733 " [--samples <count>] (default: 1)\n"
734 " [--list]\n"
735 " [--detach]\n"
736 " [*|host|<vmname> [<metric_list>]]\n"
737 "\n", SEP, SEP, SEP, SEP, SEP, SEP);
738
739#if defined(VBOX_WITH_NETFLT)
740 if (u64Cmd & USAGE_HOSTONLYIFS)
741 {
742 RTStrmPrintf(pStrm,
743 "%s hostonlyif %s ipconfig <name>\n"
744 " [--dhcp |\n"
745 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
746 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
747# if !defined(RT_OS_SOLARIS)
748 " create |\n"
749 " remove <name>\n"
750# endif
751 "\n", SEP);
752 }
753#endif
754
755 if (u64Cmd & USAGE_DHCPSERVER)
756 {
757 RTStrmPrintf(pStrm,
758 "%s dhcpserver %s add|modify --netname <network_name> |\n"
759#if defined(VBOX_WITH_NETFLT)
760 " --ifname <hostonly_if_name>\n"
761#endif
762 " [--ip <ip_address>\n"
763 " --netmask <network_mask>\n"
764 " --lowerip <lower_ip>\n"
765 " --upperip <upper_ip>]\n"
766 " [--enable | --disable]\n\n"
767 "%s dhcpserver %s remove --netname <network_name> |\n"
768#if defined(VBOX_WITH_NETFLT)
769 " --ifname <hostonly_if_name>\n"
770#endif
771 "\n", SEP, SEP);
772 }
773 if (u64Cmd & USAGE_EXTPACK)
774 {
775 RTStrmPrintf(pStrm,
776 "%s extpack %s install [--replace] <tarball> |\n"
777 " uninstall [--force] <name> |\n"
778 " cleanup\n"
779 "\n", SEP);
780 }
781}
782
783/**
784 * Print a usage synopsis and the syntax error message.
785 * @returns RTEXITCODE_SYNTAX.
786 */
787RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
788{
789 va_list args;
790 showLogo(g_pStdErr); // show logo even if suppressed
791#ifndef VBOX_ONLY_DOCS
792 if (g_fInternalMode)
793 printUsageInternal(u64Cmd, g_pStdErr);
794 else
795 printUsage(u64Cmd, g_pStdErr);
796#endif /* !VBOX_ONLY_DOCS */
797 va_start(args, pszFormat);
798 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
799 va_end(args);
800 return RTEXITCODE_SYNTAX;
801}
802
803/**
804 * errorSyntax for RTGetOpt users.
805 *
806 * @returns RTEXITCODE_SYNTAX.
807 *
808 * @param fUsageCategory The usage category of the command.
809 * @param rc The RTGetOpt return code.
810 * @param pValueUnion The value union.
811 */
812RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
813{
814 /*
815 * Check if it is an unhandled standard option.
816 */
817 if (rc == 'V')
818 {
819 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
820 return RTEXITCODE_SUCCESS;
821 }
822
823 if (rc == 'h')
824 {
825 showLogo(g_pStdErr);
826#ifndef VBOX_ONLY_DOCS
827 if (g_fInternalMode)
828 printUsageInternal(fUsageCategory, g_pStdOut);
829 else
830 printUsage(fUsageCategory, g_pStdOut);
831#endif
832 return RTEXITCODE_SUCCESS;
833 }
834
835 /*
836 * General failure.
837 */
838 showLogo(g_pStdErr); // show logo even if suppressed
839#ifndef VBOX_ONLY_DOCS
840 if (g_fInternalMode)
841 printUsageInternal(fUsageCategory, g_pStdErr);
842 else
843 printUsage(fUsageCategory, g_pStdErr);
844#endif /* !VBOX_ONLY_DOCS */
845
846 if (rc == VINF_GETOPT_NOT_OPTION)
847 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
848 if (rc > 0)
849 {
850 if (RT_C_IS_PRINT(rc))
851 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
852 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
853 }
854 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
855 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
856 if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
857 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
858 if (pValueUnion->pDef)
859 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
860 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
861}
862
863/**
864 * Print an error message without the syntax stuff.
865 *
866 * @returns RTEXITCODE_SYNTAX.
867 */
868RTEXITCODE errorArgument(const char *pszFormat, ...)
869{
870 va_list args;
871 va_start(args, pszFormat);
872 RTMsgErrorV(pszFormat, args);
873 va_end(args);
874 return RTEXITCODE_SYNTAX;
875}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette