VirtualBox

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

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

VBoxManage: undocument obsolete setproperty hdfolder

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