VirtualBox

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

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

VBoxManage: move vmstatistics to debugvm as a 'statistics' sub-command. Remove injectnmi completely from controlvm - the audience of this features is tiny but smart, so no need for compatibility stuff.

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