VirtualBox

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

Last change on this file since 49190 was 49190, checked in by vboxsync, 11 years ago

Main,VBoxManage: Implement hotpluggable setting stubs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 46.8 KB
Line 
1/* $Id: VBoxManageHelp.cpp 49190 2013-10-18 15:26:52Z vboxsync $ */
2/** @file
3 * VBoxManage - help and other message output.
4 */
5
6/*
7 * Copyright (C) 2006-2013 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 [<general option>] <command>\n"
102 " \n \n"
103 "General Options:\n \n"
104 " [-v|--version] print version number and exit\n"
105 " [-q|--nologo] suppress the logo\n"
106 " [--settingspw <pw>] provide the settings password\n"
107 " [--settingspwfile <file>] provide a file containing the settings password\n"
108 " \n \n"
109 "Commands:\n \n");
110
111 const char *pcszSep1 = " ";
112 const char *pcszSep2 = " ";
113 if (u64Cmd != USAGE_ALL)
114 {
115 pcszSep1 = "VBoxManage";
116 pcszSep2 = "";
117 }
118
119#define SEP pcszSep1, pcszSep2
120
121 if (u64Cmd & USAGE_LIST)
122 RTStrmPrintf(pStrm,
123 "%s list [--long|-l]%s vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
124#if defined(VBOX_WITH_NETFLT)
125 " intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|\n"
126#else
127 " intnets|bridgedifs|natnets|dhcpservers|hostinfo|\n"
128#endif
129 " hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|\n"
130 " usbhost|usbfilters|systemproperties|extpacks|\n"
131 " groups|webcams\n"
132 "\n", SEP);
133
134 if (u64Cmd & USAGE_SHOWVMINFO)
135 RTStrmPrintf(pStrm,
136 "%s showvminfo %s <uuid|vmname> [--details]\n"
137 " [--machinereadable]\n"
138 "%s showvminfo %s <uuid|vmname> --log <idx>\n"
139 "\n", SEP, SEP);
140
141 if (u64Cmd & USAGE_REGISTERVM)
142 RTStrmPrintf(pStrm,
143 "%s registervm %s <filename>\n"
144 "\n", SEP);
145
146 if (u64Cmd & USAGE_UNREGISTERVM)
147 RTStrmPrintf(pStrm,
148 "%s unregistervm %s <uuid|vmname> [--delete]\n"
149 "\n", SEP);
150
151 if (u64Cmd & USAGE_CREATEVM)
152 RTStrmPrintf(pStrm,
153 "%s createvm %s --name <name>\n"
154 " [--groups <group>, ...]\n"
155 " [--ostype <ostype>]\n"
156 " [--register]\n"
157 " [--basefolder <path>]\n"
158 " [--uuid <uuid>]\n"
159 "\n", SEP);
160
161 if (u64Cmd & USAGE_MODIFYVM)
162 {
163 RTStrmPrintf(pStrm,
164 "%s modifyvm %s <uuid|vmname>\n"
165 " [--name <name>]\n"
166 " [--groups <group>, ...]\n"
167 " [--ostype <ostype>]\n"
168 " [--iconfile <filename>]\n"
169 " [--memory <memorysize in MB>]\n"
170 " [--pagefusion on|off]\n"
171 " [--vram <vramsize in MB>]\n"
172 " [--acpi on|off]\n"
173#ifdef VBOX_WITH_PCI_PASSTHROUGH
174 " [--pciattach 03:04.0]\n"
175 " [--pciattach 03:04.0@02:01.0]\n"
176 " [--pcidetach 03:04.0]\n"
177#endif
178 " [--ioapic on|off]\n"
179 " [--hpet on|off]\n"
180 " [--triplefaultreset on|off]\n"
181 " [--hwvirtex on|off]\n"
182 " [--nestedpaging on|off]\n"
183 " [--largepages on|off]\n"
184 " [--vtxvpid on|off]\n"
185 " [--vtxux on|off]\n"
186 " [--pae on|off]\n"
187 " [--longmode on|off]\n"
188 " [--synthcpu on|off]\n"
189 " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
190 " [--cpuidremove <leaf>]\n"
191 " [--cpuidremoveall]\n"
192 " [--hardwareuuid <uuid>]\n"
193 " [--cpus <number>]\n"
194 " [--cpuhotplug on|off]\n"
195 " [--plugcpu <id>]\n"
196 " [--unplugcpu <id>]\n"
197 " [--cpuexecutioncap <1-100>]\n"
198 " [--rtcuseutc on|off]\n"
199 " [--graphicscontroller none|vboxvga]\n"
200 " [--monitorcount <number>]\n"
201 " [--accelerate3d on|off]\n"
202#ifdef VBOX_WITH_VIDEOHWACCEL
203 " [--accelerate2dvideo on|off]\n"
204#endif
205 " [--firmware bios|efi|efi32|efi64]\n"
206 " [--chipset ich9|piix3]\n"
207 " [--bioslogofadein on|off]\n"
208 " [--bioslogofadeout on|off]\n"
209 " [--bioslogodisplaytime <msec>]\n"
210 " [--bioslogoimagepath <imagepath>]\n"
211 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
212 " [--biossystemtimeoffset <msec>]\n"
213 " [--biospxedebug on|off]\n"
214 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
215 " [--nic<1-N> none|null|nat|bridged|intnet"
216#if defined(VBOX_WITH_NETFLT)
217 "|hostonly"
218#endif
219 "|\n"
220 " generic|natnetwork"
221 "]\n"
222 " [--nictype<1-N> Am79C970A|Am79C973"
223#ifdef VBOX_WITH_E1000
224 "|\n 82540EM|82543GC|82545EM"
225#endif
226#ifdef VBOX_WITH_VIRTIO
227 "|\n virtio"
228#endif /* VBOX_WITH_VIRTIO */
229 "]\n"
230 " [--cableconnected<1-N> on|off]\n"
231 " [--nictrace<1-N> on|off]\n"
232 " [--nictracefile<1-N> <filename>]\n"
233 " [--nicproperty<1-N> name=[value]]\n"
234 " [--nicspeed<1-N> <kbps>]\n"
235 " [--nicbootprio<1-N> <priority>]\n"
236 " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
237 " [--nicbandwidthgroup<1-N> none|<name>]\n"
238 " [--bridgeadapter<1-N> none|<devicename>]\n"
239#if defined(VBOX_WITH_NETFLT)
240 " [--hostonlyadapter<1-N> none|<devicename>]\n"
241#endif
242 " [--intnet<1-N> <network name>]\n"
243 " [--nat-network<1-N> <network name>]\n"
244 " [--nicgenericdrv<1-N> <driver>\n"
245 " [--natnet<1-N> <network>|default]\n"
246 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
247 " [<sockrcv>],[<tcpsnd>],\n"
248 " [<tcprcv>]]\n"
249 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
250 " <hostport>,[<guestip>],<guestport>]\n"
251 " [--natpf<1-N> delete <rulename>]\n"
252 " [--nattftpprefix<1-N> <prefix>]\n"
253 " [--nattftpfile<1-N> <file>]\n"
254 " [--nattftpserver<1-N> <ip>]\n"
255 " [--natbindip<1-N> <ip>\n"
256 " [--natdnspassdomain<1-N> on|off]\n"
257 " [--natdnsproxy<1-N> on|off]\n"
258 " [--natdnshostresolver<1-N> on|off]\n"
259 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
260 " [sameports]]\n"
261 " [--macaddress<1-N> auto|<mac>]\n"
262 " [--mouse ps2|usb|usbtablet|usbmultitouch]\n"
263 " [--keyboard ps2|usb\n"
264 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
265 " [--uartmode<1-N> disconnected|\n"
266 " server <pipe>|\n"
267 " client <pipe>|\n"
268 " file <file>|\n"
269 " <devicename>]\n"
270#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
271 " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
272 " [--lptmode<1-N> <devicename>]\n"
273#endif
274 " [--guestmemoryballoon <balloonsize in MB>]\n"
275 " [--audio none|null", SEP);
276 if (fWin)
277 {
278#ifdef VBOX_WITH_WINMM
279 RTStrmPrintf(pStrm, "|winmm|dsound");
280#else
281 RTStrmPrintf(pStrm, "|dsound");
282#endif
283 }
284 if (fSolaris)
285 {
286 RTStrmPrintf(pStrm, "|solaudio"
287#ifdef VBOX_WITH_SOLARIS_OSS
288 "|oss"
289#endif
290 );
291 }
292 if (fLinux)
293 {
294 RTStrmPrintf(pStrm, "|oss"
295#ifdef VBOX_WITH_ALSA
296 "|alsa"
297#endif
298#ifdef VBOX_WITH_PULSE
299 "|pulse"
300#endif
301 );
302 }
303 if (fFreeBSD)
304 {
305 /* Get the line break sorted when dumping all option variants. */
306 if (fDumpOpts)
307 {
308 RTStrmPrintf(pStrm, "|\n"
309 " oss");
310 }
311 else
312 RTStrmPrintf(pStrm, "|oss");
313#ifdef VBOX_WITH_PULSE
314 RTStrmPrintf(pStrm, "|pulse");
315#endif
316 }
317 if (fDarwin)
318 {
319 RTStrmPrintf(pStrm, "|coreaudio");
320 }
321 RTStrmPrintf(pStrm, "]\n");
322 RTStrmPrintf(pStrm,
323 " [--audiocontroller ac97|hda|sb16]\n"
324 " [--clipboard disabled|hosttoguest|guesttohost|\n"
325 " bidirectional]\n"
326 " [--draganddrop disabled|hosttoguest\n");
327 RTStrmPrintf(pStrm,
328 " [--vrde on|off]\n"
329 " [--vrdeextpack default|<name>\n"
330 " [--vrdeproperty <name=[value]>]\n"
331 " [--vrdeport <hostport>]\n"
332 " [--vrdeaddress <hostip>]\n"
333 " [--vrdeauthtype null|external|guest]\n"
334 " [--vrdeauthlibrary default|<name>\n"
335 " [--vrdemulticon on|off]\n"
336 " [--vrdereusecon on|off]\n"
337 " [--vrdevideochannel on|off]\n"
338 " [--vrdevideochannelquality <percent>]\n");
339 RTStrmPrintf(pStrm,
340 " [--usb on|off]\n"
341 " [--usbehci on|off]\n"
342 " [--snapshotfolder default|<path>]\n"
343 " [--teleporter on|off]\n"
344 " [--teleporterport <port>]\n"
345 " [--teleporteraddress <address|empty>\n"
346 " [--teleporterpassword <password>]\n"
347 " [--teleporterpasswordfile <file>|stdin]\n"
348 " [--tracing-enabled on|off]\n"
349 " [--tracing-config <config-string>]\n"
350 " [--tracing-allow-vm-access on|off]\n"
351#if 0
352 " [--iocache on|off]\n"
353 " [--iocachesize <I/O cache size in MB>]\n"
354#endif
355#if 0
356 " [--faulttolerance master|standby]\n"
357 " [--faulttoleranceaddress <name>]\n"
358 " [--faulttoleranceport <port>]\n"
359 " [--faulttolerancesyncinterval <msec>]\n"
360 " [--faulttolerancepassword <password>]\n"
361#endif
362#ifdef VBOX_WITH_USB_CARDREADER
363 " [--usbcardreader on|off]\n"
364#endif
365 " [--autostart-enabled on|off]\n"
366 " [--autostart-delay <seconds>]\n"
367#if 0 /* Disabled until the feature is implemented. */
368 " [--autostop-type disabled|savestate|poweroff|\n"
369 " acpishutdown]\n"
370#endif
371#ifdef VBOX_WITH_VPX
372 " [--vcpenabled on|off]\n"
373 " [--vcpscreens [<display>],...\n"
374 " [--vcpfile <filename>]\n"
375 " [--vcpwidth <width>]\n"
376 " [--vcpheight <height>]\n"
377 " [--vcprate <rate>]\n"
378 " [--vcpfps <fps>]\n"
379#endif
380 " [--defaultfrontend default|<name]\n"
381 "\n");
382 }
383
384 if (u64Cmd & USAGE_CLONEVM)
385 RTStrmPrintf(pStrm,
386 "%s clonevm %s <uuid|vmname>\n"
387 " [--snapshot <uuid>|<name>]\n"
388 " [--mode machine|machineandchildren|all]\n"
389 " [--options link|keepallmacs|keepnatmacs|\n"
390 " keepdisknames]\n"
391 " [--name <name>]\n"
392 " [--groups <group>, ...]\n"
393 " [--basefolder <basefolder>]\n"
394 " [--uuid <uuid>]\n"
395 " [--register]\n"
396 "\n", SEP);
397
398 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
399 RTStrmPrintf(pStrm,
400 "%s import %s <ovfname/ovaname>\n"
401 " [--dry-run|-n]\n"
402 " [--options keepallmacs|keepnatmacs]\n"
403 " [more options]\n"
404 " (run with -n to have options displayed\n"
405 " for a particular OVF)\n\n", SEP);
406
407 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
408 RTStrmPrintf(pStrm,
409 "%s export %s <machines> --output|-o <name>.<ovf/ova>\n"
410 " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
411 " [--manifest]\n"
412 " [--iso]\n"
413 " [--vsys <number of virtual system>]\n"
414 " [--product <product name>]\n"
415 " [--producturl <product url>]\n"
416 " [--vendor <vendor name>]\n"
417 " [--vendorurl <vendor url>]\n"
418 " [--version <version info>]\n"
419 " [--description <description info>]\n"
420 " [--eula <license text>]\n"
421 " [--eulafile <filename>]\n"
422 "\n", SEP);
423
424 if (u64Cmd & USAGE_STARTVM)
425 {
426 RTStrmPrintf(pStrm,
427 "%s startvm %s <uuid|vmname>...\n"
428 " [--type gui", SEP);
429 if (fVBoxSDL)
430 RTStrmPrintf(pStrm, "|sdl");
431 RTStrmPrintf(pStrm, "|headless]\n");
432 RTStrmPrintf(pStrm,
433 "\n");
434 }
435
436 if (u64Cmd & USAGE_CONTROLVM)
437 {
438 RTStrmPrintf(pStrm,
439 "%s controlvm %s <uuid|vmname>\n"
440 " pause|resume|reset|poweroff|savestate|\n"
441 " acpipowerbutton|acpisleepbutton|\n"
442 " keyboardputscancode <hex> [<hex> ...]|\n"
443 " setlinkstate<1-N> on|off |\n"
444#if defined(VBOX_WITH_NETFLT)
445 " nic<1-N> null|nat|bridged|intnet|hostonly|generic|\n"
446 " natnetwork [<devicename>] |\n"
447#else /* !VBOX_WITH_NETFLT */
448 " nic<1-N> null|nat|bridged|intnet|generic|natnetwork\n"
449 " [<devicename>] |\n"
450#endif /* !VBOX_WITH_NETFLT */
451 " nictrace<1-N> on|off |\n"
452 " nictracefile<1-N> <filename> |\n"
453 " nicproperty<1-N> name=[value] |\n"
454 " nicpromisc<1-N> deny|allow-vms|allow-all |\n"
455 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
456 " <hostport>,[<guestip>],<guestport> |\n"
457 " natpf<1-N> delete <rulename> |\n"
458 " guestmemoryballoon <balloonsize in MB> |\n"
459 " usbattach <uuid>|<address> |\n"
460 " usbdetach <uuid>|<address> |\n"
461 " clipboard disabled|hosttoguest|guesttohost|\n"
462 " bidirectional |\n"
463 " draganddrop disabled|hosttoguest |\n"
464 " vrde on|off |\n"
465 " vrdeport <port> |\n"
466 " vrdeproperty <name=[value]> |\n"
467 " vrdevideochannelquality <percent> |\n"
468 " setvideomodehint <xres> <yres> <bpp>\n"
469 " [[<display>] [<enabled:yes|no> |\n"
470 " [<xorigin> <yorigin>]]] |\n"
471 " screenshotpng <file> [display] |\n"
472 " vcpenabled on|off |\n"
473 " vcpscreens all|none|<screen>,[<screen>...] |\n"
474 " setcredentials <username>\n"
475 " --passwordfile <file> | <password>\n"
476 " <domain>\n"
477 " [--allowlocallogon <yes|no>] |\n"
478 " teleport --host <name> --port <port>\n"
479 " [--maxdowntime <msec>]\n"
480 " [--passwordfile <file> |\n"
481 " --password <password>] |\n"
482 " plugcpu <id> |\n"
483 " unplugcpu <id> |\n"
484 " cpuexecutioncap <1-100>\n"
485 " webcam <attach [path [settings]]> | <detach [path]> | <list>\n"
486 "\n", SEP);
487 }
488
489 if (u64Cmd & USAGE_DISCARDSTATE)
490 RTStrmPrintf(pStrm,
491 "%s discardstate %s <uuid|vmname>\n"
492 "\n", SEP);
493
494 if (u64Cmd & USAGE_ADOPTSTATE)
495 RTStrmPrintf(pStrm,
496 "%s adoptstate %s <uuid|vmname> <state_file>\n"
497 "\n", SEP);
498
499 if (u64Cmd & USAGE_SNAPSHOT)
500 RTStrmPrintf(pStrm,
501 "%s snapshot %s <uuid|vmname>\n"
502 " take <name> [--description <desc>] [--live] |\n"
503 " delete <uuid|snapname> |\n"
504 " restore <uuid|snapname> |\n"
505 " restorecurrent |\n"
506 " edit <uuid|snapname>|--current\n"
507 " [--name <name>]\n"
508 " [--description <desc>] |\n"
509 " list [--details|--machinereadable]\n"
510 " showvminfo <uuid|snapname>\n"
511 "\n", SEP);
512
513 if (u64Cmd & USAGE_CLOSEMEDIUM)
514 RTStrmPrintf(pStrm,
515 "%s closemedium %s disk|dvd|floppy <uuid|filename>\n"
516 " [--delete]\n"
517 "\n", SEP);
518
519 if (u64Cmd & USAGE_STORAGEATTACH)
520 RTStrmPrintf(pStrm,
521 "%s storageattach %s <uuid|vmname>\n"
522 " --storagectl <name>\n"
523 " [--port <number>]\n"
524 " [--device <number>]\n"
525 " [--type dvddrive|hdd|fdd]\n"
526 " [--medium none|emptydrive|additions|\n"
527 " <uuid|filename>|host:<drive>|iscsi]\n"
528 " [--mtype normal|writethrough|immutable|shareable|\n"
529 " readonly|multiattach]\n"
530 " [--comment <text>]\n"
531 " [--setuuid <uuid>]\n"
532 " [--setparentuuid <uuid>]\n"
533 " [--passthrough on|off]\n"
534 " [--tempeject on|off]\n"
535 " [--nonrotational on|off]\n"
536 " [--discard on|off]\n"
537 " [--hotpluggable on|off]\n"
538 " [--bandwidthgroup <name>]\n"
539 " [--forceunmount]\n"
540 " [--server <name>|<ip>]\n"
541 " [--target <target>]\n"
542 " [--tport <port>]\n"
543 " [--lun <lun>]\n"
544 " [--encodedlun <lun>]\n"
545 " [--username <username>]\n"
546 " [--password <password>]\n"
547 " [--initiator <initiator>]\n"
548 " [--intnet]\n"
549 "\n", SEP);
550
551 if (u64Cmd & USAGE_STORAGECONTROLLER)
552 RTStrmPrintf(pStrm,
553 "%s storagectl %s <uuid|vmname>\n"
554 " --name <name>\n"
555 " [--add ide|sata|scsi|floppy|sas]\n"
556 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
557 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
558 " [--portcount <1-n>]\n"
559 " [--hostiocache on|off]\n"
560 " [--bootable on|off]\n"
561 " [--remove]\n"
562 "\n", SEP);
563
564 if (u64Cmd & USAGE_BANDWIDTHCONTROL)
565 RTStrmPrintf(pStrm,
566 "%s bandwidthctl %s <uuid|vmname>\n"
567 " add <name> --type disk|network\n"
568 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
569 " set <name>\n"
570 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
571 " remove <name> |\n"
572 " list [--machinereadable]\n"
573 " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
574 " K=kilobyte, M=megabyte, G=gigabyte)\n"
575 "\n", SEP);
576
577 if (u64Cmd & USAGE_SHOWHDINFO)
578 RTStrmPrintf(pStrm,
579 "%s showhdinfo %s <uuid|filename>\n"
580 "\n", SEP);
581
582 if (u64Cmd & USAGE_CREATEHD)
583 RTStrmPrintf(pStrm,
584 "%s createhd %s --filename <filename>\n"
585 " [--size <megabytes>|--sizebyte <bytes>]\n"
586 " [--diffparent <uuid>|<filename>\n"
587 " [--format VDI|VMDK|VHD] (default: VDI)\n"
588 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
589 "\n", SEP);
590
591 if (u64Cmd & USAGE_MODIFYHD)
592 RTStrmPrintf(pStrm,
593 "%s modifyhd %s <uuid|filename>\n"
594 " [--type normal|writethrough|immutable|shareable|\n"
595 " readonly|multiattach]\n"
596 " [--autoreset on|off]\n"
597 " [--property <name=[value]>]\n"
598 " [--compact]\n"
599 " [--resize <megabytes>|--resizebyte <bytes>]\n"
600 "\n", SEP);
601
602 if (u64Cmd & USAGE_CLONEHD)
603 RTStrmPrintf(pStrm,
604 "%s clonehd %s <uuid|inputfile> <uuid|outputfile>\n"
605 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
606 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
607 " [--existing]\n"
608 "\n", SEP);
609
610 if (u64Cmd & USAGE_CONVERTFROMRAW)
611 RTStrmPrintf(pStrm,
612 "%s convertfromraw %s <filename> <outputfile>\n"
613 " [--format VDI|VMDK|VHD]\n"
614 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
615 " [--uuid <uuid>]\n"
616 "%s convertfromraw %s stdin <outputfile> <bytes>\n"
617 " [--format VDI|VMDK|VHD]\n"
618 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
619 " [--uuid <uuid>]\n"
620 "\n", SEP, SEP);
621
622 if (u64Cmd & USAGE_GETEXTRADATA)
623 RTStrmPrintf(pStrm,
624 "%s getextradata %s global|<uuid|vmname>\n"
625 " <key>|enumerate\n"
626 "\n", SEP);
627
628 if (u64Cmd & USAGE_SETEXTRADATA)
629 RTStrmPrintf(pStrm,
630 "%s setextradata %s global|<uuid|vmname>\n"
631 " <key>\n"
632 " [<value>] (no value deletes key)\n"
633 "\n", SEP);
634
635 if (u64Cmd & USAGE_SETPROPERTY)
636 RTStrmPrintf(pStrm,
637 "%s setproperty %s machinefolder default|<folder> |\n"
638 " hwvirtexclusive on|off |\n"
639 " vrdeauthlibrary default|<library> |\n"
640 " websrvauthlibrary default|null|<library> |\n"
641 " vrdeextpack null|<library> |\n"
642 " autostartdbpath null|<folder> |\n"
643 " loghistorycount <value>\n"
644 " defaultfrontend default|<name>\n"
645 "\n", SEP);
646
647 if (u64Cmd & USAGE_USBFILTER_ADD)
648 RTStrmPrintf(pStrm,
649 "%s usbfilter %s add <index,0-N>\n"
650 " --target <uuid|vmname>|global\n"
651 " --name <string>\n"
652 " --action ignore|hold (global filters only)\n"
653 " [--active yes|no] (yes)\n"
654 " [--vendorid <XXXX>] (null)\n"
655 " [--productid <XXXX>] (null)\n"
656 " [--revision <IIFF>] (null)\n"
657 " [--manufacturer <string>] (null)\n"
658 " [--product <string>] (null)\n"
659 " [--remote yes|no] (null, VM filters only)\n"
660 " [--serialnumber <string>] (null)\n"
661 " [--maskedinterfaces <XXXXXXXX>]\n"
662 "\n", SEP);
663
664 if (u64Cmd & USAGE_USBFILTER_MODIFY)
665 RTStrmPrintf(pStrm,
666 "%s usbfilter %s modify <index,0-N>\n"
667 " --target <uuid|vmname>|global\n"
668 " [--name <string>]\n"
669 " [--action ignore|hold] (global filters only)\n"
670 " [--active yes|no]\n"
671 " [--vendorid <XXXX>|\"\"]\n"
672 " [--productid <XXXX>|\"\"]\n"
673 " [--revision <IIFF>|\"\"]\n"
674 " [--manufacturer <string>|\"\"]\n"
675 " [--product <string>|\"\"]\n"
676 " [--remote yes|no] (null, VM filters only)\n"
677 " [--serialnumber <string>|\"\"]\n"
678 " [--maskedinterfaces <XXXXXXXX>]\n"
679 "\n", SEP);
680
681 if (u64Cmd & USAGE_USBFILTER_REMOVE)
682 RTStrmPrintf(pStrm,
683 "%s usbfilter %s remove <index,0-N>\n"
684 " --target <uuid|vmname>|global\n"
685 "\n", SEP);
686
687 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
688 RTStrmPrintf(pStrm,
689 "%s sharedfolder %s add <uuid|vmname>\n"
690 " --name <name> --hostpath <hostpath>\n"
691 " [--transient] [--readonly] [--automount]\n"
692 "\n", SEP);
693
694 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
695 RTStrmPrintf(pStrm,
696 "%s sharedfolder %s remove <uuid|vmname>\n"
697 " --name <name> [--transient]\n"
698 "\n", SEP);
699
700#ifdef VBOX_WITH_GUEST_PROPS
701 if (u64Cmd & USAGE_GUESTPROPERTY)
702 usageGuestProperty(pStrm, SEP);
703#endif /* VBOX_WITH_GUEST_PROPS defined */
704
705#ifdef VBOX_WITH_GUEST_CONTROL
706 if (u64Cmd & USAGE_GUESTCONTROL)
707 usageGuestControl(pStrm, SEP);
708#endif /* VBOX_WITH_GUEST_CONTROL defined */
709
710 if (u64Cmd & USAGE_DEBUGVM)
711 {
712 RTStrmPrintf(pStrm,
713 "%s debugvm %s <uuid|vmname>\n"
714 " dumpguestcore --filename <name> |\n"
715 " info <item> [args] |\n"
716 " injectnmi |\n"
717 " log [--release|--debug] <settings> ...|\n"
718 " logdest [--release|--debug] <settings> ...|\n"
719 " logflags [--release|--debug] <settings> ...|\n"
720 " osdetect |\n"
721 " osinfo |\n"
722 " getregisters [--cpu <id>] <reg>|all ... |\n"
723 " setregisters [--cpu <id>] <reg>=<value> ... |\n"
724 " show [--human-readable|--sh-export|--sh-eval|\n"
725 " --cmd-set] \n"
726 " <logdbg-settings|logrel-settings>\n"
727 " [[opt] what ...] |\n"
728 " statistics [--reset] [--pattern <pattern>]\n"
729 " [--descriptions]\n"
730 "\n", SEP);
731 }
732 if (u64Cmd & USAGE_METRICS)
733 RTStrmPrintf(pStrm,
734 "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
735 " (comma-separated)\n\n"
736 "%s metrics %s setup\n"
737 " [--period <seconds>] (default: 1)\n"
738 " [--samples <count>] (default: 1)\n"
739 " [--list]\n"
740 " [*|host|<vmname> [<metric_list>]]\n\n"
741 "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
742 "%s metrics %s enable\n"
743 " [--list]\n"
744 " [*|host|<vmname> [<metric_list>]]\n\n"
745 "%s metrics %s disable\n"
746 " [--list]\n"
747 " [*|host|<vmname> [<metric_list>]]\n\n"
748 "%s metrics %s collect\n"
749 " [--period <seconds>] (default: 1)\n"
750 " [--samples <count>] (default: 1)\n"
751 " [--list]\n"
752 " [--detach]\n"
753 " [*|host|<vmname> [<metric_list>]]\n"
754 "\n", SEP, SEP, SEP, SEP, SEP, SEP);
755
756#if defined(VBOX_WITH_NAT_SERVICE)
757 if (u64Cmd & USAGE_NATNETWORK)
758 {
759 RTStrmPrintf(pStrm,
760 "%s natnetwork %s add --netname <name>\n"
761 " --network <network\n"
762 " [--enable|--disable]\n"
763 " [--dhcp on|off]\n"
764 " [--port-forward-4 <rule>]\n"
765 " [--loopback-4 <rule>]\n"
766 " [--ipv6 on|off]\n"
767 " [--port-forward-6 <rule>]\n"
768 " [--loopback-6 <rule>]\n\n"
769 "%s natnetwork %s remove --netname <name>\n\n"
770 "%s natnetwork %s modify --netname <name>\n"
771 " [--network <network]\n"
772 " [--enable|--disable]\n"
773 " [--dhcp on|off]\n"
774 " [--port-forward-4 <rule>]\n"
775 " [--loopback-4 <rule>]\n"
776 " [--ipv6 on|off]\n"
777 " [--port-forward-6 <rule>]\n"
778 " [--loopback-6 <rule>]\n\n"
779 "%s natnetwork %s start --netname <name>\n\n"
780 "%s natnetwork %s stop --netname <name>\n"
781 "\n", SEP, SEP, SEP, SEP, SEP);
782
783
784 }
785#endif
786
787#if defined(VBOX_WITH_NETFLT)
788 if (u64Cmd & USAGE_HOSTONLYIFS)
789 {
790 RTStrmPrintf(pStrm,
791 "%s hostonlyif %s ipconfig <name>\n"
792 " [--dhcp |\n"
793 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
794 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
795# if !defined(RT_OS_SOLARIS)
796 " create |\n"
797 " remove <name>\n"
798# endif
799 "\n", SEP);
800 }
801#endif
802
803 if (u64Cmd & USAGE_DHCPSERVER)
804 {
805 RTStrmPrintf(pStrm,
806 "%s dhcpserver %s add|modify --netname <network_name> |\n"
807#if defined(VBOX_WITH_NETFLT)
808 " --ifname <hostonly_if_name>\n"
809#endif
810 " [--ip <ip_address>\n"
811 " --netmask <network_mask>\n"
812 " --lowerip <lower_ip>\n"
813 " --upperip <upper_ip>]\n"
814 " [--enable | --disable]\n\n"
815 "%s dhcpserver %s remove --netname <network_name> |\n"
816#if defined(VBOX_WITH_NETFLT)
817 " --ifname <hostonly_if_name>\n"
818#endif
819 "\n", SEP, SEP);
820 }
821 if (u64Cmd & USAGE_EXTPACK)
822 {
823 RTStrmPrintf(pStrm,
824 "%s extpack %s install [--replace] <tarball> |\n"
825 " uninstall [--force] <name> |\n"
826 " cleanup\n"
827 "\n", SEP);
828 }
829}
830
831/**
832 * Print a usage synopsis and the syntax error message.
833 * @returns RTEXITCODE_SYNTAX.
834 */
835RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
836{
837 va_list args;
838 showLogo(g_pStdErr); // show logo even if suppressed
839#ifndef VBOX_ONLY_DOCS
840 if (g_fInternalMode)
841 printUsageInternal(u64Cmd, g_pStdErr);
842 else
843 printUsage(u64Cmd, g_pStdErr);
844#endif /* !VBOX_ONLY_DOCS */
845 va_start(args, pszFormat);
846 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
847 va_end(args);
848 return RTEXITCODE_SYNTAX;
849}
850
851/**
852 * errorSyntax for RTGetOpt users.
853 *
854 * @returns RTEXITCODE_SYNTAX.
855 *
856 * @param fUsageCategory The usage category of the command.
857 * @param rc The RTGetOpt return code.
858 * @param pValueUnion The value union.
859 */
860RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
861{
862 /*
863 * Check if it is an unhandled standard option.
864 */
865 if (rc == 'V')
866 {
867 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
868 return RTEXITCODE_SUCCESS;
869 }
870
871 if (rc == 'h')
872 {
873 showLogo(g_pStdErr);
874#ifndef VBOX_ONLY_DOCS
875 if (g_fInternalMode)
876 printUsageInternal(fUsageCategory, g_pStdOut);
877 else
878 printUsage(fUsageCategory, g_pStdOut);
879#endif
880 return RTEXITCODE_SUCCESS;
881 }
882
883 /*
884 * General failure.
885 */
886 showLogo(g_pStdErr); // show logo even if suppressed
887#ifndef VBOX_ONLY_DOCS
888 if (g_fInternalMode)
889 printUsageInternal(fUsageCategory, g_pStdErr);
890 else
891 printUsage(fUsageCategory, g_pStdErr);
892#endif /* !VBOX_ONLY_DOCS */
893
894 if (rc == VINF_GETOPT_NOT_OPTION)
895 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
896 if (rc > 0)
897 {
898 if (RT_C_IS_PRINT(rc))
899 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
900 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
901 }
902 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
903 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
904 if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
905 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
906 if (pValueUnion->pDef)
907 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
908 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
909}
910
911/**
912 * Print an error message without the syntax stuff.
913 *
914 * @returns RTEXITCODE_SYNTAX.
915 */
916RTEXITCODE errorArgument(const char *pszFormat, ...)
917{
918 va_list args;
919 va_start(args, pszFormat);
920 RTMsgErrorV(pszFormat, args);
921 va_end(args);
922 return RTEXITCODE_SYNTAX;
923}
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