VirtualBox

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

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

Main,NAT: Managing port-forwarding at runtime. (xTracker/#4835).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.9 KB
Line 
1/* $Id: VBoxManageHelp.cpp 33825 2010-11-08 10:16:25Z 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_VBOXSDL
77 bool fVBoxSDL = true;
78#else
79 bool fVBoxSDL = false;
80#endif
81
82 if (u64Cmd == USAGE_DUMPOPTS)
83 {
84 fDumpOpts = true;
85 fLinux = true;
86 fWin = true;
87 fSolaris = true;
88 fFreeBSD = true;
89 fDarwin = true;
90 fVBoxSDL = true;
91 u64Cmd = USAGE_ALL;
92 }
93
94 RTStrmPrintf(pStrm,
95 "Usage:\n"
96 "\n");
97
98 if (u64Cmd == USAGE_ALL)
99 {
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
106 if (u64Cmd & USAGE_LIST)
107 {
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|\n"
117 " vrdelibraries|extpacks\n"
118 "\n");
119 }
120
121 if (u64Cmd & USAGE_SHOWVMINFO)
122 {
123 RTStrmPrintf(pStrm,
124 "VBoxManage showvminfo <uuid>|<name> [--details] [--statistics]\n"
125 " [--machinereadable]\n"
126 "VBoxManage showvminfo <uuid>|<name> --log <idx>\n"
127 "\n");
128 }
129
130 if (u64Cmd & USAGE_REGISTERVM)
131 {
132 RTStrmPrintf(pStrm,
133 "VBoxManage registervm <filename>\n"
134 "\n");
135 }
136
137 if (u64Cmd & USAGE_UNREGISTERVM)
138 {
139 RTStrmPrintf(pStrm,
140 "VBoxManage unregistervm <uuid>|<name> [--delete]\n"
141 "\n");
142 }
143
144 if (u64Cmd & USAGE_CREATEVM)
145 {
146 RTStrmPrintf(pStrm,
147 "VBoxManage createvm --name <name>\n"
148 " [--ostype <ostype>]\n"
149 " [--register]\n"
150 " [--basefolder <path> | --settingsfile <path>]\n"
151 " [--uuid <uuid>]\n"
152 "\n");
153 }
154
155 if (u64Cmd & USAGE_MODIFYVM)
156 {
157 RTStrmPrintf(pStrm,
158 "VBoxManage modifyvm <uuid|name>\n"
159 " [--name <name>]\n"
160 " [--ostype <ostype>]\n"
161 " [--memory <memorysize in MB>]\n"
162 " [--pagefusion on|off]\n"
163 " [--vram <vramsize in MB>]\n"
164 " [--acpi on|off]\n"
165 " [--ioapic on|off]\n"
166 " [--pae on|off]\n"
167 " [--hpet on|off]\n"
168 " [--hwvirtex on|off]\n"
169 " [--hwvirtexexcl on|off]\n"
170 " [--nestedpaging on|off]\n"
171 " [--largepages on|off]\n"
172 " [--vtxvpid on|off]\n"
173 " [--synthcpu on|off]\n"
174 " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
175 " [--cpuidremove <leaf>]\n"
176 " [--cpuidremoveall]\n"
177 " [--hardwareuuid <uuid>]\n"
178 " [--cpus <number>]\n"
179 " [--cpuhotplug on|off]\n"
180 " [--plugcpu <id>]\n"
181 " [--unplugcpu <id>]\n"
182 " [--cpuexecutioncap <1-100>]\n"
183 " [--rtcuseutc on|off]\n"
184 " [--monitorcount <number>]\n"
185 " [--accelerate3d on|off]\n"
186#ifdef VBOX_WITH_VIDEOHWACCEL
187 " [--accelerate2dvideo on|off]\n"
188#endif
189 " [--firmware bios|efi|efi32|efi64]\n"
190 " [--chipset ich9|piix3]\n"
191 " [--bioslogofadein on|off]\n"
192 " [--bioslogofadeout on|off]\n"
193 " [--bioslogodisplaytime <msec>]\n"
194 " [--bioslogoimagepath <imagepath>]\n"
195 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
196 " [--biossystemtimeoffset <msec>]\n"
197 " [--biospxedebug on|off]\n"
198 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
199 " [--nic<1-N> none|null|nat|bridged|intnet"
200#if defined(VBOX_WITH_NETFLT)
201 "|hostonly"
202#endif
203#ifdef VBOX_WITH_VDE
204 "|\n"
205 " vde"
206#endif
207 "]\n"
208 " [--nictype<1-N> Am79C970A|Am79C973"
209#ifdef VBOX_WITH_E1000
210 "|\n 82540EM|82543GC|82545EM"
211#endif
212#ifdef VBOX_WITH_VIRTIO
213 "|\n virtio"
214#endif /* VBOX_WITH_VIRTIO */
215 "]\n"
216 " [--cableconnected<1-N> on|off]\n"
217 " [--nictrace<1-N> on|off]\n"
218 " [--nictracefile<1-N> <filename>]\n"
219 " [--nicspeed<1-N> <kbps>]\n"
220 " [--nicbootprio<1-N> <priority>]\n"
221 " [--bridgeadapter<1-N> none|<devicename>]\n"
222#if defined(VBOX_WITH_NETFLT)
223 " [--hostonlyadapter<1-N> none|<devicename>]\n"
224#endif
225 " [--intnet<1-N> <network name>]\n"
226 " [--natnet<1-N> <network>|default]\n"
227#ifdef VBOX_WITH_VDE
228 " [--vdenet<1-N> <network>|default]\n"
229#endif
230 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
231 " [<sockrcv>],[<tcpsnd>],\n"
232 " [<tcprcv>]]\n"
233 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
234 " <hostport>,[<guestip>],<guestport>]\n"
235 " [--natpf<1-N> delete <rulename>]\n"
236 " [--nattftpprefix<1-N> <prefix>]\n"
237 " [--nattftpfile<1-N> <file>]\n"
238 " [--nattftpserver<1-N> <ip>]\n"
239 " [--natdnspassdomain<1-N> on|off]\n"
240 " [--natdnsproxy<1-N> on|off]\n"
241 " [--natdnshostresolver<1-N> on|off]\n"
242 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
243 " [sameports]]\n"
244 " [--macaddress<1-N> auto|<mac>]\n"
245 " [--mouse ps2|usb|usbtablet\n"
246 " [--keyboard ps2|usb\n"
247 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
248 " [--uartmode<1-N> disconnected|\n"
249 " server <pipe>|\n"
250 " client <pipe>|\n"
251 " file <file>|\n"
252 " <devicename>]\n"
253 " [--guestmemoryballoon <balloonsize in MB>]\n"
254 " [--gueststatisticsinterval <seconds>]\n"
255 " [--audio none|null");
256 if (fWin)
257 {
258#ifdef VBOX_WITH_WINMM
259 RTStrmPrintf(pStrm, "|winmm|dsound");
260#else
261 RTStrmPrintf(pStrm, "|dsound");
262#endif
263 }
264 if (fSolaris)
265 {
266 RTStrmPrintf(pStrm, "|solaudio"
267#ifdef VBOX_WITH_SOLARIS_OSS
268 "|oss"
269#endif
270 );
271 }
272 if (fLinux)
273 {
274 RTStrmPrintf(pStrm, "|oss"
275#ifdef VBOX_WITH_ALSA
276 "|alsa"
277#endif
278#ifdef VBOX_WITH_PULSE
279 "|pulse"
280#endif
281 );
282 }
283 if (fFreeBSD)
284 {
285 /* Get the line break sorted when dumping all option variants. */
286 if (fDumpOpts)
287 {
288 RTStrmPrintf(pStrm, "|\n"
289 " oss");
290 }
291 else
292 RTStrmPrintf(pStrm, "|oss");
293#ifdef VBOX_WITH_PULSE
294 RTStrmPrintf(pStrm, "|pulse");
295#endif
296 }
297 if (fDarwin)
298 {
299 RTStrmPrintf(pStrm, "|coreaudio");
300 }
301 RTStrmPrintf(pStrm, "]\n");
302 RTStrmPrintf(pStrm,
303 " [--audiocontroller ac97|hda|sb16]\n"
304 " [--clipboard disabled|hosttoguest|guesttohost|\n"
305 " bidirectional]\n");
306 RTStrmPrintf(pStrm,
307 " [--vrde on|off]\n"
308 " [--vrdelibrary default|<name>\n"
309 " [--vrdeproperty <name=[value]>]\n"
310 " [--vrdeauthtype null|external|guest]\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#if 0
324 " [--iocache on|off]\n"
325 " [--iocachesize <I/O cache size in MB>]\n"
326#endif
327#if 0
328 " [--faulttolerance master|standby]\n"
329 " [--faulttoleranceaddress <name>]\n"
330 " [--faulttoleranceport <port>]\n"
331 " [--faulttolerancesyncinterval <msec>]\n"
332 " [--faulttolerancepassword <password>]\n"
333#endif
334 "\n");
335 }
336
337 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
338 {
339 RTStrmPrintf(pStrm,
340 "VBoxManage import <ovf/ova> [--dry-run|-n] [more options]\n"
341 " (run with -n to have options displayed\n"
342 " for a particular OVF)\n\n");
343 }
344
345 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
346 {
347 RTStrmPrintf(pStrm,
348 "VBoxManage export <machines> --output|-o <ovf/ova>\n"
349 " [--legacy09]\n"
350 " [--manifest]\n"
351 " [--vsys <number of virtual system>]\n"
352 " [--product <product name>]\n"
353 " [--producturl <product url>]\n"
354 " [--vendor <vendor name>]\n"
355 " [--vendorurl <vendor url>]\n"
356 " [--version <version info>]\n"
357 " [--eula <license text>]\n"
358 " [--eulafile <filename>]\n"
359 "\n");
360 }
361
362 if (u64Cmd & USAGE_STARTVM)
363 {
364 RTStrmPrintf(pStrm,
365 "VBoxManage startvm <uuid>|<name>\n");
366 RTStrmPrintf(pStrm,
367 " [--type gui");
368 if (fVBoxSDL)
369 RTStrmPrintf(pStrm, "|sdl");
370 RTStrmPrintf(pStrm, "|headless]\n");
371 RTStrmPrintf(pStrm,
372 "\n");
373 }
374
375 if (u64Cmd & USAGE_CONTROLVM)
376 {
377 RTStrmPrintf(pStrm,
378 "VBoxManage controlvm <uuid>|<name>\n"
379 " pause|resume|reset|poweroff|savestate|\n"
380 " acpipowerbutton|acpisleepbutton|\n"
381 " keyboardputscancode <hex> [<hex> ...]|\n"
382 " injectnmi|\n"
383 " setlinkstate<1-N> on|off |\n"
384#if defined(VBOX_WITH_NETFLT)
385 " nic<1-N> null|nat|bridged|intnet|hostonly\n"
386 " [<devicename>] |\n"
387#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
388 " nic<1-N> null|nat|bridged|intnet\n"
389 " [<devicename>] |\n"
390#endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
391 " nictrace<1-N> on|off\n"
392 " nictracefile<1-N> <filename>\n"
393 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
394 " <hostport>,[<guestip>],<guestport>\n"
395 " natpf<1-N> delete <rulename>\n"
396 " guestmemoryballoon <balloonsize in MB>]\n"
397 " gueststatisticsinterval <seconds>]\n"
398 " usbattach <uuid>|<address> |\n"
399 " usbdetach <uuid>|<address> |\n");
400 RTStrmPrintf(pStrm,
401 " vrde on|off |\n");
402 RTStrmPrintf(pStrm,
403 " vrdeproperty <name=[value]> |\n"
404 " vrdevideochannelquality <percent>\n");
405 RTStrmPrintf(pStrm,
406 " setvideomodehint <xres> <yres> <bpp> [display] |\n"
407 " setcredentials <username> <password> <domain>\n"
408 " [--allowlocallogon <yes|no>] |\n"
409 " teleport --host <name> --port <port>\n"
410 " [--maxdowntime <msec>] [--password password]\n"
411 " plugcpu <id>\n"
412 " unplugcpu <id>\n"
413 " cpuexecutioncap <1-100>\n"
414 "\n");
415 }
416
417 if (u64Cmd & USAGE_DISCARDSTATE)
418 {
419 RTStrmPrintf(pStrm,
420 "VBoxManage discardstate <uuid>|<name>\n"
421 "\n");
422 }
423
424 if (u64Cmd & USAGE_ADOPTSTATE)
425 {
426 RTStrmPrintf(pStrm,
427 "VBoxManage adoptstate <uuid>|<name> <state_file>\n"
428 "\n");
429 }
430
431 if (u64Cmd & USAGE_SNAPSHOT)
432 {
433 RTStrmPrintf(pStrm,
434 "VBoxManage snapshot <uuid>|<name>\n"
435 " take <name> [--description <desc>] [--pause] |\n"
436 " delete <uuid>|<name> |\n"
437 " restore <uuid>|<name> |\n"
438 " restorecurrent |\n"
439 " edit <uuid>|<name>|--current\n"
440 " [--name <name>]\n"
441 " [--description <desc>] |\n"
442 " showvminfo <uuid>|<name>\n"
443 "\n");
444 }
445
446 if (u64Cmd & USAGE_CLOSEMEDIUM)
447 {
448 RTStrmPrintf(pStrm,
449 "VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
450 " [--delete]\n"
451 "\n");
452 }
453
454 if (u64Cmd & USAGE_STORAGEATTACH)
455 {
456 RTStrmPrintf(pStrm,
457 "VBoxManage storageattach <uuid|vmname>\n"
458 " --storagectl <name>\n"
459 " --port <number>\n"
460 " --device <number>\n"
461 " [--type dvddrive|hdd|fdd]\n"
462 " [--medium none|emptydrive|\n"
463 " <uuid>|<filename>|host:<drive>]\n"
464 " [--passthrough on|off]\n"
465 " [--forceunmount]\n"
466 "\n");
467 }
468
469 if (u64Cmd & USAGE_STORAGECONTROLLER)
470 {
471 RTStrmPrintf(pStrm,
472 "VBoxManage storagectl <uuid|vmname>\n"
473 " --name <name>\n"
474 " [--add ide|sata|scsi|floppy|sas]\n"
475 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
476 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
477 " [--sataideemulation<1-4> <1-30>]\n"
478 " [--sataportcount <1-30>]\n"
479 " [--hostiocache on|off]\n"
480 " [--remove]\n"
481 "\n");
482 }
483
484 if (u64Cmd & USAGE_SHOWHDINFO)
485 {
486 RTStrmPrintf(pStrm,
487 "VBoxManage showhdinfo <uuid>|<filename>\n"
488 "\n");
489 }
490
491 if (u64Cmd & USAGE_CREATEHD)
492 {
493 RTStrmPrintf(pStrm,
494 "VBoxManage createhd --filename <filename>\n"
495 " --size <megabytes>|--sizebyte <bytes>\n"
496 " [--format VDI|VMDK|VHD] (default: VDI)\n"
497 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
498 " [--type normal|writethrough|\n"
499 " shareable] (default: normal)\n"
500 " [--comment <comment>]\n"
501 " [--remember]\n"
502 "\n");
503 }
504
505 if (u64Cmd & USAGE_MODIFYHD)
506 {
507 RTStrmPrintf(pStrm,
508 "VBoxManage modifyhd <uuid>|<filename>\n"
509 " [--type normal|writethrough|immutable|shareable]\n"
510 " [--autoreset on|off]\n"
511 " [--compact]\n"
512 " [--resize <megabytes>]\n"
513 "\n");
514 }
515
516 if (u64Cmd & USAGE_CLONEHD)
517 {
518 RTStrmPrintf(pStrm,
519 "VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
520 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
521 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
522 " [--type normal|writethrough|immutable|shareable]\n"
523 " [--remember] [--existing]\n"
524 "\n");
525 }
526
527 if (u64Cmd & USAGE_CONVERTFROMRAW)
528 {
529 RTStrmPrintf(pStrm,
530 "VBoxManage convertfromraw <filename> <outputfile>\n"
531 " [--format VDI|VMDK|VHD]\n"
532 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
533#ifndef RT_OS_WINDOWS
534 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
535 " [--format VDI|VMDK|VHD]\n"
536 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
537#endif
538 "\n");
539 }
540
541 if (u64Cmd & USAGE_ADDISCSIDISK)
542 {
543 RTStrmPrintf(pStrm,
544 "VBoxManage addiscsidisk --server <name>|<ip>\n"
545 " --target <target>\n"
546 " [--port <port>]\n"
547 " [--lun <lun>]\n"
548 " [--encodedlun <lun>]\n"
549 " [--username <username>]\n"
550 " [--password <password>]\n"
551 " [--type normal|writethrough|immutable|shareable]\n"
552 " [--intnet]\n"
553 "\n");
554 }
555
556 if (u64Cmd & USAGE_GETEXTRADATA)
557 {
558 RTStrmPrintf(pStrm,
559 "VBoxManage getextradata global|<uuid>|<name>\n"
560 " <key>|enumerate\n"
561 "\n");
562 }
563
564 if (u64Cmd & USAGE_SETEXTRADATA)
565 {
566 RTStrmPrintf(pStrm,
567 "VBoxManage setextradata global|<uuid>|<name>\n"
568 " <key>\n"
569 " [<value>] (no value deletes key)\n"
570 "\n");
571 }
572
573 if (u64Cmd & USAGE_SETPROPERTY)
574 {
575 RTStrmPrintf(pStrm,
576 "VBoxManage setproperty hdfolder default|<folder> |\n"
577 " machinefolder default|<folder> |\n"
578 " vrdeauthlibrary default|<library> |\n"
579 " websrvauthlibrary default|null|<library> |\n"
580 " vrdelibrary null|<library> |\n"
581 " loghistorycount <value>\n"
582 "\n");
583 }
584
585 if (u64Cmd & USAGE_USBFILTER_ADD)
586 {
587 RTStrmPrintf(pStrm,
588 "VBoxManage usbfilter add <index,0-N>\n"
589 " --target <uuid>|<name>|global\n"
590 " --name <string>\n"
591 " --action ignore|hold (global filters only)\n"
592 " [--active yes|no] (yes)\n"
593 " [--vendorid <XXXX>] (null)\n"
594 " [--productid <XXXX>] (null)\n"
595 " [--revision <IIFF>] (null)\n"
596 " [--manufacturer <string>] (null)\n"
597 " [--product <string>] (null)\n"
598 " [--remote yes|no] (null, VM filters only)\n"
599 " [--serialnumber <string>] (null)\n"
600 " [--maskedinterfaces <XXXXXXXX>]\n"
601 "\n");
602 }
603
604 if (u64Cmd & USAGE_USBFILTER_MODIFY)
605 {
606 RTStrmPrintf(pStrm,
607 "VBoxManage usbfilter modify <index,0-N>\n"
608 " --target <uuid>|<name>|global\n"
609 " [--name <string>]\n"
610 " [--action ignore|hold] (global filters only)\n"
611 " [--active yes|no]\n"
612 " [--vendorid <XXXX>|\"\"]\n"
613 " [--productid <XXXX>|\"\"]\n"
614 " [--revision <IIFF>|\"\"]\n"
615 " [--manufacturer <string>|\"\"]\n"
616 " [--product <string>|\"\"]\n"
617 " [--remote yes|no] (null, VM filters only)\n"
618 " [--serialnumber <string>|\"\"]\n"
619 " [--maskedinterfaces <XXXXXXXX>]\n"
620 "\n");
621 }
622
623 if (u64Cmd & USAGE_USBFILTER_REMOVE)
624 {
625 RTStrmPrintf(pStrm,
626 "VBoxManage usbfilter remove <index,0-N>\n"
627 " --target <uuid>|<name>|global\n"
628 "\n");
629 }
630
631 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
632 {
633 RTStrmPrintf(pStrm,
634 "VBoxManage sharedfolder add <vmname>|<uuid>\n"
635 " --name <name> --hostpath <hostpath>\n"
636 " [--transient] [--readonly] [--automount]\n"
637 "\n");
638 }
639
640 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
641 {
642 RTStrmPrintf(pStrm,
643 "VBoxManage sharedfolder remove <vmname>|<uuid>\n"
644 " --name <name> [--transient]\n"
645 "\n");
646 }
647
648 if (u64Cmd & USAGE_VM_STATISTICS)
649 {
650 RTStrmPrintf(pStrm,
651 "VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
652 " [--pattern <pattern>] [--descriptions]\n"
653 "\n");
654 }
655
656#ifdef VBOX_WITH_GUEST_PROPS
657 if (u64Cmd & USAGE_GUESTPROPERTY)
658 usageGuestProperty(pStrm);
659#endif /* VBOX_WITH_GUEST_PROPS defined */
660
661#ifdef VBOX_WITH_GUEST_CONTROL
662 if (u64Cmd & USAGE_GUESTCONTROL)
663 usageGuestControl(pStrm);
664#endif /* VBOX_WITH_GUEST_CONTROL defined */
665
666 if (u64Cmd & USAGE_METRICS)
667 {
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_WINDOWS)
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_VRDE)
726 {
727 RTStrmPrintf(pStrm,
728 "VBoxManage vrde register <name>\n"
729 "VBoxManage vrde unregister <name>\n"
730 "\n");
731 }
732 if (u64Cmd & USAGE_EXTPACK)
733 {
734 RTStrmPrintf(pStrm,
735 "VBoxManage extpack install <tarball>\n"
736 "VBoxManage extpack uninstall [--force] <name>\n"
737 "\n");
738 }
739}
740
741/**
742 * Print a usage synopsis and the syntax error message.
743 * @returns RTEXITCODE_SYNTAX.
744 */
745RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
746{
747 va_list args;
748 showLogo(g_pStdErr); // show logo even if suppressed
749#ifndef VBOX_ONLY_DOCS
750 if (g_fInternalMode)
751 printUsageInternal(u64Cmd, g_pStdErr);
752 else
753 printUsage(u64Cmd, g_pStdErr);
754#endif /* !VBOX_ONLY_DOCS */
755 va_start(args, pszFormat);
756 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
757 va_end(args);
758 return RTEXITCODE_SYNTAX;
759}
760
761/**
762 * errorSyntax for RTGetOpt users.
763 *
764 * @returns RTEXITCODE_SYNTAX.
765 *
766 * @param fUsageCategory The usage category of the command.
767 * @param rc The RTGetOpt return code.
768 * @param pValueUnion The value union.
769 */
770RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
771{
772 showLogo(g_pStdErr); // show logo even if suppressed
773#ifndef VBOX_ONLY_DOCS
774 if (g_fInternalMode)
775 printUsageInternal(fUsageCategory, g_pStdErr);
776 else
777 printUsage(fUsageCategory, g_pStdErr);
778#endif /* !VBOX_ONLY_DOCS */
779
780 if (rc == VINF_GETOPT_NOT_OPTION)
781 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
782 if (rc > 0)
783 {
784 if (RT_C_IS_PRINT(rc))
785 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
786 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
787 }
788 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
789 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
790 if (pValueUnion->pDef)
791 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
792 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
793}
794
795/**
796 * Print an error message without the syntax stuff.
797 *
798 * @returns RTEXITCODE_SYNTAX.
799 */
800RTEXITCODE errorArgument(const char *pszFormat, ...)
801{
802 va_list args;
803 va_start(args, pszFormat);
804 RTMsgErrorV(pszFormat, args);
805 va_end(args);
806 return RTEXITCODE_SYNTAX;
807}
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