VirtualBox

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

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

VBoxManage: update help text

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.5 KB
Line 
1/* $Id: VBoxManageHelp.cpp 33406 2010-10-25 09:49:48Z 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 fVRDE = true;
78#else
79 bool fVRDE = 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 fVRDE = 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 " [--chipset ich9|piix3]\n"
196 " [--bioslogofadein on|off]\n"
197 " [--bioslogofadeout on|off]\n"
198 " [--bioslogodisplaytime <msec>]\n"
199 " [--bioslogoimagepath <imagepath>]\n"
200 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
201 " [--biossystemtimeoffset <msec>]\n"
202 " [--biospxedebug on|off]\n"
203 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
204 " [--nic<1-N> none|null|nat|bridged|intnet"
205#if defined(VBOX_WITH_NETFLT)
206 "|hostonly"
207#endif
208#ifdef VBOX_WITH_VDE
209 "|\n"
210 " vde"
211#endif
212 "]\n"
213 " [--nictype<1-N> Am79C970A|Am79C973"
214#ifdef VBOX_WITH_E1000
215 "|\n 82540EM|82543GC|82545EM"
216#endif
217#ifdef VBOX_WITH_VIRTIO
218 "|\n virtio"
219#endif /* VBOX_WITH_VIRTIO */
220 "]\n"
221 " [--cableconnected<1-N> on|off]\n"
222 " [--nictrace<1-N> on|off]\n"
223 " [--nictracefile<1-N> <filename>]\n"
224 " [--nicspeed<1-N> <kbps>]\n"
225 " [--nicbootprio<1-N> <priority>]\n"
226 " [--bridgeadapter<1-N> none|<devicename>]\n"
227#if defined(VBOX_WITH_NETFLT)
228 " [--hostonlyadapter<1-N> none|<devicename>]\n"
229#endif
230 " [--intnet<1-N> <network name>]\n"
231 " [--natnet<1-N> <network>|default]\n"
232#ifdef VBOX_WITH_VDE
233 " [--vdenet<1-N> <network>|default]\n"
234#endif
235 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
236 " [<sockrcv>],[<tcpsnd>],\n"
237 " [<tcprcv>]]\n"
238 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
239 " <hostport>,[<guestip>],<guestport>]\n"
240 " [--natpf<1-N> delete <rulename>]\n"
241 " [--nattftpprefix<1-N> <prefix>]\n"
242 " [--nattftpfile<1-N> <file>]\n"
243 " [--nattftpserver<1-N> <ip>]\n"
244 " [--natdnspassdomain<1-N> on|off]\n"
245 " [--natdnsproxy<1-N> on|off]\n"
246 " [--natdnshostresolver<1-N> on|off]\n"
247 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
248 " [sameports]]\n"
249 " [--macaddress<1-N> auto|<mac>]\n"
250 " [--mouse ps2|usb|usbtablet\n"
251 " [--keyboard ps2|usb\n"
252 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
253 " [--uartmode<1-N> disconnected|\n"
254 " server <pipe>|\n"
255 " client <pipe>|\n"
256 " file <file>|\n"
257 " <devicename>]\n"
258 " [--guestmemoryballoon <balloonsize in MB>]\n"
259 " [--gueststatisticsinterval <seconds>]\n"
260 " [--audio none|null");
261 if (fWin)
262 {
263#ifdef VBOX_WITH_WINMM
264 RTStrmPrintf(pStrm, "|winmm|dsound");
265#else
266 RTStrmPrintf(pStrm, "|dsound");
267#endif
268 }
269 if (fSolaris)
270 {
271 RTStrmPrintf(pStrm, "|solaudio"
272#ifdef VBOX_WITH_SOLARIS_OSS
273 "|oss"
274#endif
275 );
276 }
277 if (fLinux)
278 {
279 RTStrmPrintf(pStrm, "|oss"
280#ifdef VBOX_WITH_ALSA
281 "|alsa"
282#endif
283#ifdef VBOX_WITH_PULSE
284 "|pulse"
285#endif
286 );
287 }
288 if (fFreeBSD)
289 {
290 /* Get the line break sorted when dumping all option variants. */
291 if (fDumpOpts)
292 {
293 RTStrmPrintf(pStrm, "|\n"
294 " oss");
295 }
296 else
297 RTStrmPrintf(pStrm, "|oss");
298#ifdef VBOX_WITH_PULSE
299 RTStrmPrintf(pStrm, "|pulse");
300#endif
301 }
302 if (fDarwin)
303 {
304 RTStrmPrintf(pStrm, "|coreaudio");
305 }
306 RTStrmPrintf(pStrm, "]\n");
307 RTStrmPrintf(pStrm,
308 " [--audiocontroller ac97|hda|sb16]\n"
309 " [--clipboard disabled|hosttoguest|guesttohost|\n"
310 " bidirectional]\n");
311 if (fVRDE)
312 {
313 RTStrmPrintf(pStrm,
314 " [--vrde on|off]\n"
315 " [--vrdesetproperty <name=[value]>]\n"
316 " [--vrdeauthtype null|external|guest]\n"
317 " [--vrdemulticon on|off]\n"
318 " [--vrdereusecon on|off]\n"
319 " [--vrdevideochannel on|off]\n"
320 " [--vrdevideochannelquality <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/ova> [--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/ova>\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 RTStrmPrintf(pStrm, "|headless]\n");
378 RTStrmPrintf(pStrm,
379 "\n");
380 }
381
382 if (u64Cmd & USAGE_CONTROLVM)
383 {
384 RTStrmPrintf(pStrm,
385 "VBoxManage controlvm <uuid>|<name>\n"
386 " pause|resume|reset|poweroff|savestate|\n"
387 " acpipowerbutton|acpisleepbutton|\n"
388 " keyboardputscancode <hex> [<hex> ...]|\n"
389 " injectnmi|\n"
390 " setlinkstate<1-N> on|off |\n"
391#ifdef VBOX_DYNAMIC_NET_ATTACH
392#if defined(VBOX_WITH_NETFLT)
393 " nic<1-N> null|nat|bridged|intnet|hostonly\n"
394 " [<devicename>] |\n"
395#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
396 " nic<1-N> null|nat|bridged|intnet\n"
397 " [<devicename>] |\n"
398#endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
399 " nictrace<1-N> on|off\n"
400 " nictracefile<1-N> <filename>\n"
401#endif /* VBOX_DYNAMIC_NET_ATTACH */
402 " guestmemoryballoon <balloonsize in MB>]\n"
403 " gueststatisticsinterval <seconds>]\n"
404 " usbattach <uuid>|<address> |\n"
405 " usbdetach <uuid>|<address> |\n");
406 if (fVRDE)
407 {
408 RTStrmPrintf(pStrm,
409 " vrde on|off |\n");
410 RTStrmPrintf(pStrm,
411 " vrdesetproperty <name=[value]> |\n"
412 " vrdevideochannelquality <percent>\n");
413 }
414 RTStrmPrintf(pStrm,
415 " setvideomodehint <xres> <yres> <bpp> [display] |\n"
416 " setcredentials <username> <password> <domain>\n"
417 " [--allowlocallogon <yes|no>] |\n"
418 " teleport --host <name> --port <port>\n"
419 " [--maxdowntime <msec>] [--password password]\n"
420 " plugcpu <id>\n"
421 " unplugcpu <id>\n"
422 " cpuexecutioncap <1-100>\n"
423 "\n");
424 }
425
426 if (u64Cmd & USAGE_DISCARDSTATE)
427 {
428 RTStrmPrintf(pStrm,
429 "VBoxManage discardstate <uuid>|<name>\n"
430 "\n");
431 }
432
433 if (u64Cmd & USAGE_ADOPTSTATE)
434 {
435 RTStrmPrintf(pStrm,
436 "VBoxManage adoptstate <uuid>|<name> <state_file>\n"
437 "\n");
438 }
439
440 if (u64Cmd & USAGE_SNAPSHOT)
441 {
442 RTStrmPrintf(pStrm,
443 "VBoxManage snapshot <uuid>|<name>\n"
444 " take <name> [--description <desc>] [--pause] |\n"
445 " delete <uuid>|<name> |\n"
446 " restore <uuid>|<name> |\n"
447 " restorecurrent |\n"
448 " edit <uuid>|<name>|--current\n"
449 " [--name <name>]\n"
450 " [--description <desc>] |\n"
451 " showvminfo <uuid>|<name>\n"
452 "\n");
453 }
454
455 if (u64Cmd & USAGE_OPENMEDIUM)
456 {
457 RTStrmPrintf(pStrm,
458 "VBoxManage openmedium disk|dvd|floppy <filename>\n"
459 " [--type normal|immutable|writethrough|\n"
460 " shareable] (disk only)\n"
461 " [--uuid <uuid>]\n"
462 " [--parentuuid <uuid>] (disk only)\n"
463 "\n");
464 }
465
466 if (u64Cmd & USAGE_CLOSEMEDIUM)
467 {
468 RTStrmPrintf(pStrm,
469 "VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
470 " [--delete]\n"
471 "\n");
472 }
473
474 if (u64Cmd & USAGE_STORAGEATTACH)
475 {
476 RTStrmPrintf(pStrm,
477 "VBoxManage storageattach <uuid|vmname>\n"
478 " --storagectl <name>\n"
479 " --port <number>\n"
480 " --device <number>\n"
481 " [--type dvddrive|hdd|fdd]\n"
482 " [--medium none|emptydrive|\n"
483 " <uuid>|<filename>|host:<drive>]\n"
484 " [--passthrough on|off]\n"
485 " [--forceunmount]\n"
486 "\n");
487 }
488
489 if (u64Cmd & USAGE_STORAGECONTROLLER)
490 {
491 RTStrmPrintf(pStrm,
492 "VBoxManage storagectl <uuid|vmname>\n"
493 " --name <name>\n"
494 " [--add ide|sata|scsi|floppy|sas]\n"
495 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
496 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
497 " [--sataideemulation<1-4> <1-30>]\n"
498 " [--sataportcount <1-30>]\n"
499 " [--hostiocache on|off]\n"
500 " [--remove]\n"
501 "\n");
502 }
503
504 if (u64Cmd & USAGE_SHOWHDINFO)
505 {
506 RTStrmPrintf(pStrm,
507 "VBoxManage showhdinfo <uuid>|<filename>\n"
508 "\n");
509 }
510
511 if (u64Cmd & USAGE_CREATEHD)
512 {
513 RTStrmPrintf(pStrm,
514 "VBoxManage createhd --filename <filename>\n"
515 " --size <megabytes>|--sizebyte <bytes>\n"
516 " [--format VDI|VMDK|VHD] (default: VDI)\n"
517 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
518 " [--type normal|writethrough|\n"
519 " shareable] (default: normal)\n"
520 " [--comment <comment>]\n"
521 " [--remember]\n"
522 "\n");
523 }
524
525 if (u64Cmd & USAGE_MODIFYHD)
526 {
527 RTStrmPrintf(pStrm,
528 "VBoxManage modifyhd <uuid>|<filename>\n"
529 " [--type normal|writethrough|immutable|shareable]\n"
530 " [--autoreset on|off]\n"
531 " [--compact]\n"
532 " [--resize <megabytes>]\n"
533 "\n");
534 }
535
536 if (u64Cmd & USAGE_CLONEHD)
537 {
538 RTStrmPrintf(pStrm,
539 "VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
540 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
541 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
542 " [--type normal|writethrough|immutable|shareable]\n"
543 " [--remember] [--existing]\n"
544 "\n");
545 }
546
547 if (u64Cmd & USAGE_CONVERTFROMRAW)
548 {
549 RTStrmPrintf(pStrm,
550 "VBoxManage convertfromraw <filename> <outputfile>\n"
551 " [--format VDI|VMDK|VHD]\n"
552 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
553#ifndef RT_OS_WINDOWS
554 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
555 " [--format VDI|VMDK|VHD]\n"
556 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
557#endif
558 "\n");
559 }
560
561 if (u64Cmd & USAGE_ADDISCSIDISK)
562 {
563 RTStrmPrintf(pStrm,
564 "VBoxManage addiscsidisk --server <name>|<ip>\n"
565 " --target <target>\n"
566 " [--port <port>]\n"
567 " [--lun <lun>]\n"
568 " [--encodedlun <lun>]\n"
569 " [--username <username>]\n"
570 " [--password <password>]\n"
571 " [--type normal|writethrough|immutable|shareable]\n"
572 " [--intnet]\n"
573 "\n");
574 }
575
576 if (u64Cmd & USAGE_GETEXTRADATA)
577 {
578 RTStrmPrintf(pStrm,
579 "VBoxManage getextradata global|<uuid>|<name>\n"
580 " <key>|enumerate\n"
581 "\n");
582 }
583
584 if (u64Cmd & USAGE_SETEXTRADATA)
585 {
586 RTStrmPrintf(pStrm,
587 "VBoxManage setextradata global|<uuid>|<name>\n"
588 " <key>\n"
589 " [<value>] (no value deletes key)\n"
590 "\n");
591 }
592
593 if (u64Cmd & USAGE_SETPROPERTY)
594 {
595 RTStrmPrintf(pStrm,
596 "VBoxManage setproperty hdfolder default|<folder> |\n"
597 " machinefolder default|<folder> |\n"
598 " vrdeauthlibrary default|<library> |\n"
599 " websrvauthlibrary default|null|<library> |\n"
600 " vrdelibrary null|<library> |\n"
601 " loghistorycount <value>\n"
602 "\n");
603 }
604
605 if (u64Cmd & USAGE_USBFILTER_ADD)
606 {
607 RTStrmPrintf(pStrm,
608 "VBoxManage usbfilter add <index,0-N>\n"
609 " --target <uuid>|<name>|global\n"
610 " --name <string>\n"
611 " --action ignore|hold (global filters only)\n"
612 " [--active yes|no] (yes)\n"
613 " [--vendorid <XXXX>] (null)\n"
614 " [--productid <XXXX>] (null)\n"
615 " [--revision <IIFF>] (null)\n"
616 " [--manufacturer <string>] (null)\n"
617 " [--product <string>] (null)\n"
618 " [--remote yes|no] (null, VM filters only)\n"
619 " [--serialnumber <string>] (null)\n"
620 " [--maskedinterfaces <XXXXXXXX>]\n"
621 "\n");
622 }
623
624 if (u64Cmd & USAGE_USBFILTER_MODIFY)
625 {
626 RTStrmPrintf(pStrm,
627 "VBoxManage usbfilter modify <index,0-N>\n"
628 " --target <uuid>|<name>|global\n"
629 " [--name <string>]\n"
630 " [--action ignore|hold] (global filters only)\n"
631 " [--active yes|no]\n"
632 " [--vendorid <XXXX>|\"\"]\n"
633 " [--productid <XXXX>|\"\"]\n"
634 " [--revision <IIFF>|\"\"]\n"
635 " [--manufacturer <string>|\"\"]\n"
636 " [--product <string>|\"\"]\n"
637 " [--remote yes|no] (null, VM filters only)\n"
638 " [--serialnumber <string>|\"\"]\n"
639 " [--maskedinterfaces <XXXXXXXX>]\n"
640 "\n");
641 }
642
643 if (u64Cmd & USAGE_USBFILTER_REMOVE)
644 {
645 RTStrmPrintf(pStrm,
646 "VBoxManage usbfilter remove <index,0-N>\n"
647 " --target <uuid>|<name>|global\n"
648 "\n");
649 }
650
651 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
652 {
653 RTStrmPrintf(pStrm,
654 "VBoxManage sharedfolder add <vmname>|<uuid>\n"
655 " --name <name> --hostpath <hostpath>\n"
656 " [--transient] [--readonly] [--automount]\n"
657 "\n");
658 }
659
660 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
661 {
662 RTStrmPrintf(pStrm,
663 "VBoxManage sharedfolder remove <vmname>|<uuid>\n"
664 " --name <name> [--transient]\n"
665 "\n");
666 }
667
668 if (u64Cmd & USAGE_VM_STATISTICS)
669 {
670 RTStrmPrintf(pStrm,
671 "VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
672 " [--pattern <pattern>] [--descriptions]\n"
673 "\n");
674 }
675
676#ifdef VBOX_WITH_GUEST_PROPS
677 if (u64Cmd & USAGE_GUESTPROPERTY)
678 usageGuestProperty(pStrm);
679#endif /* VBOX_WITH_GUEST_PROPS defined */
680
681#ifdef VBOX_WITH_GUEST_CONTROL
682 if (u64Cmd & USAGE_GUESTCONTROL)
683 usageGuestControl(pStrm);
684#endif /* VBOX_WITH_GUEST_CONTROL defined */
685
686 if (u64Cmd & USAGE_METRICS)
687 {
688 RTStrmPrintf(pStrm,
689 "VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
690 " (comma-separated)\n\n"
691 "VBoxManage metrics setup\n"
692 " [--period <seconds>] (default: 1)\n"
693 " [--samples <count>] (default: 1)\n"
694 " [--list]\n"
695 " [*|host|<vmname> [<metric_list>]]\n\n"
696 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
697 "VBoxManage metrics enable\n"
698 " [--list]\n"
699 " [*|host|<vmname> [<metric_list>]]\n\n"
700 "VBoxManage metrics disable\n"
701 " [--list]\n"
702 " [*|host|<vmname> [<metric_list>]]\n\n"
703 "VBoxManage metrics collect\n"
704 " [--period <seconds>] (default: 1)\n"
705 " [--samples <count>] (default: 1)\n"
706 " [--list]\n"
707 " [--detach]\n"
708 " [*|host|<vmname> [<metric_list>]]\n"
709 "\n");
710 }
711#if defined(VBOX_WITH_NETFLT)
712 if (u64Cmd & USAGE_HOSTONLYIFS)
713 {
714 RTStrmPrintf(pStrm,
715 "VBoxManage hostonlyif ipconfig <name>\n"
716 " [--dhcp |\n"
717 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
718 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
719# if defined(RT_OS_WINDOWS)
720 " create |\n"
721 " remove <name>\n"
722# endif
723 "\n");
724 }
725#endif
726
727 if (u64Cmd & USAGE_DHCPSERVER)
728 {
729 RTStrmPrintf(pStrm,
730 "VBoxManage dhcpserver add|modify --netname <network_name> |\n"
731#if defined(VBOX_WITH_NETFLT)
732 " --ifname <hostonly_if_name>\n"
733#endif
734 " [--ip <ip_address>\n"
735 " --netmask <network_mask>\n"
736 " --lowerip <lower_ip>\n"
737 " --upperip <upper_ip>]\n"
738 " [--enable | --disable]\n\n"
739 "VBoxManage dhcpserver remove --netname <network_name> |\n"
740#if defined(VBOX_WITH_NETFLT)
741 " --ifname <hostonly_if_name>\n"
742#endif
743 "\n");
744 }
745}
746
747/**
748 * Print a usage synopsis and the syntax error message.
749 */
750int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
751{
752 va_list args;
753 showLogo(g_pStdErr); // show logo even if suppressed
754#ifndef VBOX_ONLY_DOCS
755 if (g_fInternalMode)
756 printUsageInternal(u64Cmd, g_pStdErr);
757 else
758 printUsage(u64Cmd, g_pStdErr);
759#endif /* !VBOX_ONLY_DOCS */
760 va_start(args, pszFormat);
761 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
762 va_end(args);
763 return 1;
764}
765
766/**
767 * errorSyntax for RTGetOpt users.
768 *
769 * @returns 1.
770 *
771 * @param fUsageCategory The usage category of the command.
772 * @param rc The RTGetOpt return code.
773 * @param pValueUnion The value union.
774 */
775int errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
776{
777 showLogo(g_pStdErr); // show logo even if suppressed
778#ifndef VBOX_ONLY_DOCS
779 if (g_fInternalMode)
780 printUsageInternal(fUsageCategory, g_pStdErr);
781 else
782 printUsage(fUsageCategory, g_pStdErr);
783#endif /* !VBOX_ONLY_DOCS */
784
785 if (rc == VINF_GETOPT_NOT_OPTION)
786 return RTMsgError("Invalid parameter '%s'", pValueUnion->psz);
787 if (rc > 0)
788 {
789 if (RT_C_IS_PRINT(rc))
790 return RTMsgError("Invalid option -%c", rc);
791 return RTMsgError("Invalid option case %i", rc);
792 }
793 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
794 return RTMsgError("Unknown option: %s", pValueUnion->psz);
795 if (pValueUnion->pDef)
796 return RTMsgError("%s: %Rrs", pValueUnion->pDef->pszLong, rc);
797 return RTMsgError("%Rrs", rc);
798}
799
800/**
801 * Print an error message without the syntax stuff.
802 */
803int errorArgument(const char *pszFormat, ...)
804{
805 va_list args;
806 va_start(args, pszFormat);
807 RTMsgErrorV(pszFormat, args);
808 va_end(args);
809 return 1;
810}
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