VirtualBox

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

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

Frontends/VBoxManage: add a way to set the VM icon

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.7 KB
Line 
1/* $Id: VBoxManageHelp.cpp 47918 2013-08-20 14:09:48Z 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 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
126#else
127 " bridgedifs|dhcpservers|hostinfo|\n"
128#endif
129 " hostcpuids|hddbackends|hdds|dvds|floppies|\n"
130 " usbhost|usbfilters|systemproperties|extpacks|\n"
131 " groups\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 " [--hwvirtex on|off]\n"
181 " [--hwvirtexexcl on|off]\n"
182 " [--nestedpaging on|off]\n"
183 " [--largepages on|off]\n"
184 " [--vtxvpid on|off]\n"
185 " [--pae on|off]\n"
186 " [--longmode on|off]\n"
187 " [--synthcpu on|off]\n"
188 " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
189 " [--cpuidremove <leaf>]\n"
190 " [--cpuidremoveall]\n"
191 " [--hardwareuuid <uuid>]\n"
192 " [--cpus <number>]\n"
193 " [--cpuhotplug on|off]\n"
194 " [--plugcpu <id>]\n"
195 " [--unplugcpu <id>]\n"
196 " [--cpuexecutioncap <1-100>]\n"
197 " [--rtcuseutc on|off]\n"
198 " [--graphicscontroller none|vboxvga]\n"
199 " [--monitorcount <number>]\n"
200 " [--accelerate3d on|off]\n"
201#ifdef VBOX_WITH_VIDEOHWACCEL
202 " [--accelerate2dvideo on|off]\n"
203#endif
204 " [--firmware bios|efi|efi32|efi64]\n"
205 " [--chipset ich9|piix3]\n"
206 " [--bioslogofadein on|off]\n"
207 " [--bioslogofadeout on|off]\n"
208 " [--bioslogodisplaytime <msec>]\n"
209 " [--bioslogoimagepath <imagepath>]\n"
210 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
211 " [--biossystemtimeoffset <msec>]\n"
212 " [--biospxedebug on|off]\n"
213 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
214 " [--nic<1-N> none|null|nat|bridged|intnet"
215#if defined(VBOX_WITH_NETFLT)
216 "|hostonly"
217#endif
218 "|\n"
219 " generic"
220 "]\n"
221 " [--nictype<1-N> Am79C970A|Am79C973"
222#ifdef VBOX_WITH_E1000
223 "|\n 82540EM|82543GC|82545EM"
224#endif
225#ifdef VBOX_WITH_VIRTIO
226 "|\n virtio"
227#endif /* VBOX_WITH_VIRTIO */
228 "]\n"
229 " [--cableconnected<1-N> on|off]\n"
230 " [--nictrace<1-N> on|off]\n"
231 " [--nictracefile<1-N> <filename>]\n"
232 " [--nicproperty<1-N> name=[value]]\n"
233 " [--nicspeed<1-N> <kbps>]\n"
234 " [--nicbootprio<1-N> <priority>]\n"
235 " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
236 " [--nicbandwidthgroup<1-N> none|<name>]\n"
237 " [--bridgeadapter<1-N> none|<devicename>]\n"
238#if defined(VBOX_WITH_NETFLT)
239 " [--hostonlyadapter<1-N> none|<devicename>]\n"
240#endif
241 " [--intnet<1-N> <network name>]\n"
242 " [--natnet<1-N> <network>|default]\n"
243 " [--nicgenericdrv<1-N> <driver>\n"
244 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
245 " [<sockrcv>],[<tcpsnd>],\n"
246 " [<tcprcv>]]\n"
247 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
248 " <hostport>,[<guestip>],<guestport>]\n"
249 " [--natpf<1-N> delete <rulename>]\n"
250 " [--nattftpprefix<1-N> <prefix>]\n"
251 " [--nattftpfile<1-N> <file>]\n"
252 " [--nattftpserver<1-N> <ip>]\n"
253 " [--natbindip<1-N> <ip>\n"
254 " [--natdnspassdomain<1-N> on|off]\n"
255 " [--natdnsproxy<1-N> on|off]\n"
256 " [--natdnshostresolver<1-N> on|off]\n"
257 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
258 " [sameports]]\n"
259 " [--macaddress<1-N> auto|<mac>]\n"
260 " [--mouse ps2|usb|usbtablet|usbmultitouch]\n"
261 " [--keyboard ps2|usb\n"
262 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
263 " [--uartmode<1-N> disconnected|\n"
264 " server <pipe>|\n"
265 " client <pipe>|\n"
266 " file <file>|\n"
267 " <devicename>]\n"
268#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
269 " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
270 " [--lptmode<1-N> <devicename>]\n"
271#endif
272 " [--guestmemoryballoon <balloonsize in MB>]\n"
273 " [--audio none|null", SEP);
274 if (fWin)
275 {
276#ifdef VBOX_WITH_WINMM
277 RTStrmPrintf(pStrm, "|winmm|dsound");
278#else
279 RTStrmPrintf(pStrm, "|dsound");
280#endif
281 }
282 if (fSolaris)
283 {
284 RTStrmPrintf(pStrm, "|solaudio"
285#ifdef VBOX_WITH_SOLARIS_OSS
286 "|oss"
287#endif
288 );
289 }
290 if (fLinux)
291 {
292 RTStrmPrintf(pStrm, "|oss"
293#ifdef VBOX_WITH_ALSA
294 "|alsa"
295#endif
296#ifdef VBOX_WITH_PULSE
297 "|pulse"
298#endif
299 );
300 }
301 if (fFreeBSD)
302 {
303 /* Get the line break sorted when dumping all option variants. */
304 if (fDumpOpts)
305 {
306 RTStrmPrintf(pStrm, "|\n"
307 " oss");
308 }
309 else
310 RTStrmPrintf(pStrm, "|oss");
311#ifdef VBOX_WITH_PULSE
312 RTStrmPrintf(pStrm, "|pulse");
313#endif
314 }
315 if (fDarwin)
316 {
317 RTStrmPrintf(pStrm, "|coreaudio");
318 }
319 RTStrmPrintf(pStrm, "]\n");
320 RTStrmPrintf(pStrm,
321 " [--audiocontroller ac97|hda|sb16]\n"
322 " [--clipboard disabled|hosttoguest|guesttohost|\n"
323 " bidirectional]\n"
324 " [--draganddrop disabled|hosttoguest\n");
325 RTStrmPrintf(pStrm,
326 " [--vrde on|off]\n"
327 " [--vrdeextpack default|<name>\n"
328 " [--vrdeproperty <name=[value]>]\n"
329 " [--vrdeport <hostport>]\n"
330 " [--vrdeaddress <hostip>]\n"
331 " [--vrdeauthtype null|external|guest]\n"
332 " [--vrdeauthlibrary default|<name>\n"
333 " [--vrdemulticon on|off]\n"
334 " [--vrdereusecon on|off]\n"
335 " [--vrdevideochannel on|off]\n"
336 " [--vrdevideochannelquality <percent>]\n");
337 RTStrmPrintf(pStrm,
338 " [--usb on|off]\n"
339 " [--usbehci on|off]\n"
340 " [--snapshotfolder default|<path>]\n"
341 " [--teleporter on|off]\n"
342 " [--teleporterport <port>]\n"
343 " [--teleporteraddress <address|empty>\n"
344 " [--teleporterpassword <password>]\n"
345 " [--teleporterpasswordfile <file>|stdin]\n"
346 " [--tracing-enabled on|off]\n"
347 " [--tracing-config <config-string>]\n"
348 " [--tracing-allow-vm-access on|off]\n"
349#if 0
350 " [--iocache on|off]\n"
351 " [--iocachesize <I/O cache size in MB>]\n"
352#endif
353#if 0
354 " [--faulttolerance master|standby]\n"
355 " [--faulttoleranceaddress <name>]\n"
356 " [--faulttoleranceport <port>]\n"
357 " [--faulttolerancesyncinterval <msec>]\n"
358 " [--faulttolerancepassword <password>]\n"
359#endif
360#ifdef VBOX_WITH_USB_VIDEO
361 " [--usbwebcam on|off]\n"
362#endif
363#ifdef VBOX_WITH_USB_CARDREADER
364 " [--usbcardreader on|off]\n"
365#endif
366 " [--autostart-enabled on|off]\n"
367 " [--autostart-delay <seconds>]\n"
368#if 0 /* Disabled until the feature is implemented. */
369 " [--autostop-type disabled|savestate|poweroff|\n"
370 " acpishutdown]\n"
371#endif
372#ifdef VBOX_WITH_VPX
373 " [--vcpenabled on|off]\n"
374 " [--vcpscreens [<display>],...\n"
375 " [--vcpfile <filename>]\n"
376 " [--vcpwidth <width>]\n"
377 " [--vcpheight <height>]\n"
378 " [--vcprate <rate>]\n"
379 " [--vcpfps <fps>]\n"
380#endif
381 " [--defaultfrontend default|<name]\n"
382 "\n");
383 }
384
385 if (u64Cmd & USAGE_CLONEVM)
386 RTStrmPrintf(pStrm,
387 "%s clonevm %s <uuid|vmname>\n"
388 " [--snapshot <uuid>|<name>]\n"
389 " [--mode machine|machineandchildren|all]\n"
390 " [--options link|keepallmacs|keepnatmacs|\n"
391 " keepdisknames]\n"
392 " [--name <name>]\n"
393 " [--groups <group>, ...]\n"
394 " [--basefolder <basefolder>]\n"
395 " [--uuid <uuid>]\n"
396 " [--register]\n"
397 "\n", SEP);
398
399 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
400 RTStrmPrintf(pStrm,
401 "%s import %s <ovfname/ovaname>\n"
402 " [--dry-run|-n]\n"
403 " [--options keepallmacs|keepnatmacs]\n"
404 " [more options]\n"
405 " (run with -n to have options displayed\n"
406 " for a particular OVF)\n\n", SEP);
407
408 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
409 RTStrmPrintf(pStrm,
410 "%s export %s <machines> --output|-o <name>.<ovf/ova>\n"
411 " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
412 " [--manifest]\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"
446 "\n"
447 " [<devicename>] |\n"
448#else /* !VBOX_WITH_NETFLT */
449 " nic<1-N> null|nat|bridged|intnet|generic\n"
450 " [<devicename>] |\n"
451#endif /* !VBOX_WITH_NETFLT */
452 " nictrace<1-N> on|off |\n"
453 " nictracefile<1-N> <filename> |\n"
454 " nicproperty<1-N> name=[value] |\n"
455 " nicpromisc<1-N> deny|allow-vms|allow-all |\n"
456 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
457 " <hostport>,[<guestip>],<guestport> |\n"
458 " natpf<1-N> delete <rulename> |\n"
459 " guestmemoryballoon <balloonsize in MB> |\n"
460 " usbattach <uuid>|<address> |\n"
461 " usbdetach <uuid>|<address> |\n"
462 " clipboard disabled|hosttoguest|guesttohost|\n"
463 " bidirectional |\n"
464 " draganddrop disabled|hosttoguest |\n"
465 " vrde on|off |\n"
466 " vrdeport <port> |\n"
467 " vrdeproperty <name=[value]> |\n"
468 " vrdevideochannelquality <percent> |\n"
469 " setvideomodehint <xres> <yres> <bpp>\n"
470 " [[<display>] [<enabled:yes|no> |\n"
471 " [<xorigin> <yorigin>]]] |\n"
472 " screenshotpng <file> [display] |\n"
473 " vcpenabled on|off |\n"
474 " vcpscreens all|none|<screen>,[<screen>...] |\n"
475 " setcredentials <username>\n"
476 " --passwordfile <file> | <password>\n"
477 " <domain>\n"
478 " [--allowlocallogon <yes|no>] |\n"
479 " teleport --host <name> --port <port>\n"
480 " [--maxdowntime <msec>]\n"
481 " [--passwordfile <file> |\n"
482 " --password <password>] |\n"
483 " plugcpu <id> |\n"
484 " unplugcpu <id> |\n"
485 " cpuexecutioncap <1-100>\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 " [--bandwidthgroup <name>]\n"
538 " [--forceunmount]\n"
539 " [--server <name>|<ip>]\n"
540 " [--target <target>]\n"
541 " [--tport <port>]\n"
542 " [--lun <lun>]\n"
543 " [--encodedlun <lun>]\n"
544 " [--username <username>]\n"
545 " [--password <password>]\n"
546 " [--initiator <initiator>]\n"
547 " [--intnet]\n"
548 "\n", SEP);
549
550 if (u64Cmd & USAGE_STORAGECONTROLLER)
551 RTStrmPrintf(pStrm,
552 "%s storagectl %s <uuid|vmname>\n"
553 " --name <name>\n"
554 " [--add ide|sata|scsi|floppy|sas]\n"
555 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
556 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
557 " [--sataportcount <1-30>]\n"
558 " [--hostiocache on|off]\n"
559 " [--bootable on|off]\n"
560 " [--remove]\n"
561 "\n", SEP);
562
563 if (u64Cmd & USAGE_BANDWIDTHCONTROL)
564 RTStrmPrintf(pStrm,
565 "%s bandwidthctl %s <uuid|vmname>\n"
566 " add <name> --type disk|network\n"
567 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
568 " set <name>\n"
569 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
570 " remove <name> |\n"
571 " list [--machinereadable]\n"
572 " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
573 " K=kilobyte, M=megabyte, G=gigabyte)\n"
574 "\n", SEP);
575
576 if (u64Cmd & USAGE_SHOWHDINFO)
577 RTStrmPrintf(pStrm,
578 "%s showhdinfo %s <uuid|filename>\n"
579 "\n", SEP);
580
581 if (u64Cmd & USAGE_CREATEHD)
582 RTStrmPrintf(pStrm,
583 "%s createhd %s --filename <filename>\n"
584 " [--size <megabytes>|--sizebyte <bytes>]\n"
585 " [--diffparent <uuid>|<filename>\n"
586 " [--format VDI|VMDK|VHD] (default: VDI)\n"
587 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
588 "\n", SEP);
589
590 if (u64Cmd & USAGE_MODIFYHD)
591 RTStrmPrintf(pStrm,
592 "%s modifyhd %s <uuid|filename>\n"
593 " [--type normal|writethrough|immutable|shareable|\n"
594 " readonly|multiattach]\n"
595 " [--autoreset on|off]\n"
596 " [--property <name=[value]>]\n"
597 " [--compact]\n"
598 " [--resize <megabytes>|--resizebyte <bytes>]\n"
599 "\n", SEP);
600
601 if (u64Cmd & USAGE_CLONEHD)
602 RTStrmPrintf(pStrm,
603 "%s clonehd %s <uuid|inputfile> <uuid|outputfile>\n"
604 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
605 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
606 " [--existing]\n"
607 "\n", SEP);
608
609 if (u64Cmd & USAGE_CONVERTFROMRAW)
610 RTStrmPrintf(pStrm,
611 "%s convertfromraw %s <filename> <outputfile>\n"
612 " [--format VDI|VMDK|VHD]\n"
613 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
614 " [--uuid <uuid>]\n"
615 "%s convertfromraw %s stdin <outputfile> <bytes>\n"
616 " [--format VDI|VMDK|VHD]\n"
617 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
618 " [--uuid <uuid>]\n"
619 "\n", SEP, SEP);
620
621 if (u64Cmd & USAGE_GETEXTRADATA)
622 RTStrmPrintf(pStrm,
623 "%s getextradata %s global|<uuid|vmname>\n"
624 " <key>|enumerate\n"
625 "\n", SEP);
626
627 if (u64Cmd & USAGE_SETEXTRADATA)
628 RTStrmPrintf(pStrm,
629 "%s setextradata %s global|<uuid|vmname>\n"
630 " <key>\n"
631 " [<value>] (no value deletes key)\n"
632 "\n", SEP);
633
634 if (u64Cmd & USAGE_SETPROPERTY)
635 RTStrmPrintf(pStrm,
636 "%s setproperty %s machinefolder default|<folder> |\n"
637 " vrdeauthlibrary default|<library> |\n"
638 " websrvauthlibrary default|null|<library> |\n"
639 " vrdeextpack null|<library> |\n"
640 " autostartdbpath null|<folder> |\n"
641 " loghistorycount <value>\n"
642 " defaultfrontend default|<name>\n"
643 "\n", SEP);
644
645 if (u64Cmd & USAGE_USBFILTER_ADD)
646 RTStrmPrintf(pStrm,
647 "%s usbfilter %s add <index,0-N>\n"
648 " --target <uuid|vmname>|global\n"
649 " --name <string>\n"
650 " --action ignore|hold (global filters only)\n"
651 " [--active yes|no] (yes)\n"
652 " [--vendorid <XXXX>] (null)\n"
653 " [--productid <XXXX>] (null)\n"
654 " [--revision <IIFF>] (null)\n"
655 " [--manufacturer <string>] (null)\n"
656 " [--product <string>] (null)\n"
657 " [--remote yes|no] (null, VM filters only)\n"
658 " [--serialnumber <string>] (null)\n"
659 " [--maskedinterfaces <XXXXXXXX>]\n"
660 "\n", SEP);
661
662 if (u64Cmd & USAGE_USBFILTER_MODIFY)
663 RTStrmPrintf(pStrm,
664 "%s usbfilter %s modify <index,0-N>\n"
665 " --target <uuid|vmname>|global\n"
666 " [--name <string>]\n"
667 " [--action ignore|hold] (global filters only)\n"
668 " [--active yes|no]\n"
669 " [--vendorid <XXXX>|\"\"]\n"
670 " [--productid <XXXX>|\"\"]\n"
671 " [--revision <IIFF>|\"\"]\n"
672 " [--manufacturer <string>|\"\"]\n"
673 " [--product <string>|\"\"]\n"
674 " [--remote yes|no] (null, VM filters only)\n"
675 " [--serialnumber <string>|\"\"]\n"
676 " [--maskedinterfaces <XXXXXXXX>]\n"
677 "\n", SEP);
678
679 if (u64Cmd & USAGE_USBFILTER_REMOVE)
680 RTStrmPrintf(pStrm,
681 "%s usbfilter %s remove <index,0-N>\n"
682 " --target <uuid|vmname>|global\n"
683 "\n", SEP);
684
685 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
686 RTStrmPrintf(pStrm,
687 "%s sharedfolder %s add <uuid|vmname>\n"
688 " --name <name> --hostpath <hostpath>\n"
689 " [--transient] [--readonly] [--automount]\n"
690 "\n", SEP);
691
692 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
693 RTStrmPrintf(pStrm,
694 "%s sharedfolder %s remove <uuid|vmname>\n"
695 " --name <name> [--transient]\n"
696 "\n", SEP);
697
698#ifdef VBOX_WITH_GUEST_PROPS
699 if (u64Cmd & USAGE_GUESTPROPERTY)
700 usageGuestProperty(pStrm, SEP);
701#endif /* VBOX_WITH_GUEST_PROPS defined */
702
703#ifdef VBOX_WITH_GUEST_CONTROL
704 if (u64Cmd & USAGE_GUESTCONTROL)
705 usageGuestControl(pStrm, SEP);
706#endif /* VBOX_WITH_GUEST_CONTROL defined */
707
708 if (u64Cmd & USAGE_DEBUGVM)
709 {
710 RTStrmPrintf(pStrm,
711 "%s debugvm %s <uuid|vmname>\n"
712 " dumpguestcore --filename <name> |\n"
713 " info <item> [args] |\n"
714 " injectnmi |\n"
715 " log [--release|--debug] <settings> ...|\n"
716 " logdest [--release|--debug] <settings> ...|\n"
717 " logflags [--release|--debug] <settings> ...|\n"
718 " osdetect |\n"
719 " osinfo |\n"
720 " getregisters [--cpu <id>] <reg>|all ... |\n"
721 " setregisters [--cpu <id>] <reg>=<value> ... |\n"
722 " show [--human-readable|--sh-export|--sh-eval|\n"
723 " --cmd-set] \n"
724 " <logdbg-settings|logrel-settings>\n"
725 " [[opt] what ...] |\n"
726 " statistics [--reset] [--pattern <pattern>]\n"
727 " [--descriptions]\n"
728 "\n", SEP);
729 }
730 if (u64Cmd & USAGE_METRICS)
731 RTStrmPrintf(pStrm,
732 "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
733 " (comma-separated)\n\n"
734 "%s metrics %s setup\n"
735 " [--period <seconds>] (default: 1)\n"
736 " [--samples <count>] (default: 1)\n"
737 " [--list]\n"
738 " [*|host|<vmname> [<metric_list>]]\n\n"
739 "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
740 "%s metrics %s enable\n"
741 " [--list]\n"
742 " [*|host|<vmname> [<metric_list>]]\n\n"
743 "%s metrics %s disable\n"
744 " [--list]\n"
745 " [*|host|<vmname> [<metric_list>]]\n\n"
746 "%s metrics %s collect\n"
747 " [--period <seconds>] (default: 1)\n"
748 " [--samples <count>] (default: 1)\n"
749 " [--list]\n"
750 " [--detach]\n"
751 " [*|host|<vmname> [<metric_list>]]\n"
752 "\n", SEP, SEP, SEP, SEP, SEP, SEP);
753
754#if defined(VBOX_WITH_NETFLT)
755 if (u64Cmd & USAGE_HOSTONLYIFS)
756 {
757 RTStrmPrintf(pStrm,
758 "%s hostonlyif %s ipconfig <name>\n"
759 " [--dhcp |\n"
760 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
761 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
762# if !defined(RT_OS_SOLARIS)
763 " create |\n"
764 " remove <name>\n"
765# endif
766 "\n", SEP);
767 }
768#endif
769
770 if (u64Cmd & USAGE_DHCPSERVER)
771 {
772 RTStrmPrintf(pStrm,
773 "%s dhcpserver %s add|modify --netname <network_name> |\n"
774#if defined(VBOX_WITH_NETFLT)
775 " --ifname <hostonly_if_name>\n"
776#endif
777 " [--ip <ip_address>\n"
778 " --netmask <network_mask>\n"
779 " --lowerip <lower_ip>\n"
780 " --upperip <upper_ip>]\n"
781 " [--enable | --disable]\n\n"
782 "%s dhcpserver %s remove --netname <network_name> |\n"
783#if defined(VBOX_WITH_NETFLT)
784 " --ifname <hostonly_if_name>\n"
785#endif
786 "\n", SEP, SEP);
787 }
788 if (u64Cmd & USAGE_EXTPACK)
789 {
790 RTStrmPrintf(pStrm,
791 "%s extpack %s install [--replace] <tarball> |\n"
792 " uninstall [--force] <name> |\n"
793 " cleanup\n"
794 "\n", SEP);
795 }
796}
797
798/**
799 * Print a usage synopsis and the syntax error message.
800 * @returns RTEXITCODE_SYNTAX.
801 */
802RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
803{
804 va_list args;
805 showLogo(g_pStdErr); // show logo even if suppressed
806#ifndef VBOX_ONLY_DOCS
807 if (g_fInternalMode)
808 printUsageInternal(u64Cmd, g_pStdErr);
809 else
810 printUsage(u64Cmd, g_pStdErr);
811#endif /* !VBOX_ONLY_DOCS */
812 va_start(args, pszFormat);
813 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
814 va_end(args);
815 return RTEXITCODE_SYNTAX;
816}
817
818/**
819 * errorSyntax for RTGetOpt users.
820 *
821 * @returns RTEXITCODE_SYNTAX.
822 *
823 * @param fUsageCategory The usage category of the command.
824 * @param rc The RTGetOpt return code.
825 * @param pValueUnion The value union.
826 */
827RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
828{
829 /*
830 * Check if it is an unhandled standard option.
831 */
832 if (rc == 'V')
833 {
834 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
835 return RTEXITCODE_SUCCESS;
836 }
837
838 if (rc == 'h')
839 {
840 showLogo(g_pStdErr);
841#ifndef VBOX_ONLY_DOCS
842 if (g_fInternalMode)
843 printUsageInternal(fUsageCategory, g_pStdOut);
844 else
845 printUsage(fUsageCategory, g_pStdOut);
846#endif
847 return RTEXITCODE_SUCCESS;
848 }
849
850 /*
851 * General failure.
852 */
853 showLogo(g_pStdErr); // show logo even if suppressed
854#ifndef VBOX_ONLY_DOCS
855 if (g_fInternalMode)
856 printUsageInternal(fUsageCategory, g_pStdErr);
857 else
858 printUsage(fUsageCategory, g_pStdErr);
859#endif /* !VBOX_ONLY_DOCS */
860
861 if (rc == VINF_GETOPT_NOT_OPTION)
862 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
863 if (rc > 0)
864 {
865 if (RT_C_IS_PRINT(rc))
866 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
867 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
868 }
869 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
870 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
871 if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
872 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
873 if (pValueUnion->pDef)
874 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
875 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
876}
877
878/**
879 * Print an error message without the syntax stuff.
880 *
881 * @returns RTEXITCODE_SYNTAX.
882 */
883RTEXITCODE errorArgument(const char *pszFormat, ...)
884{
885 va_list args;
886 va_start(args, pszFormat);
887 RTMsgErrorV(pszFormat, args);
888 va_end(args);
889 return RTEXITCODE_SYNTAX;
890}
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