VirtualBox

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

Last change on this file since 46224 was 46123, checked in by vboxsync, 12 years ago

Main/VPX, VBoxManage: added IMachine::VideoCaptureScreens and IDisplay::{enableVideoCapture,disableVideoCapture}

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

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