VirtualBox

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

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

VBoxManage: one more check for 'controlvm'; removed long obsolete 'gueststatisticsinterval' help

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