VirtualBox

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

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

Frontends/VBoxManage: remove no longer reliable options from clonehd (as done earlier with createhd)

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