VirtualBox

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

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

VBoxManage: moves listing of nat rules from list command to showvminfo one.

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