VirtualBox

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

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

VBoxManage: fixed slashes in 'controlvm' help

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