VirtualBox

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

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

API change for SetVideoModeHint to be able to disable guest screens and to set the origin of guest screens

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 41.9 KB
Line 
1/* $Id: VBoxManageHelp.cpp 42248 2012-07-20 08:39:45Z 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>\n"
436 " [[<display>] [<enabled:yes|no>\n"
437 " [<xorigin> <yorigin>]]] |\n"
438 " screenshotpng <file> [display] |\n"
439 " setcredentials <username> <password> <domain>\n"
440 " [--allowlocallogon <yes|no>] |\n"
441 " teleport --host <name> --port <port>\n"
442 " [--maxdowntime <msec>] [--password password]\n"
443 " plugcpu <id>\n"
444 " unplugcpu <id>\n"
445 " cpuexecutioncap <1-100>\n"
446 "\n");
447 }
448
449 if (u64Cmd & USAGE_DISCARDSTATE)
450 RTStrmPrintf(pStrm,
451 "VBoxManage discardstate <uuid>|<name>\n"
452 "\n");
453
454 if (u64Cmd & USAGE_ADOPTSTATE)
455 RTStrmPrintf(pStrm,
456 "VBoxManage adoptstate <uuid>|<name> <state_file>\n"
457 "\n");
458
459 if (u64Cmd & USAGE_SNAPSHOT)
460 RTStrmPrintf(pStrm,
461 "VBoxManage snapshot <uuid>|<name>\n"
462 " take <name> [--description <desc>] [--pause] |\n"
463 " delete <uuid>|<name> |\n"
464 " restore <uuid>|<name> |\n"
465 " restorecurrent |\n"
466 " edit <uuid>|<name>|--current\n"
467 " [--name <name>]\n"
468 " [--description <desc>] |\n"
469 " list [--details|--machinereadable]\n"
470 " showvminfo <uuid>|<name>\n"
471 "\n");
472
473 if (u64Cmd & USAGE_CLOSEMEDIUM)
474 RTStrmPrintf(pStrm,
475 "VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
476 " [--delete]\n"
477 "\n");
478
479 if (u64Cmd & USAGE_STORAGEATTACH)
480 RTStrmPrintf(pStrm,
481 "VBoxManage storageattach <uuid|vmname>\n"
482 " --storagectl <name>\n"
483 " [--port <number>]\n"
484 " [--device <number>]\n"
485 " [--type dvddrive|hdd|fdd]\n"
486 " [--medium none|emptydrive|\n"
487 " <uuid>|<filename>|host:<drive>|iscsi]\n"
488 " [--mtype normal|writethrough|immutable|shareable|\n"
489 " readonly|multiattach]\n"
490 " [--comment <text>]\n"
491 " [--setuuid <uuid>]\n"
492 " [--setparentuuid <uuid>]\n"
493 " [--passthrough on|off]\n"
494 " [--tempeject on|off]\n"
495 " [--nonrotational on|off]\n"
496 " [--discard on|off]\n"
497 " [--bandwidthgroup <name>]\n"
498 " [--forceunmount]\n"
499 " [--server <name>|<ip>]\n"
500 " [--target <target>]\n"
501 " [--tport <port>]\n"
502 " [--lun <lun>]\n"
503 " [--encodedlun <lun>]\n"
504 " [--username <username>]\n"
505 " [--password <password>]\n"
506 " [--intnet]\n"
507 "\n");
508
509 if (u64Cmd & USAGE_STORAGECONTROLLER)
510 RTStrmPrintf(pStrm,
511 "VBoxManage storagectl <uuid|vmname>\n"
512 " --name <name>\n"
513 " [--add ide|sata|scsi|floppy|sas]\n"
514 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
515 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
516 " [--sataideemulation<1-4> <1-30>]\n"
517 " [--sataportcount <1-30>]\n"
518 " [--hostiocache on|off]\n"
519 " [--bootable on|off]\n"
520 " [--remove]\n"
521 "\n");
522
523 if (u64Cmd & USAGE_BANDWIDTHCONTROL)
524 RTStrmPrintf(pStrm,
525 "VBoxManage bandwidthctl <uuid|vmname>\n"
526 " add <name> --type disk|network --limit <megabytes per second>[k|m|g|K|M|G] |\n"
527 " set <name> --limit <megabytes per second>[k|m|g|K|M|G] |\n"
528 " remove <name> |\n"
529 " list [--machinereadable]\n"
530 " (limit units: k=kilobit, m=megabit, g=gigabit, K=kilobyte, M=megabyte, G=gigabyte)\n"
531 "\n");
532
533 if (u64Cmd & USAGE_SHOWHDINFO)
534 RTStrmPrintf(pStrm,
535 "VBoxManage showhdinfo <uuid>|<filename>\n"
536 "\n");
537
538 if (u64Cmd & USAGE_CREATEHD)
539 RTStrmPrintf(pStrm,
540 "VBoxManage createhd --filename <filename>\n"
541 " [--size <megabytes>|--sizebyte <bytes>]\n"
542 " [--diffparent <uuid>|<filename>\n"
543 " [--format VDI|VMDK|VHD] (default: VDI)\n"
544 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
545 "\n");
546
547 if (u64Cmd & USAGE_MODIFYHD)
548 RTStrmPrintf(pStrm,
549 "VBoxManage modifyhd <uuid>|<filename>\n"
550 " [--type normal|writethrough|immutable|shareable|\n"
551 " readonly|multiattach]\n"
552 " [--autoreset on|off]\n"
553 " [--compact]\n"
554 " [--resize <megabytes>|--resizebyte <bytes>]\n"
555 "\n");
556
557 if (u64Cmd & USAGE_CLONEHD)
558 RTStrmPrintf(pStrm,
559 "VBoxManage clonehd <uuid>|<filename> <uuid>|<outputfile>\n"
560 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
561 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
562 " [--existing]\n"
563 "\n");
564
565 if (u64Cmd & USAGE_CONVERTFROMRAW)
566 RTStrmPrintf(pStrm,
567 "VBoxManage convertfromraw <filename> <outputfile>\n"
568 " [--format VDI|VMDK|VHD]\n"
569 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
570 " [--uuid <uuid>]\n"
571 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
572 " [--format VDI|VMDK|VHD]\n"
573 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
574 " [--uuid <uuid>]\n"
575 "\n");
576
577 if (u64Cmd & USAGE_GETEXTRADATA)
578 RTStrmPrintf(pStrm,
579 "VBoxManage getextradata global|<uuid>|<name>\n"
580 " <key>|enumerate\n"
581 "\n");
582
583 if (u64Cmd & USAGE_SETEXTRADATA)
584 RTStrmPrintf(pStrm,
585 "VBoxManage setextradata global|<uuid>|<name>\n"
586 " <key>\n"
587 " [<value>] (no value deletes key)\n"
588 "\n");
589
590 if (u64Cmd & USAGE_SETPROPERTY)
591 RTStrmPrintf(pStrm,
592 "VBoxManage setproperty machinefolder default|<folder> |\n"
593 " vrdeauthlibrary default|<library> |\n"
594 " websrvauthlibrary default|null|<library> |\n"
595 " vrdeextpack null|<library> |\n"
596 " autostartdbpath null|<folder> |\n"
597 " loghistorycount <value>\n"
598 "\n");
599
600 if (u64Cmd & USAGE_USBFILTER_ADD)
601 RTStrmPrintf(pStrm,
602 "VBoxManage usbfilter add <index,0-N>\n"
603 " --target <uuid>|<name>|global\n"
604 " --name <string>\n"
605 " --action ignore|hold (global filters only)\n"
606 " [--active yes|no] (yes)\n"
607 " [--vendorid <XXXX>] (null)\n"
608 " [--productid <XXXX>] (null)\n"
609 " [--revision <IIFF>] (null)\n"
610 " [--manufacturer <string>] (null)\n"
611 " [--product <string>] (null)\n"
612 " [--remote yes|no] (null, VM filters only)\n"
613 " [--serialnumber <string>] (null)\n"
614 " [--maskedinterfaces <XXXXXXXX>]\n"
615 "\n");
616
617 if (u64Cmd & USAGE_USBFILTER_MODIFY)
618 RTStrmPrintf(pStrm,
619 "VBoxManage usbfilter modify <index,0-N>\n"
620 " --target <uuid>|<name>|global\n"
621 " [--name <string>]\n"
622 " [--action ignore|hold] (global filters only)\n"
623 " [--active yes|no]\n"
624 " [--vendorid <XXXX>|\"\"]\n"
625 " [--productid <XXXX>|\"\"]\n"
626 " [--revision <IIFF>|\"\"]\n"
627 " [--manufacturer <string>|\"\"]\n"
628 " [--product <string>|\"\"]\n"
629 " [--remote yes|no] (null, VM filters only)\n"
630 " [--serialnumber <string>|\"\"]\n"
631 " [--maskedinterfaces <XXXXXXXX>]\n"
632 "\n");
633
634 if (u64Cmd & USAGE_USBFILTER_REMOVE)
635 RTStrmPrintf(pStrm,
636 "VBoxManage usbfilter remove <index,0-N>\n"
637 " --target <uuid>|<name>|global\n"
638 "\n");
639
640 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
641 RTStrmPrintf(pStrm,
642 "VBoxManage sharedfolder add <vmname>|<uuid>\n"
643 " --name <name> --hostpath <hostpath>\n"
644 " [--transient] [--readonly] [--automount]\n"
645 "\n");
646
647 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
648 RTStrmPrintf(pStrm,
649 "VBoxManage sharedfolder remove <vmname>|<uuid>\n"
650 " --name <name> [--transient]\n"
651 "\n");
652
653#ifdef VBOX_WITH_GUEST_PROPS
654 if (u64Cmd & USAGE_GUESTPROPERTY)
655 usageGuestProperty(pStrm);
656#endif /* VBOX_WITH_GUEST_PROPS defined */
657
658#ifdef VBOX_WITH_GUEST_CONTROL
659 if (u64Cmd & USAGE_GUESTCONTROL)
660 usageGuestControl(pStrm);
661#endif /* VBOX_WITH_GUEST_CONTROL defined */
662
663 if (u64Cmd & USAGE_DEBUGVM)
664 {
665 RTStrmPrintf(pStrm,
666 "VBoxManage debugvm <uuid>|<name>\n"
667 " dumpguestcore --filename <name> |\n"
668 " info <item> [args] |\n"
669 " injectnmi |\n"
670 " log [--release|--debug] <settings> ...|\n"
671 " logdest [--release|--debug] <settings> ...|\n"
672 " logflags [--release|--debug] <settings> ...|\n"
673 " osdetect |\n"
674 " osinfo |\n"
675 " getregisters [--cpu <id>] <reg>|all ... |\n"
676 " setregisters [--cpu <id>] <reg>=<value> ... |\n"
677 " show [--human-readable|--sh-export|--sh-eval|--cmd-set] \n"
678 " <logdbg-settings|logrel-settings> [[opt] what ...] |\n"
679 " statistics [--reset] [--pattern <pattern>]\n"
680 " [--descriptions]\n"
681 "\n");
682 }
683 if (u64Cmd & USAGE_METRICS)
684 RTStrmPrintf(pStrm,
685 "VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
686 " (comma-separated)\n\n"
687 "VBoxManage metrics setup\n"
688 " [--period <seconds>] (default: 1)\n"
689 " [--samples <count>] (default: 1)\n"
690 " [--list]\n"
691 " [*|host|<vmname> [<metric_list>]]\n\n"
692 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
693 "VBoxManage metrics enable\n"
694 " [--list]\n"
695 " [*|host|<vmname> [<metric_list>]]\n\n"
696 "VBoxManage metrics disable\n"
697 " [--list]\n"
698 " [*|host|<vmname> [<metric_list>]]\n\n"
699 "VBoxManage metrics collect\n"
700 " [--period <seconds>] (default: 1)\n"
701 " [--samples <count>] (default: 1)\n"
702 " [--list]\n"
703 " [--detach]\n"
704 " [*|host|<vmname> [<metric_list>]]\n"
705 "\n");
706
707#if defined(VBOX_WITH_NETFLT)
708 if (u64Cmd & USAGE_HOSTONLYIFS)
709 {
710 RTStrmPrintf(pStrm,
711 "VBoxManage hostonlyif ipconfig <name>\n"
712 " [--dhcp |\n"
713 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
714 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
715# if !defined(RT_OS_SOLARIS)
716 " create |\n"
717 " remove <name>\n"
718# endif
719 "\n");
720 }
721#endif
722
723 if (u64Cmd & USAGE_DHCPSERVER)
724 {
725 RTStrmPrintf(pStrm,
726 "VBoxManage dhcpserver add|modify --netname <network_name> |\n"
727#if defined(VBOX_WITH_NETFLT)
728 " --ifname <hostonly_if_name>\n"
729#endif
730 " [--ip <ip_address>\n"
731 " --netmask <network_mask>\n"
732 " --lowerip <lower_ip>\n"
733 " --upperip <upper_ip>]\n"
734 " [--enable | --disable]\n\n"
735 "VBoxManage dhcpserver remove --netname <network_name> |\n"
736#if defined(VBOX_WITH_NETFLT)
737 " --ifname <hostonly_if_name>\n"
738#endif
739 "\n");
740 }
741 if (u64Cmd & USAGE_EXTPACK)
742 {
743 RTStrmPrintf(pStrm,
744 "VBoxManage extpack install [--replace] <tarball> |\n"
745 " uninstall [--force] <name> |\n"
746 " cleanup\n"
747 "\n");
748 }
749}
750
751/**
752 * Print a usage synopsis and the syntax error message.
753 * @returns RTEXITCODE_SYNTAX.
754 */
755RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
756{
757 va_list args;
758 showLogo(g_pStdErr); // show logo even if suppressed
759#ifndef VBOX_ONLY_DOCS
760 if (g_fInternalMode)
761 printUsageInternal(u64Cmd, g_pStdErr);
762 else
763 printUsage(u64Cmd, g_pStdErr);
764#endif /* !VBOX_ONLY_DOCS */
765 va_start(args, pszFormat);
766 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
767 va_end(args);
768 return RTEXITCODE_SYNTAX;
769}
770
771/**
772 * errorSyntax for RTGetOpt users.
773 *
774 * @returns RTEXITCODE_SYNTAX.
775 *
776 * @param fUsageCategory The usage category of the command.
777 * @param rc The RTGetOpt return code.
778 * @param pValueUnion The value union.
779 */
780RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
781{
782 /*
783 * Check if it is an unhandled standard option.
784 */
785 if (rc == 'V')
786 {
787 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
788 return RTEXITCODE_SUCCESS;
789 }
790
791 if (rc == 'h')
792 {
793 showLogo(g_pStdErr);
794#ifndef VBOX_ONLY_DOCS
795 if (g_fInternalMode)
796 printUsageInternal(fUsageCategory, g_pStdOut);
797 else
798 printUsage(fUsageCategory, g_pStdOut);
799#endif
800 return RTEXITCODE_SUCCESS;
801 }
802
803 /*
804 * General failure.
805 */
806 showLogo(g_pStdErr); // show logo even if suppressed
807#ifndef VBOX_ONLY_DOCS
808 if (g_fInternalMode)
809 printUsageInternal(fUsageCategory, g_pStdErr);
810 else
811 printUsage(fUsageCategory, g_pStdErr);
812#endif /* !VBOX_ONLY_DOCS */
813
814 if (rc == VINF_GETOPT_NOT_OPTION)
815 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
816 if (rc > 0)
817 {
818 if (RT_C_IS_PRINT(rc))
819 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
820 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
821 }
822 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
823 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
824 if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
825 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
826 if (pValueUnion->pDef)
827 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
828 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
829}
830
831/**
832 * Print an error message without the syntax stuff.
833 *
834 * @returns RTEXITCODE_SYNTAX.
835 */
836RTEXITCODE errorArgument(const char *pszFormat, ...)
837{
838 va_list args;
839 va_start(args, pszFormat);
840 RTMsgErrorV(pszFormat, args);
841 va_end(args);
842 return RTEXITCODE_SYNTAX;
843}
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