VirtualBox

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

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

VBoxManage: add support for readonly/multiattach media types

  • 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 35085 2010-12-14 14:09:12Z 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] [--statistics]\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 " [--bridgeadapter<1-N> none|<devicename>]\n"
210#if defined(VBOX_WITH_NETFLT)
211 " [--hostonlyadapter<1-N> none|<devicename>]\n"
212#endif
213 " [--intnet<1-N> <network name>]\n"
214 " [--natnet<1-N> <network>|default]\n"
215#ifdef VBOX_WITH_VDE
216 " [--vdenet<1-N> <network>|default]\n"
217#endif
218 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
219 " [<sockrcv>],[<tcpsnd>],\n"
220 " [<tcprcv>]]\n"
221 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
222 " <hostport>,[<guestip>],<guestport>]\n"
223 " [--natpf<1-N> delete <rulename>]\n"
224 " [--nattftpprefix<1-N> <prefix>]\n"
225 " [--nattftpfile<1-N> <file>]\n"
226 " [--nattftpserver<1-N> <ip>]\n"
227 " [--natdnspassdomain<1-N> on|off]\n"
228 " [--natdnsproxy<1-N> on|off]\n"
229 " [--natdnshostresolver<1-N> on|off]\n"
230 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
231 " [sameports]]\n"
232 " [--macaddress<1-N> auto|<mac>]\n"
233 " [--mouse ps2|usb|usbtablet\n"
234 " [--keyboard ps2|usb\n"
235 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
236 " [--uartmode<1-N> disconnected|\n"
237 " server <pipe>|\n"
238 " client <pipe>|\n"
239 " file <file>|\n"
240 " <devicename>]\n"
241 " [--guestmemoryballoon <balloonsize in MB>]\n"
242 " [--gueststatisticsinterval <seconds>]\n"
243 " [--audio none|null");
244 if (fWin)
245 {
246#ifdef VBOX_WITH_WINMM
247 RTStrmPrintf(pStrm, "|winmm|dsound");
248#else
249 RTStrmPrintf(pStrm, "|dsound");
250#endif
251 }
252 if (fSolaris)
253 {
254 RTStrmPrintf(pStrm, "|solaudio"
255#ifdef VBOX_WITH_SOLARIS_OSS
256 "|oss"
257#endif
258 );
259 }
260 if (fLinux)
261 {
262 RTStrmPrintf(pStrm, "|oss"
263#ifdef VBOX_WITH_ALSA
264 "|alsa"
265#endif
266#ifdef VBOX_WITH_PULSE
267 "|pulse"
268#endif
269 );
270 }
271 if (fFreeBSD)
272 {
273 /* Get the line break sorted when dumping all option variants. */
274 if (fDumpOpts)
275 {
276 RTStrmPrintf(pStrm, "|\n"
277 " oss");
278 }
279 else
280 RTStrmPrintf(pStrm, "|oss");
281#ifdef VBOX_WITH_PULSE
282 RTStrmPrintf(pStrm, "|pulse");
283#endif
284 }
285 if (fDarwin)
286 {
287 RTStrmPrintf(pStrm, "|coreaudio");
288 }
289 RTStrmPrintf(pStrm, "]\n");
290 RTStrmPrintf(pStrm,
291 " [--audiocontroller ac97|hda|sb16]\n"
292 " [--clipboard disabled|hosttoguest|guesttohost|\n"
293 " bidirectional]\n");
294 RTStrmPrintf(pStrm,
295 " [--vrde on|off]\n"
296 " [--vrdeextpack default|<name>\n"
297 " [--vrdeproperty <name=[value]>]\n"
298 " [--vrdeauthtype null|external|guest]\n"
299 " [--vrdeauthlibrary default|<name>\n"
300 " [--vrdemulticon on|off]\n"
301 " [--vrdereusecon on|off]\n"
302 " [--vrdevideochannel on|off]\n"
303 " [--vrdevideochannelquality <percent>]\n");
304 RTStrmPrintf(pStrm,
305 " [--usb on|off]\n"
306 " [--usbehci on|off]\n"
307 " [--snapshotfolder default|<path>]\n"
308 " [--teleporter on|off]\n"
309 " [--teleporterport <port>]\n"
310 " [--teleporteraddress <address|empty>\n"
311 " [--teleporterpassword <password>]\n"
312#if 0
313 " [--iocache on|off]\n"
314 " [--iocachesize <I/O cache size in MB>]\n"
315#endif
316#if 0
317 " [--faulttolerance master|standby]\n"
318 " [--faulttoleranceaddress <name>]\n"
319 " [--faulttoleranceport <port>]\n"
320 " [--faulttolerancesyncinterval <msec>]\n"
321 " [--faulttolerancepassword <password>]\n"
322#endif
323 "\n");
324 }
325
326 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
327 RTStrmPrintf(pStrm,
328 "VBoxManage import <ovf/ova> [--dry-run|-n] [more options]\n"
329 " (run with -n to have options displayed\n"
330 " for a particular OVF)\n\n");
331
332 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
333 RTStrmPrintf(pStrm,
334 "VBoxManage export <machines> --output|-o <ovf/ova>\n"
335 " [--legacy09]\n"
336 " [--manifest]\n"
337 " [--vsys <number of virtual system>]\n"
338 " [--product <product name>]\n"
339 " [--producturl <product url>]\n"
340 " [--vendor <vendor name>]\n"
341 " [--vendorurl <vendor url>]\n"
342 " [--version <version info>]\n"
343 " [--eula <license text>]\n"
344 " [--eulafile <filename>]\n"
345 "\n");
346
347 if (u64Cmd & USAGE_STARTVM)
348 {
349 RTStrmPrintf(pStrm,
350 "VBoxManage startvm <uuid>|<name>\n");
351 RTStrmPrintf(pStrm,
352 " [--type gui");
353 if (fVBoxSDL)
354 RTStrmPrintf(pStrm, "|sdl");
355 RTStrmPrintf(pStrm, "|headless]\n");
356 RTStrmPrintf(pStrm,
357 "\n");
358 }
359
360 if (u64Cmd & USAGE_CONTROLVM)
361 {
362 RTStrmPrintf(pStrm,
363 "VBoxManage controlvm <uuid>|<name>\n"
364 " pause|resume|reset|poweroff|savestate|\n"
365 " acpipowerbutton|acpisleepbutton|\n"
366 " keyboardputscancode <hex> [<hex> ...]|\n"
367 " setlinkstate<1-N> on|off |\n"
368#if defined(VBOX_WITH_NETFLT)
369 " nic<1-N> null|nat|bridged|intnet|hostonly\n"
370 " [<devicename>] |\n"
371#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
372 " nic<1-N> null|nat|bridged|intnet\n"
373 " [<devicename>] |\n"
374#endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
375 " nictrace<1-N> on|off\n"
376 " nictracefile<1-N> <filename>\n"
377 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
378 " <hostport>,[<guestip>],<guestport>\n"
379 " natpf<1-N> delete <rulename>\n"
380 " guestmemoryballoon <balloonsize in MB>]\n"
381 " gueststatisticsinterval <seconds>]\n"
382 " usbattach <uuid>|<address> |\n"
383 " usbdetach <uuid>|<address> |\n");
384 RTStrmPrintf(pStrm,
385 " vrde on|off |\n");
386 RTStrmPrintf(pStrm,
387 " vrdeproperty <name=[value]> |\n"
388 " vrdevideochannelquality <percent>\n");
389 RTStrmPrintf(pStrm,
390 " setvideomodehint <xres> <yres> <bpp> [display] |\n"
391 " setcredentials <username> <password> <domain>\n"
392 " [--allowlocallogon <yes|no>] |\n"
393 " teleport --host <name> --port <port>\n"
394 " [--maxdowntime <msec>] [--password password]\n"
395 " plugcpu <id>\n"
396 " unplugcpu <id>\n"
397 " cpuexecutioncap <1-100>\n"
398 "\n");
399 }
400
401 if (u64Cmd & USAGE_DISCARDSTATE)
402 RTStrmPrintf(pStrm,
403 "VBoxManage discardstate <uuid>|<name>\n"
404 "\n");
405
406 if (u64Cmd & USAGE_ADOPTSTATE)
407 RTStrmPrintf(pStrm,
408 "VBoxManage adoptstate <uuid>|<name> <state_file>\n"
409 "\n");
410
411 if (u64Cmd & USAGE_SNAPSHOT)
412 RTStrmPrintf(pStrm,
413 "VBoxManage snapshot <uuid>|<name>\n"
414 " take <name> [--description <desc>] [--pause] |\n"
415 " delete <uuid>|<name> |\n"
416 " restore <uuid>|<name> |\n"
417 " restorecurrent |\n"
418 " edit <uuid>|<name>|--current\n"
419 " [--name <name>]\n"
420 " [--description <desc>] |\n"
421 " showvminfo <uuid>|<name>\n"
422 "\n");
423
424 if (u64Cmd & USAGE_CLOSEMEDIUM)
425 RTStrmPrintf(pStrm,
426 "VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
427 " [--delete]\n"
428 "\n");
429
430 if (u64Cmd & USAGE_STORAGEATTACH)
431 RTStrmPrintf(pStrm,
432 "VBoxManage storageattach <uuid|vmname>\n"
433 " --storagectl <name>\n"
434 " --port <number>\n"
435 " --device <number>\n"
436 " [--type dvddrive|hdd|fdd]\n"
437 " [--medium none|emptydrive|\n"
438 " <uuid>|<filename>|host:<drive>|iscsi]\n"
439 " [--mtype normal|writethrough|immutable|shareable|\n"
440 " readonly|multiattach]\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 " readonly|multiattach]\n"
496 " [--autoreset on|off]\n"
497 " [--compact]\n"
498 " [--resize <megabytes>|--resizebyte <bytes>]\n"
499 "\n");
500
501 if (u64Cmd & USAGE_CLONEHD)
502 RTStrmPrintf(pStrm,
503 "VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
504 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
505 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
506 " [--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>]\n"
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 " uninstall [--force] <name> |\n"
679 " 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