VirtualBox

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

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

FT options for modifyvm

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