VirtualBox

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

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

VBoxManage: merge the broken addiscsidisk into storageattach

  • 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 34634 2010-12-02 17:21:40Z 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 " [--passthrough on|off]\n"
442 " [--bandwidthgroup <name>]\n"
443 " [--forceunmount]\n"
444 " [--server <name>|<ip>]\n"
445 " [--target <target>]\n"
446 " [--port <port>]\n"
447 " [--lun <lun>]\n"
448 " [--encodedlun <lun>]\n"
449 " [--username <username>]\n"
450 " [--password <password>]\n"
451 " [--intnet]\n"
452 "\n");
453
454 if (u64Cmd & USAGE_STORAGECONTROLLER)
455 RTStrmPrintf(pStrm,
456 "VBoxManage storagectl <uuid|vmname>\n"
457 " --name <name>\n"
458 " [--add ide|sata|scsi|floppy|sas]\n"
459 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
460 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
461 " [--sataideemulation<1-4> <1-30>]\n"
462 " [--sataportcount <1-30>]\n"
463 " [--hostiocache on|off]\n"
464 " [--bootable on|off]\n"
465 " [--remove]\n"
466 "\n");
467
468 if (u64Cmd & USAGE_BANDWIDTHCONTROL)
469 RTStrmPrintf(pStrm,
470 "VBoxManage bandwidthctl <uuid|vmname>\n"
471 " --name <name>\n"
472 " [--add disk|network]\n"
473 " [--limit <megabytes per second>\n"
474 " [--delete]\n"
475 "\n");
476
477 if (u64Cmd & USAGE_SHOWHDINFO)
478 RTStrmPrintf(pStrm,
479 "VBoxManage showhdinfo <uuid>|<filename>\n"
480 "\n");
481
482 if (u64Cmd & USAGE_CREATEHD)
483 RTStrmPrintf(pStrm,
484 "VBoxManage createhd --filename <filename>\n"
485 " --size <megabytes>|--sizebyte <bytes>\n"
486 " [--format VDI|VMDK|VHD] (default: VDI)\n"
487 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
488 "\n");
489
490 if (u64Cmd & USAGE_MODIFYHD)
491 RTStrmPrintf(pStrm,
492 "VBoxManage modifyhd <uuid>|<filename>\n"
493 " [--type normal|writethrough|immutable|shareable]\n"
494 " [--autoreset on|off]\n"
495 " [--compact]\n"
496 " [--resize <megabytes>]\n"
497 "\n");
498
499 if (u64Cmd & USAGE_CLONEHD)
500 RTStrmPrintf(pStrm,
501 "VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
502 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
503 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
504 " [--type normal|writethrough|immutable|shareable]\n"
505 " [--remember] [--existing]\n"
506 "\n");
507
508 if (u64Cmd & USAGE_CONVERTFROMRAW)
509 RTStrmPrintf(pStrm,
510 "VBoxManage convertfromraw <filename> <outputfile>\n"
511 " [--format VDI|VMDK|VHD]\n"
512 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
513#ifndef RT_OS_WINDOWS
514 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
515 " [--format VDI|VMDK|VHD]\n"
516 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
517#endif
518 "\n");
519
520 if (u64Cmd & USAGE_GETEXTRADATA)
521 RTStrmPrintf(pStrm,
522 "VBoxManage getextradata global|<uuid>|<name>\n"
523 " <key>|enumerate\n"
524 "\n");
525
526 if (u64Cmd & USAGE_SETEXTRADATA)
527 RTStrmPrintf(pStrm,
528 "VBoxManage setextradata global|<uuid>|<name>\n"
529 " <key>\n"
530 " [<value>] (no value deletes key)\n"
531 "\n");
532
533 if (u64Cmd & USAGE_SETPROPERTY)
534 RTStrmPrintf(pStrm,
535 "VBoxManage setproperty machinefolder default|<folder> |\n"
536 " vrdeauthlibrary default|<library> |\n"
537 " websrvauthlibrary default|null|<library> |\n"
538 " vrdeextpack null|<library> |\n"
539 " loghistorycount <value>\n"
540 "\n");
541
542 if (u64Cmd & USAGE_USBFILTER_ADD)
543 RTStrmPrintf(pStrm,
544 "VBoxManage usbfilter add <index,0-N>\n"
545 " --target <uuid>|<name>|global\n"
546 " --name <string>\n"
547 " --action ignore|hold (global filters only)\n"
548 " [--active yes|no] (yes)\n"
549 " [--vendorid <XXXX>] (null)\n"
550 " [--productid <XXXX>] (null)\n"
551 " [--revision <IIFF>] (null)\n"
552 " [--manufacturer <string>] (null)\n"
553 " [--product <string>] (null)\n"
554 " [--remote yes|no] (null, VM filters only)\n"
555 " [--serialnumber <string>] (null)\n"
556 " [--maskedinterfaces <XXXXXXXX>]\n"
557 "\n");
558
559 if (u64Cmd & USAGE_USBFILTER_MODIFY)
560 RTStrmPrintf(pStrm,
561 "VBoxManage usbfilter modify <index,0-N>\n"
562 " --target <uuid>|<name>|global\n"
563 " [--name <string>]\n"
564 " [--action ignore|hold] (global filters only)\n"
565 " [--active yes|no]\n"
566 " [--vendorid <XXXX>|\"\"]\n"
567 " [--productid <XXXX>|\"\"]\n"
568 " [--revision <IIFF>|\"\"]\n"
569 " [--manufacturer <string>|\"\"]\n"
570 " [--product <string>|\"\"]\n"
571 " [--remote yes|no] (null, VM filters only)\n"
572 " [--serialnumber <string>|\"\"]\n"
573 " [--maskedinterfaces <XXXXXXXX>]\n"
574 "\n");
575
576 if (u64Cmd & USAGE_USBFILTER_REMOVE)
577 RTStrmPrintf(pStrm,
578 "VBoxManage usbfilter remove <index,0-N>\n"
579 " --target <uuid>|<name>|global\n"
580 "\n");
581
582 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
583 RTStrmPrintf(pStrm,
584 "VBoxManage sharedfolder add <vmname>|<uuid>\n"
585 " --name <name> --hostpath <hostpath>\n"
586 " [--transient] [--readonly] [--automount]\n"
587 "\n");
588
589 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
590 RTStrmPrintf(pStrm,
591 "VBoxManage sharedfolder remove <vmname>|<uuid>\n"
592 " --name <name> [--transient]\n"
593 "\n");
594
595 if (u64Cmd & USAGE_VM_STATISTICS)
596 RTStrmPrintf(pStrm,
597 "VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
598 " [--pattern <pattern>] [--descriptions]\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_METRICS)
612 RTStrmPrintf(pStrm,
613 "VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
614 " (comma-separated)\n\n"
615 "VBoxManage metrics setup\n"
616 " [--period <seconds>] (default: 1)\n"
617 " [--samples <count>] (default: 1)\n"
618 " [--list]\n"
619 " [*|host|<vmname> [<metric_list>]]\n\n"
620 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
621 "VBoxManage metrics enable\n"
622 " [--list]\n"
623 " [*|host|<vmname> [<metric_list>]]\n\n"
624 "VBoxManage metrics disable\n"
625 " [--list]\n"
626 " [*|host|<vmname> [<metric_list>]]\n\n"
627 "VBoxManage metrics collect\n"
628 " [--period <seconds>] (default: 1)\n"
629 " [--samples <count>] (default: 1)\n"
630 " [--list]\n"
631 " [--detach]\n"
632 " [*|host|<vmname> [<metric_list>]]\n"
633 "\n");
634
635#if defined(VBOX_WITH_NETFLT)
636 if (u64Cmd & USAGE_HOSTONLYIFS)
637 {
638 RTStrmPrintf(pStrm,
639 "VBoxManage hostonlyif ipconfig <name>\n"
640 " [--dhcp |\n"
641 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
642 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
643# if defined(RT_OS_WINDOWS)
644 " create |\n"
645 " remove <name>\n"
646# endif
647 "\n");
648 }
649#endif
650
651 if (u64Cmd & USAGE_DHCPSERVER)
652 {
653 RTStrmPrintf(pStrm,
654 "VBoxManage dhcpserver add|modify --netname <network_name> |\n"
655#if defined(VBOX_WITH_NETFLT)
656 " --ifname <hostonly_if_name>\n"
657#endif
658 " [--ip <ip_address>\n"
659 " --netmask <network_mask>\n"
660 " --lowerip <lower_ip>\n"
661 " --upperip <upper_ip>]\n"
662 " [--enable | --disable]\n\n"
663 "VBoxManage dhcpserver remove --netname <network_name> |\n"
664#if defined(VBOX_WITH_NETFLT)
665 " --ifname <hostonly_if_name>\n"
666#endif
667 "\n");
668 }
669 if (u64Cmd & USAGE_EXTPACK)
670 {
671 RTStrmPrintf(pStrm,
672 "VBoxManage extpack install <tarball>\n"
673 "VBoxManage extpack uninstall [--force] <name>\n"
674 "VBoxManage extpack cleanup\n"
675 "\n");
676 }
677}
678
679/**
680 * Print a usage synopsis and the syntax error message.
681 * @returns RTEXITCODE_SYNTAX.
682 */
683RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
684{
685 va_list args;
686 showLogo(g_pStdErr); // show logo even if suppressed
687#ifndef VBOX_ONLY_DOCS
688 if (g_fInternalMode)
689 printUsageInternal(u64Cmd, g_pStdErr);
690 else
691 printUsage(u64Cmd, g_pStdErr);
692#endif /* !VBOX_ONLY_DOCS */
693 va_start(args, pszFormat);
694 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
695 va_end(args);
696 return RTEXITCODE_SYNTAX;
697}
698
699/**
700 * errorSyntax for RTGetOpt users.
701 *
702 * @returns RTEXITCODE_SYNTAX.
703 *
704 * @param fUsageCategory The usage category of the command.
705 * @param rc The RTGetOpt return code.
706 * @param pValueUnion The value union.
707 */
708RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
709{
710 showLogo(g_pStdErr); // show logo even if suppressed
711#ifndef VBOX_ONLY_DOCS
712 if (g_fInternalMode)
713 printUsageInternal(fUsageCategory, g_pStdErr);
714 else
715 printUsage(fUsageCategory, g_pStdErr);
716#endif /* !VBOX_ONLY_DOCS */
717
718 if (rc == VINF_GETOPT_NOT_OPTION)
719 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
720 if (rc > 0)
721 {
722 if (RT_C_IS_PRINT(rc))
723 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
724 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
725 }
726 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
727 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
728 if (pValueUnion->pDef)
729 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
730 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
731}
732
733/**
734 * Print an error message without the syntax stuff.
735 *
736 * @returns RTEXITCODE_SYNTAX.
737 */
738RTEXITCODE errorArgument(const char *pszFormat, ...)
739{
740 va_list args;
741 va_start(args, pszFormat);
742 RTMsgErrorV(pszFormat, args);
743 va_end(args);
744 return RTEXITCODE_SYNTAX;
745}
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