VirtualBox

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

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

Main/NetworkAdapter: Bandwidth group attribute implementation (#5582)

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