VirtualBox

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

Last change on this file since 50174 was 49983, checked in by vboxsync, 11 years ago

Devices/Graphics: VMware SVGA II compatible graphics emulation (2D only), including the associated small API and VBoxManage changes, contributed by trivirt AG.

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