VirtualBox

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

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

Main,Config.kmk,VBoxManage,ExtPacks: Moved the VRDE bits from IVirtualBox to the extension packs; changed ISystemProperties and IVRDEServer to talk about VRDE extension packs instead of VRDE libraries.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.8 KB
Line 
1/* $Id: VBoxManageHelp.cpp 34244 2010-11-22 14:31:02Z 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 " 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 " [--vrdeextpack 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 " [--bootable on|off]\n"
481 " [--remove]\n"
482 "\n");
483 }
484
485 if (u64Cmd & USAGE_SHOWHDINFO)
486 {
487 RTStrmPrintf(pStrm,
488 "VBoxManage showhdinfo <uuid>|<filename>\n"
489 "\n");
490 }
491
492 if (u64Cmd & USAGE_CREATEHD)
493 {
494 RTStrmPrintf(pStrm,
495 "VBoxManage createhd --filename <filename>\n"
496 " --size <megabytes>|--sizebyte <bytes>\n"
497 " [--format VDI|VMDK|VHD] (default: VDI)\n"
498 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
499 " [--type normal|writethrough|\n"
500 " shareable] (default: normal)\n"
501 " [--comment <comment>]\n"
502 " [--remember]\n"
503 "\n");
504 }
505
506 if (u64Cmd & USAGE_MODIFYHD)
507 {
508 RTStrmPrintf(pStrm,
509 "VBoxManage modifyhd <uuid>|<filename>\n"
510 " [--type normal|writethrough|immutable|shareable]\n"
511 " [--autoreset on|off]\n"
512 " [--compact]\n"
513 " [--resize <megabytes>]\n"
514 "\n");
515 }
516
517 if (u64Cmd & USAGE_CLONEHD)
518 {
519 RTStrmPrintf(pStrm,
520 "VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
521 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
522 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
523 " [--type normal|writethrough|immutable|shareable]\n"
524 " [--remember] [--existing]\n"
525 "\n");
526 }
527
528 if (u64Cmd & USAGE_CONVERTFROMRAW)
529 {
530 RTStrmPrintf(pStrm,
531 "VBoxManage convertfromraw <filename> <outputfile>\n"
532 " [--format VDI|VMDK|VHD]\n"
533 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
534#ifndef RT_OS_WINDOWS
535 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
536 " [--format VDI|VMDK|VHD]\n"
537 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
538#endif
539 "\n");
540 }
541
542 if (u64Cmd & USAGE_ADDISCSIDISK)
543 {
544 RTStrmPrintf(pStrm,
545 "VBoxManage addiscsidisk --server <name>|<ip>\n"
546 " --target <target>\n"
547 " [--port <port>]\n"
548 " [--lun <lun>]\n"
549 " [--encodedlun <lun>]\n"
550 " [--username <username>]\n"
551 " [--password <password>]\n"
552 " [--type normal|writethrough|immutable|shareable]\n"
553 " [--intnet]\n"
554 "\n");
555 }
556
557 if (u64Cmd & USAGE_GETEXTRADATA)
558 {
559 RTStrmPrintf(pStrm,
560 "VBoxManage getextradata global|<uuid>|<name>\n"
561 " <key>|enumerate\n"
562 "\n");
563 }
564
565 if (u64Cmd & USAGE_SETEXTRADATA)
566 {
567 RTStrmPrintf(pStrm,
568 "VBoxManage setextradata global|<uuid>|<name>\n"
569 " <key>\n"
570 " [<value>] (no value deletes key)\n"
571 "\n");
572 }
573
574 if (u64Cmd & USAGE_SETPROPERTY)
575 {
576 RTStrmPrintf(pStrm,
577 "VBoxManage setproperty hdfolder default|<folder> |\n"
578 " machinefolder default|<folder> |\n"
579 " vrdeauthlibrary default|<library> |\n"
580 " websrvauthlibrary default|null|<library> |\n"
581 " vrdeextpack null|<library> |\n"
582 " loghistorycount <value>\n"
583 "\n");
584 }
585
586 if (u64Cmd & USAGE_USBFILTER_ADD)
587 {
588 RTStrmPrintf(pStrm,
589 "VBoxManage usbfilter add <index,0-N>\n"
590 " --target <uuid>|<name>|global\n"
591 " --name <string>\n"
592 " --action ignore|hold (global filters only)\n"
593 " [--active yes|no] (yes)\n"
594 " [--vendorid <XXXX>] (null)\n"
595 " [--productid <XXXX>] (null)\n"
596 " [--revision <IIFF>] (null)\n"
597 " [--manufacturer <string>] (null)\n"
598 " [--product <string>] (null)\n"
599 " [--remote yes|no] (null, VM filters only)\n"
600 " [--serialnumber <string>] (null)\n"
601 " [--maskedinterfaces <XXXXXXXX>]\n"
602 "\n");
603 }
604
605 if (u64Cmd & USAGE_USBFILTER_MODIFY)
606 {
607 RTStrmPrintf(pStrm,
608 "VBoxManage usbfilter modify <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]\n"
613 " [--vendorid <XXXX>|\"\"]\n"
614 " [--productid <XXXX>|\"\"]\n"
615 " [--revision <IIFF>|\"\"]\n"
616 " [--manufacturer <string>|\"\"]\n"
617 " [--product <string>|\"\"]\n"
618 " [--remote yes|no] (null, VM filters only)\n"
619 " [--serialnumber <string>|\"\"]\n"
620 " [--maskedinterfaces <XXXXXXXX>]\n"
621 "\n");
622 }
623
624 if (u64Cmd & USAGE_USBFILTER_REMOVE)
625 {
626 RTStrmPrintf(pStrm,
627 "VBoxManage usbfilter remove <index,0-N>\n"
628 " --target <uuid>|<name>|global\n"
629 "\n");
630 }
631
632 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
633 {
634 RTStrmPrintf(pStrm,
635 "VBoxManage sharedfolder add <vmname>|<uuid>\n"
636 " --name <name> --hostpath <hostpath>\n"
637 " [--transient] [--readonly] [--automount]\n"
638 "\n");
639 }
640
641 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
642 {
643 RTStrmPrintf(pStrm,
644 "VBoxManage sharedfolder remove <vmname>|<uuid>\n"
645 " --name <name> [--transient]\n"
646 "\n");
647 }
648
649 if (u64Cmd & USAGE_VM_STATISTICS)
650 {
651 RTStrmPrintf(pStrm,
652 "VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
653 " [--pattern <pattern>] [--descriptions]\n"
654 "\n");
655 }
656
657#ifdef VBOX_WITH_GUEST_PROPS
658 if (u64Cmd & USAGE_GUESTPROPERTY)
659 usageGuestProperty(pStrm);
660#endif /* VBOX_WITH_GUEST_PROPS defined */
661
662#ifdef VBOX_WITH_GUEST_CONTROL
663 if (u64Cmd & USAGE_GUESTCONTROL)
664 usageGuestControl(pStrm);
665#endif /* VBOX_WITH_GUEST_CONTROL defined */
666
667 if (u64Cmd & USAGE_METRICS)
668 {
669 RTStrmPrintf(pStrm,
670 "VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
671 " (comma-separated)\n\n"
672 "VBoxManage metrics setup\n"
673 " [--period <seconds>] (default: 1)\n"
674 " [--samples <count>] (default: 1)\n"
675 " [--list]\n"
676 " [*|host|<vmname> [<metric_list>]]\n\n"
677 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
678 "VBoxManage metrics enable\n"
679 " [--list]\n"
680 " [*|host|<vmname> [<metric_list>]]\n\n"
681 "VBoxManage metrics disable\n"
682 " [--list]\n"
683 " [*|host|<vmname> [<metric_list>]]\n\n"
684 "VBoxManage metrics collect\n"
685 " [--period <seconds>] (default: 1)\n"
686 " [--samples <count>] (default: 1)\n"
687 " [--list]\n"
688 " [--detach]\n"
689 " [*|host|<vmname> [<metric_list>]]\n"
690 "\n");
691 }
692#if defined(VBOX_WITH_NETFLT)
693 if (u64Cmd & USAGE_HOSTONLYIFS)
694 {
695 RTStrmPrintf(pStrm,
696 "VBoxManage hostonlyif ipconfig <name>\n"
697 " [--dhcp |\n"
698 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
699 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
700# if defined(RT_OS_WINDOWS)
701 " create |\n"
702 " remove <name>\n"
703# endif
704 "\n");
705 }
706#endif
707
708 if (u64Cmd & USAGE_DHCPSERVER)
709 {
710 RTStrmPrintf(pStrm,
711 "VBoxManage dhcpserver add|modify --netname <network_name> |\n"
712#if defined(VBOX_WITH_NETFLT)
713 " --ifname <hostonly_if_name>\n"
714#endif
715 " [--ip <ip_address>\n"
716 " --netmask <network_mask>\n"
717 " --lowerip <lower_ip>\n"
718 " --upperip <upper_ip>]\n"
719 " [--enable | --disable]\n\n"
720 "VBoxManage dhcpserver remove --netname <network_name> |\n"
721#if defined(VBOX_WITH_NETFLT)
722 " --ifname <hostonly_if_name>\n"
723#endif
724 "\n");
725 }
726 if (u64Cmd & USAGE_EXTPACK)
727 {
728 RTStrmPrintf(pStrm,
729 "VBoxManage extpack install <tarball>\n"
730 "VBoxManage extpack uninstall [--force] <name>\n"
731 "VBoxManage extpack cleanup\n"
732 "\n");
733 }
734}
735
736/**
737 * Print a usage synopsis and the syntax error message.
738 * @returns RTEXITCODE_SYNTAX.
739 */
740RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
741{
742 va_list args;
743 showLogo(g_pStdErr); // show logo even if suppressed
744#ifndef VBOX_ONLY_DOCS
745 if (g_fInternalMode)
746 printUsageInternal(u64Cmd, g_pStdErr);
747 else
748 printUsage(u64Cmd, g_pStdErr);
749#endif /* !VBOX_ONLY_DOCS */
750 va_start(args, pszFormat);
751 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
752 va_end(args);
753 return RTEXITCODE_SYNTAX;
754}
755
756/**
757 * errorSyntax for RTGetOpt users.
758 *
759 * @returns RTEXITCODE_SYNTAX.
760 *
761 * @param fUsageCategory The usage category of the command.
762 * @param rc The RTGetOpt return code.
763 * @param pValueUnion The value union.
764 */
765RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
766{
767 showLogo(g_pStdErr); // show logo even if suppressed
768#ifndef VBOX_ONLY_DOCS
769 if (g_fInternalMode)
770 printUsageInternal(fUsageCategory, g_pStdErr);
771 else
772 printUsage(fUsageCategory, g_pStdErr);
773#endif /* !VBOX_ONLY_DOCS */
774
775 if (rc == VINF_GETOPT_NOT_OPTION)
776 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
777 if (rc > 0)
778 {
779 if (RT_C_IS_PRINT(rc))
780 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
781 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
782 }
783 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
784 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
785 if (pValueUnion->pDef)
786 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
787 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
788}
789
790/**
791 * Print an error message without the syntax stuff.
792 *
793 * @returns RTEXITCODE_SYNTAX.
794 */
795RTEXITCODE errorArgument(const char *pszFormat, ...)
796{
797 va_list args;
798 va_start(args, pszFormat);
799 RTMsgErrorV(pszFormat, args);
800 va_end(args);
801 return RTEXITCODE_SYNTAX;
802}
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