VirtualBox

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

Last change on this file since 40673 was 40469, checked in by vboxsync, 13 years ago

VBoxManage: bandwidthctl uses sub-commands instead of options (#5582)

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