VirtualBox

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

Last change on this file since 45804 was 45731, checked in by vboxsync, 12 years ago

several fixes for video recording

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.0 KB
Line 
1/* $Id: VBoxManageHelp.cpp 45731 2013-04-25 14:33:35Z 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 " [--graphicscontroller none|vboxvga]\n"
197 " [--monitorcount <number>]\n"
198 " [--accelerate3d on|off]\n"
199#ifdef VBOX_WITH_VIDEOHWACCEL
200 " [--accelerate2dvideo on|off]\n"
201#endif
202 " [--firmware bios|efi|efi32|efi64]\n"
203 " [--chipset ich9|piix3]\n"
204 " [--bioslogofadein on|off]\n"
205 " [--bioslogofadeout on|off]\n"
206 " [--bioslogodisplaytime <msec>]\n"
207 " [--bioslogoimagepath <imagepath>]\n"
208 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
209 " [--biossystemtimeoffset <msec>]\n"
210 " [--biospxedebug on|off]\n"
211 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
212 " [--nic<1-N> none|null|nat|bridged|intnet"
213#if defined(VBOX_WITH_NETFLT)
214 "|hostonly"
215#endif
216 "|\n"
217 " generic"
218 "]\n"
219 " [--nictype<1-N> Am79C970A|Am79C973"
220#ifdef VBOX_WITH_E1000
221 "|\n 82540EM|82543GC|82545EM"
222#endif
223#ifdef VBOX_WITH_VIRTIO
224 "|\n virtio"
225#endif /* VBOX_WITH_VIRTIO */
226 "]\n"
227 " [--cableconnected<1-N> on|off]\n"
228 " [--nictrace<1-N> on|off]\n"
229 " [--nictracefile<1-N> <filename>]\n"
230 " [--nicproperty<1-N> name=[value]]\n"
231 " [--nicspeed<1-N> <kbps>]\n"
232 " [--nicbootprio<1-N> <priority>]\n"
233 " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
234 " [--nicbandwidthgroup<1-N> none|<name>]\n"
235 " [--bridgeadapter<1-N> none|<devicename>]\n"
236#if defined(VBOX_WITH_NETFLT)
237 " [--hostonlyadapter<1-N> none|<devicename>]\n"
238#endif
239 " [--intnet<1-N> <network name>]\n"
240 " [--natnet<1-N> <network>|default]\n"
241 " [--nicgenericdrv<1-N> <driver>\n"
242 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
243 " [<sockrcv>],[<tcpsnd>],\n"
244 " [<tcprcv>]]\n"
245 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
246 " <hostport>,[<guestip>],<guestport>]\n"
247 " [--natpf<1-N> delete <rulename>]\n"
248 " [--nattftpprefix<1-N> <prefix>]\n"
249 " [--nattftpfile<1-N> <file>]\n"
250 " [--nattftpserver<1-N> <ip>]\n"
251 " [--natbindip<1-N> <ip>\n"
252 " [--natdnspassdomain<1-N> on|off]\n"
253 " [--natdnsproxy<1-N> on|off]\n"
254 " [--natdnshostresolver<1-N> on|off]\n"
255 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
256 " [sameports]]\n"
257 " [--macaddress<1-N> auto|<mac>]\n"
258 " [--mouse ps2|usb|usbtablet\n"
259 " [--keyboard ps2|usb\n"
260 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
261 " [--uartmode<1-N> disconnected|\n"
262 " server <pipe>|\n"
263 " client <pipe>|\n"
264 " file <file>|\n"
265 " <devicename>]\n"
266#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
267 " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
268 " [--lptmode<1-N> <devicename>]\n"
269#endif
270 " [--guestmemoryballoon <balloonsize in MB>]\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#ifdef VBOX_WITH_VPX
371 " [--vcpenabled on|off]\n"
372 " [--vcpfile <filename>]\n"
373 " [--vcpwidth <width>]\n"
374 " [--vcpheight <height>]\n"
375#endif
376 " [--defaultfrontend default|<name]\n"
377 "\n");
378 }
379
380 if (u64Cmd & USAGE_CLONEVM)
381 RTStrmPrintf(pStrm,
382 "%s clonevm %s <uuid>|<name>\n"
383 " [--snapshot <uuid>|<name>]\n"
384 " [--mode machine|machineandchildren|all]\n"
385 " [--options link|keepallmacs|keepnatmacs|\n"
386 " keepdisknames]\n"
387 " [--name <name>]\n"
388 " [--groups <group>, ...]\n"
389 " [--basefolder <basefolder>]\n"
390 " [--uuid <uuid>]\n"
391 " [--register]\n"
392 "\n", SEP);
393
394 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
395 RTStrmPrintf(pStrm,
396 "%s import %s <ovf/ova>\n"
397 " [--dry-run|-n]\n"
398 " [--options keepallmacs|keepnatmacs]\n"
399 " [more options]\n"
400 " (run with -n to have options displayed\n"
401 " for a particular OVF)\n\n", SEP);
402
403 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
404 RTStrmPrintf(pStrm,
405 "%s export %s <machines> --output|-o <name>.<ovf/ova>\n"
406 " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
407 " [--manifest]\n"
408 " [--vsys <number of virtual system>]\n"
409 " [--product <product name>]\n"
410 " [--producturl <product url>]\n"
411 " [--vendor <vendor name>]\n"
412 " [--vendorurl <vendor url>]\n"
413 " [--version <version info>]\n"
414 " [--eula <license text>]\n"
415 " [--eulafile <filename>]\n"
416 "\n", SEP);
417
418 if (u64Cmd & USAGE_STARTVM)
419 {
420 RTStrmPrintf(pStrm,
421 "%s startvm %s <uuid>|<name>...\n"
422 " [--type gui", SEP);
423 if (fVBoxSDL)
424 RTStrmPrintf(pStrm, "|sdl");
425 RTStrmPrintf(pStrm, "|headless]\n");
426 RTStrmPrintf(pStrm,
427 "\n");
428 }
429
430 if (u64Cmd & USAGE_CONTROLVM)
431 {
432 RTStrmPrintf(pStrm,
433 "%s controlvm %s <uuid>|<name>\n"
434 " pause|resume|reset|poweroff|savestate|\n"
435 " acpipowerbutton|acpisleepbutton|\n"
436 " keyboardputscancode <hex> [<hex> ...]|\n"
437 " setlinkstate<1-N> on|off |\n"
438#if defined(VBOX_WITH_NETFLT)
439 " nic<1-N> null|nat|bridged|intnet|hostonly|generic"
440 "\n"
441 " [<devicename>] |\n"
442#else /* !VBOX_WITH_NETFLT */
443 " nic<1-N> null|nat|bridged|intnet|generic\n"
444 " [<devicename>] |\n"
445#endif /* !VBOX_WITH_NETFLT */
446 " nictrace<1-N> on|off |\n"
447 " nictracefile<1-N> <filename> |\n"
448 " nicproperty<1-N> name=[value] |\n"
449 " nicpromisc<1-N> deny|allow-vms|allow-all |\n"
450 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
451 " <hostport>,[<guestip>],<guestport> |\n"
452 " natpf<1-N> delete <rulename> |\n"
453 " guestmemoryballoon <balloonsize in MB> |\n"
454 " usbattach <uuid>|<address> |\n"
455 " usbdetach <uuid>|<address> |\n"
456 " clipboard disabled|hosttoguest|guesttohost|\n"
457 " bidirectional |\n"
458 " draganddrop disabled|hosttoguest |\n"
459 " vrde on|off |\n"
460 " vrdeport <port> |\n"
461 " vrdeproperty <name=[value]> |\n"
462 " vrdevideochannelquality <percent> |\n"
463 " setvideomodehint <xres> <yres> <bpp>\n"
464 " [[<display>] [<enabled:yes|no> |\n"
465 " [<xorigin> <yorigin>]]] |\n"
466 " screenshotpng <file> [display] |\n"
467 " setcredentials <username>\n"
468 " --passwordfile <file> | <password>\n"
469 " <domain>\n"
470 " [--allowlocallogon <yes|no>] |\n"
471 " teleport --host <name> --port <port>\n"
472 " [--maxdowntime <msec>]\n"
473 " [--passwordfile <file> |\n"
474 " --password <password>] |\n"
475 " plugcpu <id> |\n"
476 " unplugcpu <id> |\n"
477 " cpuexecutioncap <1-100>\n"
478 "\n", SEP);
479 }
480
481 if (u64Cmd & USAGE_DISCARDSTATE)
482 RTStrmPrintf(pStrm,
483 "%s discardstate %s <uuid>|<name>\n"
484 "\n", SEP);
485
486 if (u64Cmd & USAGE_ADOPTSTATE)
487 RTStrmPrintf(pStrm,
488 "%s adoptstate %s <uuid>|<name> <state_file>\n"
489 "\n", SEP);
490
491 if (u64Cmd & USAGE_SNAPSHOT)
492 RTStrmPrintf(pStrm,
493 "%s snapshot %s <uuid>|<name>\n"
494 " take <name> [--description <desc>] [--pause] |\n"
495 " delete <uuid>|<name> |\n"
496 " restore <uuid>|<name> |\n"
497 " restorecurrent |\n"
498 " edit <uuid>|<name>|--current\n"
499 " [--name <name>]\n"
500 " [--description <desc>] |\n"
501 " list [--details|--machinereadable]\n"
502 " showvminfo <uuid>|<name>\n"
503 "\n", SEP);
504
505 if (u64Cmd & USAGE_CLOSEMEDIUM)
506 RTStrmPrintf(pStrm,
507 "%s closemedium %s disk|dvd|floppy <uuid>|<filename>\n"
508 " [--delete]\n"
509 "\n", SEP);
510
511 if (u64Cmd & USAGE_STORAGEATTACH)
512 RTStrmPrintf(pStrm,
513 "%s storageattach %s <uuid|vmname>\n"
514 " --storagectl <name>\n"
515 " [--port <number>]\n"
516 " [--device <number>]\n"
517 " [--type dvddrive|hdd|fdd]\n"
518 " [--medium none|emptydrive|additions|\n"
519 " <uuid>|<filename>|host:<drive>|iscsi]\n"
520 " [--mtype normal|writethrough|immutable|shareable|\n"
521 " readonly|multiattach]\n"
522 " [--comment <text>]\n"
523 " [--setuuid <uuid>]\n"
524 " [--setparentuuid <uuid>]\n"
525 " [--passthrough on|off]\n"
526 " [--tempeject on|off]\n"
527 " [--nonrotational on|off]\n"
528 " [--discard on|off]\n"
529 " [--bandwidthgroup <name>]\n"
530 " [--forceunmount]\n"
531 " [--server <name>|<ip>]\n"
532 " [--target <target>]\n"
533 " [--tport <port>]\n"
534 " [--lun <lun>]\n"
535 " [--encodedlun <lun>]\n"
536 " [--username <username>]\n"
537 " [--password <password>]\n"
538 " [--initiator <initiator>]\n"
539 " [--intnet]\n"
540 "\n", SEP);
541
542 if (u64Cmd & USAGE_STORAGECONTROLLER)
543 RTStrmPrintf(pStrm,
544 "%s storagectl %s <uuid|vmname>\n"
545 " --name <name>\n"
546 " [--add ide|sata|scsi|floppy|sas]\n"
547 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
548 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
549 " [--sataportcount <1-30>]\n"
550 " [--hostiocache on|off]\n"
551 " [--bootable on|off]\n"
552 " [--remove]\n"
553 "\n", SEP);
554
555 if (u64Cmd & USAGE_BANDWIDTHCONTROL)
556 RTStrmPrintf(pStrm,
557 "%s bandwidthctl %s <uuid|vmname>\n"
558 " add <name> --type disk|network\n"
559 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
560 " set <name>\n"
561 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
562 " remove <name> |\n"
563 " list [--machinereadable]\n"
564 " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
565 " K=kilobyte, M=megabyte, G=gigabyte)\n"
566 "\n", SEP);
567
568 if (u64Cmd & USAGE_SHOWHDINFO)
569 RTStrmPrintf(pStrm,
570 "%s showhdinfo %s <uuid>|<filename>\n"
571 "\n", SEP);
572
573 if (u64Cmd & USAGE_CREATEHD)
574 RTStrmPrintf(pStrm,
575 "%s createhd %s --filename <filename>\n"
576 " [--size <megabytes>|--sizebyte <bytes>]\n"
577 " [--diffparent <uuid>|<filename>\n"
578 " [--format VDI|VMDK|VHD] (default: VDI)\n"
579 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
580 "\n", SEP);
581
582 if (u64Cmd & USAGE_MODIFYHD)
583 RTStrmPrintf(pStrm,
584 "%s modifyhd %s <uuid>|<filename>\n"
585 " [--type normal|writethrough|immutable|shareable|\n"
586 " readonly|multiattach]\n"
587 " [--autoreset on|off]\n"
588 " [--compact]\n"
589 " [--resize <megabytes>|--resizebyte <bytes>]\n"
590 "\n", SEP);
591
592 if (u64Cmd & USAGE_CLONEHD)
593 RTStrmPrintf(pStrm,
594 "%s clonehd %s <uuid>|<filename> <uuid>|<outputfile>\n"
595 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
596 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
597 " [--existing]\n"
598 "\n", SEP);
599
600 if (u64Cmd & USAGE_CONVERTFROMRAW)
601 RTStrmPrintf(pStrm,
602 "%s convertfromraw %s <filename> <outputfile>\n"
603 " [--format VDI|VMDK|VHD]\n"
604 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
605 " [--uuid <uuid>]\n"
606 "%s convertfromraw %s stdin <outputfile> <bytes>\n"
607 " [--format VDI|VMDK|VHD]\n"
608 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
609 " [--uuid <uuid>]\n"
610 "\n", SEP, SEP);
611
612 if (u64Cmd & USAGE_GETEXTRADATA)
613 RTStrmPrintf(pStrm,
614 "%s getextradata %s global|<uuid>|<name>\n"
615 " <key>|enumerate\n"
616 "\n", SEP);
617
618 if (u64Cmd & USAGE_SETEXTRADATA)
619 RTStrmPrintf(pStrm,
620 "%s setextradata %s global|<uuid>|<name>\n"
621 " <key>\n"
622 " [<value>] (no value deletes key)\n"
623 "\n", SEP);
624
625 if (u64Cmd & USAGE_SETPROPERTY)
626 RTStrmPrintf(pStrm,
627 "%s setproperty %s machinefolder default|<folder> |\n"
628 " vrdeauthlibrary default|<library> |\n"
629 " websrvauthlibrary default|null|<library> |\n"
630 " vrdeextpack null|<library> |\n"
631 " autostartdbpath null|<folder> |\n"
632 " loghistorycount <value>\n"
633 " defaultfrontend default|<name>\n"
634 "\n", SEP);
635
636 if (u64Cmd & USAGE_USBFILTER_ADD)
637 RTStrmPrintf(pStrm,
638 "%s usbfilter %s add <index,0-N>\n"
639 " --target <uuid>|<name>|global\n"
640 " --name <string>\n"
641 " --action ignore|hold (global filters only)\n"
642 " [--active yes|no] (yes)\n"
643 " [--vendorid <XXXX>] (null)\n"
644 " [--productid <XXXX>] (null)\n"
645 " [--revision <IIFF>] (null)\n"
646 " [--manufacturer <string>] (null)\n"
647 " [--product <string>] (null)\n"
648 " [--remote yes|no] (null, VM filters only)\n"
649 " [--serialnumber <string>] (null)\n"
650 " [--maskedinterfaces <XXXXXXXX>]\n"
651 "\n", SEP);
652
653 if (u64Cmd & USAGE_USBFILTER_MODIFY)
654 RTStrmPrintf(pStrm,
655 "%s usbfilter %s modify <index,0-N>\n"
656 " --target <uuid>|<name>|global\n"
657 " [--name <string>]\n"
658 " [--action ignore|hold] (global filters only)\n"
659 " [--active yes|no]\n"
660 " [--vendorid <XXXX>|\"\"]\n"
661 " [--productid <XXXX>|\"\"]\n"
662 " [--revision <IIFF>|\"\"]\n"
663 " [--manufacturer <string>|\"\"]\n"
664 " [--product <string>|\"\"]\n"
665 " [--remote yes|no] (null, VM filters only)\n"
666 " [--serialnumber <string>|\"\"]\n"
667 " [--maskedinterfaces <XXXXXXXX>]\n"
668 "\n", SEP);
669
670 if (u64Cmd & USAGE_USBFILTER_REMOVE)
671 RTStrmPrintf(pStrm,
672 "%s usbfilter %s remove <index,0-N>\n"
673 " --target <uuid>|<name>|global\n"
674 "\n", SEP);
675
676 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
677 RTStrmPrintf(pStrm,
678 "%s sharedfolder %s add <vmname>|<uuid>\n"
679 " --name <name> --hostpath <hostpath>\n"
680 " [--transient] [--readonly] [--automount]\n"
681 "\n", SEP);
682
683 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
684 RTStrmPrintf(pStrm,
685 "%s sharedfolder %s remove <vmname>|<uuid>\n"
686 " --name <name> [--transient]\n"
687 "\n", SEP);
688
689#ifdef VBOX_WITH_GUEST_PROPS
690 if (u64Cmd & USAGE_GUESTPROPERTY)
691 usageGuestProperty(pStrm, SEP);
692#endif /* VBOX_WITH_GUEST_PROPS defined */
693
694#ifdef VBOX_WITH_GUEST_CONTROL
695 if (u64Cmd & USAGE_GUESTCONTROL)
696 usageGuestControl(pStrm, SEP);
697#endif /* VBOX_WITH_GUEST_CONTROL defined */
698
699 if (u64Cmd & USAGE_DEBUGVM)
700 {
701 RTStrmPrintf(pStrm,
702 "%s debugvm %s <uuid>|<name>\n"
703 " dumpguestcore --filename <name> |\n"
704 " info <item> [args] |\n"
705 " injectnmi |\n"
706 " log [--release|--debug] <settings> ...|\n"
707 " logdest [--release|--debug] <settings> ...|\n"
708 " logflags [--release|--debug] <settings> ...|\n"
709 " osdetect |\n"
710 " osinfo |\n"
711 " getregisters [--cpu <id>] <reg>|all ... |\n"
712 " setregisters [--cpu <id>] <reg>=<value> ... |\n"
713 " show [--human-readable|--sh-export|--sh-eval|\n"
714 " --cmd-set] \n"
715 " <logdbg-settings|logrel-settings>\n"
716 " [[opt] what ...] |\n"
717 " statistics [--reset] [--pattern <pattern>]\n"
718 " [--descriptions]\n"
719 "\n", SEP);
720 }
721 if (u64Cmd & USAGE_METRICS)
722 RTStrmPrintf(pStrm,
723 "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
724 " (comma-separated)\n\n"
725 "%s metrics %s setup\n"
726 " [--period <seconds>] (default: 1)\n"
727 " [--samples <count>] (default: 1)\n"
728 " [--list]\n"
729 " [*|host|<vmname> [<metric_list>]]\n\n"
730 "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
731 "%s metrics %s enable\n"
732 " [--list]\n"
733 " [*|host|<vmname> [<metric_list>]]\n\n"
734 "%s metrics %s disable\n"
735 " [--list]\n"
736 " [*|host|<vmname> [<metric_list>]]\n\n"
737 "%s metrics %s collect\n"
738 " [--period <seconds>] (default: 1)\n"
739 " [--samples <count>] (default: 1)\n"
740 " [--list]\n"
741 " [--detach]\n"
742 " [*|host|<vmname> [<metric_list>]]\n"
743 "\n", SEP, SEP, SEP, SEP, SEP, SEP);
744
745#if defined(VBOX_WITH_NETFLT)
746 if (u64Cmd & USAGE_HOSTONLYIFS)
747 {
748 RTStrmPrintf(pStrm,
749 "%s hostonlyif %s ipconfig <name>\n"
750 " [--dhcp |\n"
751 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
752 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
753# if !defined(RT_OS_SOLARIS)
754 " create |\n"
755 " remove <name>\n"
756# endif
757 "\n", SEP);
758 }
759#endif
760
761 if (u64Cmd & USAGE_DHCPSERVER)
762 {
763 RTStrmPrintf(pStrm,
764 "%s dhcpserver %s add|modify --netname <network_name> |\n"
765#if defined(VBOX_WITH_NETFLT)
766 " --ifname <hostonly_if_name>\n"
767#endif
768 " [--ip <ip_address>\n"
769 " --netmask <network_mask>\n"
770 " --lowerip <lower_ip>\n"
771 " --upperip <upper_ip>]\n"
772 " [--enable | --disable]\n\n"
773 "%s dhcpserver %s remove --netname <network_name> |\n"
774#if defined(VBOX_WITH_NETFLT)
775 " --ifname <hostonly_if_name>\n"
776#endif
777 "\n", SEP, SEP);
778 }
779 if (u64Cmd & USAGE_EXTPACK)
780 {
781 RTStrmPrintf(pStrm,
782 "%s extpack %s install [--replace] <tarball> |\n"
783 " uninstall [--force] <name> |\n"
784 " cleanup\n"
785 "\n", SEP);
786 }
787}
788
789/**
790 * Print a usage synopsis and the syntax error message.
791 * @returns RTEXITCODE_SYNTAX.
792 */
793RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
794{
795 va_list args;
796 showLogo(g_pStdErr); // show logo even if suppressed
797#ifndef VBOX_ONLY_DOCS
798 if (g_fInternalMode)
799 printUsageInternal(u64Cmd, g_pStdErr);
800 else
801 printUsage(u64Cmd, g_pStdErr);
802#endif /* !VBOX_ONLY_DOCS */
803 va_start(args, pszFormat);
804 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
805 va_end(args);
806 return RTEXITCODE_SYNTAX;
807}
808
809/**
810 * errorSyntax for RTGetOpt users.
811 *
812 * @returns RTEXITCODE_SYNTAX.
813 *
814 * @param fUsageCategory The usage category of the command.
815 * @param rc The RTGetOpt return code.
816 * @param pValueUnion The value union.
817 */
818RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
819{
820 /*
821 * Check if it is an unhandled standard option.
822 */
823 if (rc == 'V')
824 {
825 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
826 return RTEXITCODE_SUCCESS;
827 }
828
829 if (rc == 'h')
830 {
831 showLogo(g_pStdErr);
832#ifndef VBOX_ONLY_DOCS
833 if (g_fInternalMode)
834 printUsageInternal(fUsageCategory, g_pStdOut);
835 else
836 printUsage(fUsageCategory, g_pStdOut);
837#endif
838 return RTEXITCODE_SUCCESS;
839 }
840
841 /*
842 * General failure.
843 */
844 showLogo(g_pStdErr); // show logo even if suppressed
845#ifndef VBOX_ONLY_DOCS
846 if (g_fInternalMode)
847 printUsageInternal(fUsageCategory, g_pStdErr);
848 else
849 printUsage(fUsageCategory, g_pStdErr);
850#endif /* !VBOX_ONLY_DOCS */
851
852 if (rc == VINF_GETOPT_NOT_OPTION)
853 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
854 if (rc > 0)
855 {
856 if (RT_C_IS_PRINT(rc))
857 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
858 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
859 }
860 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
861 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
862 if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
863 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
864 if (pValueUnion->pDef)
865 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
866 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
867}
868
869/**
870 * Print an error message without the syntax stuff.
871 *
872 * @returns RTEXITCODE_SYNTAX.
873 */
874RTEXITCODE errorArgument(const char *pszFormat, ...)
875{
876 va_list args;
877 va_start(args, pszFormat);
878 RTMsgErrorV(pszFormat, args);
879 va_end(args);
880 return RTEXITCODE_SYNTAX;
881}
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