VirtualBox

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

Last change on this file since 32962 was 32947, checked in by vboxsync, 14 years ago

VBoxManage: mention --hwvirtexexcl; manual: fixed documentation of --hwvirtex

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette