VirtualBox

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

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

Manual: document VBoxManage storageattach changes (and other storage updates)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.6 KB
Line 
1/* $Id: VBoxManageHelp.cpp 34663 2010-12-02 22:44:22Z 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 RTStrmPrintf(pStrm,
100 "VBoxManage [-v|--version] print version number and exit\n"
101 "VBoxManage [-q|--nologo] ... suppress the logo\n"
102 "\n");
103
104 if (u64Cmd & USAGE_LIST)
105 RTStrmPrintf(pStrm,
106 "VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
107#if defined(VBOX_WITH_NETFLT)
108 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
109#else
110 " bridgedifs|dhcpservers|hostinfo|\n"
111#endif
112 " hostcpuids|hddbackends|hdds|dvds|floppies|\n"
113 " usbhost|usbfilters|systemproperties|\n"
114 " 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 " injectnmi|\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>]\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 if (u64Cmd & USAGE_VM_STATISTICS)
597 RTStrmPrintf(pStrm,
598 "VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
599 " [--pattern <pattern>] [--descriptions]\n"
600 "\n");
601
602#ifdef VBOX_WITH_GUEST_PROPS
603 if (u64Cmd & USAGE_GUESTPROPERTY)
604 usageGuestProperty(pStrm);
605#endif /* VBOX_WITH_GUEST_PROPS defined */
606
607#ifdef VBOX_WITH_GUEST_CONTROL
608 if (u64Cmd & USAGE_GUESTCONTROL)
609 usageGuestControl(pStrm);
610#endif /* VBOX_WITH_GUEST_CONTROL defined */
611
612 if (u64Cmd & USAGE_METRICS)
613 RTStrmPrintf(pStrm,
614 "VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
615 " (comma-separated)\n\n"
616 "VBoxManage metrics setup\n"
617 " [--period <seconds>] (default: 1)\n"
618 " [--samples <count>] (default: 1)\n"
619 " [--list]\n"
620 " [*|host|<vmname> [<metric_list>]]\n\n"
621 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
622 "VBoxManage metrics enable\n"
623 " [--list]\n"
624 " [*|host|<vmname> [<metric_list>]]\n\n"
625 "VBoxManage metrics disable\n"
626 " [--list]\n"
627 " [*|host|<vmname> [<metric_list>]]\n\n"
628 "VBoxManage metrics collect\n"
629 " [--period <seconds>] (default: 1)\n"
630 " [--samples <count>] (default: 1)\n"
631 " [--list]\n"
632 " [--detach]\n"
633 " [*|host|<vmname> [<metric_list>]]\n"
634 "\n");
635
636#if defined(VBOX_WITH_NETFLT)
637 if (u64Cmd & USAGE_HOSTONLYIFS)
638 {
639 RTStrmPrintf(pStrm,
640 "VBoxManage hostonlyif ipconfig <name>\n"
641 " [--dhcp |\n"
642 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
643 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
644# if defined(RT_OS_WINDOWS)
645 " create |\n"
646 " remove <name>\n"
647# endif
648 "\n");
649 }
650#endif
651
652 if (u64Cmd & USAGE_DHCPSERVER)
653 {
654 RTStrmPrintf(pStrm,
655 "VBoxManage dhcpserver add|modify --netname <network_name> |\n"
656#if defined(VBOX_WITH_NETFLT)
657 " --ifname <hostonly_if_name>\n"
658#endif
659 " [--ip <ip_address>\n"
660 " --netmask <network_mask>\n"
661 " --lowerip <lower_ip>\n"
662 " --upperip <upper_ip>]\n"
663 " [--enable | --disable]\n\n"
664 "VBoxManage dhcpserver remove --netname <network_name> |\n"
665#if defined(VBOX_WITH_NETFLT)
666 " --ifname <hostonly_if_name>\n"
667#endif
668 "\n");
669 }
670 if (u64Cmd & USAGE_EXTPACK)
671 {
672 RTStrmPrintf(pStrm,
673 "VBoxManage extpack install <tarball>\n"
674 "VBoxManage extpack uninstall [--force] <name>\n"
675 "VBoxManage extpack cleanup\n"
676 "\n");
677 }
678}
679
680/**
681 * Print a usage synopsis and the syntax error message.
682 * @returns RTEXITCODE_SYNTAX.
683 */
684RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
685{
686 va_list args;
687 showLogo(g_pStdErr); // show logo even if suppressed
688#ifndef VBOX_ONLY_DOCS
689 if (g_fInternalMode)
690 printUsageInternal(u64Cmd, g_pStdErr);
691 else
692 printUsage(u64Cmd, g_pStdErr);
693#endif /* !VBOX_ONLY_DOCS */
694 va_start(args, pszFormat);
695 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
696 va_end(args);
697 return RTEXITCODE_SYNTAX;
698}
699
700/**
701 * errorSyntax for RTGetOpt users.
702 *
703 * @returns RTEXITCODE_SYNTAX.
704 *
705 * @param fUsageCategory The usage category of the command.
706 * @param rc The RTGetOpt return code.
707 * @param pValueUnion The value union.
708 */
709RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
710{
711 showLogo(g_pStdErr); // show logo even if suppressed
712#ifndef VBOX_ONLY_DOCS
713 if (g_fInternalMode)
714 printUsageInternal(fUsageCategory, g_pStdErr);
715 else
716 printUsage(fUsageCategory, g_pStdErr);
717#endif /* !VBOX_ONLY_DOCS */
718
719 if (rc == VINF_GETOPT_NOT_OPTION)
720 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
721 if (rc > 0)
722 {
723 if (RT_C_IS_PRINT(rc))
724 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
725 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
726 }
727 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
728 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
729 if (pValueUnion->pDef)
730 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
731 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
732}
733
734/**
735 * Print an error message without the syntax stuff.
736 *
737 * @returns RTEXITCODE_SYNTAX.
738 */
739RTEXITCODE errorArgument(const char *pszFormat, ...)
740{
741 va_list args;
742 va_start(args, pszFormat);
743 RTMsgErrorV(pszFormat, args);
744 va_end(args);
745 return RTEXITCODE_SYNTAX;
746}
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