VirtualBox

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

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

Frontends/VBoxManage: clarify help output of export command

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