VirtualBox

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

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

VBoxManage: introduced 'VBoxManage storageattach additions'

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