VirtualBox

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

Last change on this file since 32718 was 32712, checked in by vboxsync, 15 years ago

VBoxManage: forgot the help for guestproperty and guestcontrol; enable the latter for VBOX_ONLY_DOCS=1

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette