VirtualBox

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

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

Missing updates part two

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 32.2 KB
Line 
1/* $Id: VBoxManageHelp.cpp 31291 2010-08-02 12:29:35Z 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("\n");
324 }
325
326 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
327 {
328 RTPrintf("VBoxManage import <ovf> [--dry-run|-n] [more options]\n"
329 " (run with -n to have options displayed\n"
330 " for a particular OVF)\n\n");
331 }
332
333 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
334 {
335 RTPrintf("VBoxManage export <machines> --output|-o <ovf>\n"
336 " [--legacy09]\n"
337 " [--vsys <number of virtual system>]\n"
338 " [--product <product name>]\n"
339 " [--producturl <product url>]\n"
340 " [--vendor <vendor name>]\n"
341 " [--vendorurl <vendor url>]\n"
342 " [--version <version info>]\n"
343 " [--eula <license text>]\n"
344 " [--eulafile <filename>]\n"
345 "\n");
346 }
347
348 if (u64Cmd & USAGE_STARTVM)
349 {
350 RTPrintf("VBoxManage startvm <uuid>|<name>\n");
351 RTPrintf(" [--type gui");
352 if (fVBoxSDL)
353 RTPrintf( "|sdl");
354 if (fVRDP)
355 RTPrintf( "|vrdp");
356 RTPrintf( "|headless]\n");
357 RTPrintf("\n");
358 }
359
360 if (u64Cmd & USAGE_CONTROLVM)
361 {
362 RTPrintf("VBoxManage controlvm <uuid>|<name>\n"
363 " pause|resume|reset|poweroff|savestate|\n"
364 " acpipowerbutton|acpisleepbutton|\n"
365 " keyboardputscancode <hex> [<hex> ...]|\n"
366 " injectnmi|\n"
367 " setlinkstate<1-N> on|off |\n"
368#ifdef VBOX_DYNAMIC_NET_ATTACH
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#endif /* VBOX_DYNAMIC_NET_ATTACH */
379 " guestmemoryballoon <balloonsize in MB>]\n"
380 " gueststatisticsinterval <seconds>]\n"
381 " usbattach <uuid>|<address> |\n"
382 " usbdetach <uuid>|<address> |\n");
383 if (fVRDP)
384 {
385 RTPrintf(" vrdp on|off |\n");
386 RTPrintf(" vrdpport default|<ports> |\n"
387 " vrdpvideochannelquality <percent>\n");
388 }
389 RTPrintf(" setvideomodehint <xres> <yres> <bpp> [display] |\n"
390 " setcredentials <username> <password> <domain>\n"
391 " [--allowlocallogon <yes|no>] |\n"
392 " teleport --host <name> --port <port>\n"
393 " [--maxdowntime <msec>] [--password password]\n"
394 " plugcpu <id>\n"
395 " unplugcpu <id>\n"
396 "\n");
397 }
398
399 if (u64Cmd & USAGE_DISCARDSTATE)
400 {
401 RTPrintf("VBoxManage discardstate <uuid>|<name>\n"
402 "\n");
403 }
404
405 if (u64Cmd & USAGE_ADOPTSTATE)
406 {
407 RTPrintf("VBoxManage adoptstate <uuid>|<name> <state_file>\n"
408 "\n");
409 }
410
411 if (u64Cmd & USAGE_SNAPSHOT)
412 {
413 RTPrintf("VBoxManage snapshot <uuid>|<name>\n"
414 " take <name> [--description <desc>] [--pause] |\n"
415 " delete <uuid>|<name> |\n"
416 " restore <uuid>|<name> |\n"
417 " restorecurrent |\n"
418 " edit <uuid>|<name>|--current\n"
419 " [--name <name>]\n"
420 " [--description <desc>] |\n"
421 " showvminfo <uuid>|<name>\n"
422 "\n");
423 }
424
425 if (u64Cmd & USAGE_OPENMEDIUM)
426 {
427 RTPrintf("VBoxManage openmedium disk|dvd|floppy <filename>\n"
428 " [--type normal|immutable|writethrough|\n"
429 " shareable] (disk only)\n"
430 " [--uuid <uuid>]\n"
431 " [--parentuuid <uuid>] (disk only)\n"
432 "\n");
433 }
434
435 if (u64Cmd & USAGE_CLOSEMEDIUM)
436 {
437 RTPrintf("VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
438 " [--delete]\n"
439 "\n");
440 }
441
442 if (u64Cmd & USAGE_STORAGEATTACH)
443 {
444 RTPrintf("VBoxManage storageattach <uuid|vmname>\n"
445 " --storagectl <name>\n"
446 " --port <number>\n"
447 " --device <number>\n"
448 " [--type dvddrive|hdd|fdd]\n"
449 " [--medium none|emptydrive|\n"
450 " <uuid>|<filename>|host:<drive>]\n"
451 " [--passthrough on|off]\n"
452 " [--forceunmount]\n"
453 "\n");
454 }
455
456 if (u64Cmd & USAGE_STORAGECONTROLLER)
457 {
458 RTPrintf("VBoxManage storagectl <uuid|vmname>\n"
459 " --name <name>\n"
460 " [--add ide|sata|scsi|floppy|sas]\n"
461 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
462 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
463 " [--sataideemulation<1-4> <1-30>]\n"
464 " [--sataportcount <1-30>]\n"
465 " [--hostiocache on|off]\n"
466 " [--remove]\n"
467 "\n");
468 }
469
470 if (u64Cmd & USAGE_SHOWHDINFO)
471 {
472 RTPrintf("VBoxManage showhdinfo <uuid>|<filename>\n"
473 "\n");
474 }
475
476 if (u64Cmd & USAGE_CREATEHD)
477 {
478 RTPrintf("VBoxManage createhd --filename <filename>\n"
479 " --size <megabytes>\n"
480 " [--format VDI|VMDK|VHD] (default: VDI)\n"
481 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
482 " [--type normal|writethrough|\n"
483 " shareable] (default: normal)\n"
484 " [--comment <comment>]\n"
485 " [--remember]\n"
486 "\n");
487 }
488
489 if (u64Cmd & USAGE_MODIFYHD)
490 {
491 RTPrintf("VBoxManage modifyhd <uuid>|<filename>\n"
492 " [--type normal|writethrough|immutable|shareable]\n"
493 " [--autoreset on|off]\n"
494 " [--compact]\n"
495 "\n");
496 }
497
498 if (u64Cmd & USAGE_CLONEHD)
499 {
500 RTPrintf("VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
501 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
502 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
503 " [--type normal|writethrough|immutable|shareable]\n"
504 " [--remember] [--existing]\n"
505 "\n");
506 }
507
508 if (u64Cmd & USAGE_CONVERTFROMRAW)
509 {
510 RTPrintf("VBoxManage convertfromraw <filename> <outputfile>\n"
511 " [--format VDI|VMDK|VHD]\n"
512 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
513 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
514 " [--format VDI|VMDK|VHD]\n"
515 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
516 "\n");
517 }
518
519 if (u64Cmd & USAGE_ADDISCSIDISK)
520 {
521 RTPrintf("VBoxManage addiscsidisk --server <name>|<ip>\n"
522 " --target <target>\n"
523 " [--port <port>]\n"
524 " [--lun <lun>]\n"
525 " [--encodedlun <lun>]\n"
526 " [--username <username>]\n"
527 " [--password <password>]\n"
528 " [--type normal|writethrough|immutable|shareable]\n"
529 " [--intnet]\n"
530 "\n");
531 }
532
533 if (u64Cmd & USAGE_GETEXTRADATA)
534 {
535 RTPrintf("VBoxManage getextradata global|<uuid>|<name>\n"
536 " <key>|enumerate\n"
537 "\n");
538 }
539
540 if (u64Cmd & USAGE_SETEXTRADATA)
541 {
542 RTPrintf("VBoxManage setextradata global|<uuid>|<name>\n"
543 " <key>\n"
544 " [<value>] (no value deletes key)\n"
545 "\n");
546 }
547
548 if (u64Cmd & USAGE_SETPROPERTY)
549 {
550 RTPrintf("VBoxManage setproperty hdfolder default|<folder> |\n"
551 " machinefolder default|<folder> |\n"
552 " vrdpauthlibrary default|<library> |\n"
553 " websrvauthlibrary default|null|<library> |\n"
554 " loghistorycount <value>\n"
555 "\n");
556 }
557
558 if (u64Cmd & USAGE_USBFILTER_ADD)
559 {
560 RTPrintf("VBoxManage usbfilter add <index,0-N>\n"
561 " --target <uuid>|<name>|global\n"
562 " --name <string>\n"
563 " --action ignore|hold (global filters only)\n"
564 " [--active yes|no] (yes)\n"
565 " [--vendorid <XXXX>] (null)\n"
566 " [--productid <XXXX>] (null)\n"
567 " [--revision <IIFF>] (null)\n"
568 " [--manufacturer <string>] (null)\n"
569 " [--product <string>] (null)\n"
570 " [--remote yes|no] (null, VM filters only)\n"
571 " [--serialnumber <string>] (null)\n"
572 " [--maskedinterfaces <XXXXXXXX>]\n"
573 "\n");
574 }
575
576 if (u64Cmd & USAGE_USBFILTER_MODIFY)
577 {
578 RTPrintf("VBoxManage usbfilter modify <index,0-N>\n"
579 " --target <uuid>|<name>|global\n"
580 " [--name <string>]\n"
581 " [--action ignore|hold] (global filters only)\n"
582 " [--active yes|no]\n"
583 " [--vendorid <XXXX>|\"\"]\n"
584 " [--productid <XXXX>|\"\"]\n"
585 " [--revision <IIFF>|\"\"]\n"
586 " [--manufacturer <string>|\"\"]\n"
587 " [--product <string>|\"\"]\n"
588 " [--remote yes|no] (null, VM filters only)\n"
589 " [--serialnumber <string>|\"\"]\n"
590 " [--maskedinterfaces <XXXXXXXX>]\n"
591 "\n");
592 }
593
594 if (u64Cmd & USAGE_USBFILTER_REMOVE)
595 {
596 RTPrintf("VBoxManage usbfilter remove <index,0-N>\n"
597 " --target <uuid>|<name>|global\n"
598 "\n");
599 }
600
601 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
602 {
603 RTPrintf("VBoxManage sharedfolder add <vmname>|<uuid>\n"
604 " --name <name> --hostpath <hostpath>\n"
605 " [--transient] [--readonly] [--automount]\n"
606 "\n");
607 }
608
609 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
610 {
611 RTPrintf("VBoxManage sharedfolder remove <vmname>|<uuid>\n"
612 " --name <name> [--transient]\n"
613 "\n");
614 }
615
616 if (u64Cmd & USAGE_VM_STATISTICS)
617 {
618 RTPrintf("VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
619 " [--pattern <pattern>] [--descriptions]\n"
620 "\n");
621 }
622
623#ifdef VBOX_WITH_GUEST_PROPS
624 if (u64Cmd & USAGE_GUESTPROPERTY)
625 usageGuestProperty();
626#endif /* VBOX_WITH_GUEST_PROPS defined */
627
628#ifdef VBOX_WITH_GUEST_CONTROL
629 if (u64Cmd & USAGE_GUESTCONTROL)
630 usageGuestControl();
631#endif /* VBOX_WITH_GUEST_CONTROL defined */
632
633 if (u64Cmd & USAGE_METRICS)
634 {
635 RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
636 " (comma-separated)\n\n"
637 "VBoxManage metrics setup\n"
638 " [--period <seconds>] (default: 1)\n"
639 " [--samples <count>] (default: 1)\n"
640 " [--list]\n"
641 " [*|host|<vmname> [<metric_list>]]\n\n"
642 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
643 "VBoxManage metrics enable\n"
644 " [--list]\n"
645 " [*|host|<vmname> [<metric_list>]]\n\n"
646 "VBoxManage metrics disable\n"
647 " [--list]\n"
648 " [*|host|<vmname> [<metric_list>]]\n\n"
649 "VBoxManage metrics collect\n"
650 " [--period <seconds>] (default: 1)\n"
651 " [--samples <count>] (default: 1)\n"
652 " [--list]\n"
653 " [--detach]\n"
654 " [*|host|<vmname> [<metric_list>]]\n"
655 "\n");
656 }
657#if defined(VBOX_WITH_NETFLT)
658 if (u64Cmd & USAGE_HOSTONLYIFS)
659 {
660 RTPrintf("VBoxManage hostonlyif ipconfig <name>\n"
661 " [--dhcp |\n"
662 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
663 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
664# if defined(RT_OS_WINDOWS)
665 " create |\n"
666 " remove <name>\n"
667# endif
668 "\n");
669 }
670#endif
671
672 if (u64Cmd & USAGE_DHCPSERVER)
673 {
674 RTPrintf("VBoxManage dhcpserver add|modify --netname <network_name> |\n"
675#if defined(VBOX_WITH_NETFLT)
676 " --ifname <hostonly_if_name>\n"
677#endif
678 " [--ip <ip_address>\n"
679 " --netmask <network_mask>\n"
680 " --lowerip <lower_ip>\n"
681 " --upperip <upper_ip>]\n"
682 " [--enable | --disable]\n\n"
683 "VBoxManage dhcpserver remove --netname <network_name> |\n"
684#if defined(VBOX_WITH_NETFLT)
685 " --ifname <hostonly_if_name>\n"
686#endif
687 "\n");
688 }
689}
690
691/**
692 * Print a usage synopsis and the syntax error message.
693 */
694int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
695{
696 va_list args;
697 showLogo(); // show logo even if suppressed
698#ifndef VBOX_ONLY_DOCS
699 if (g_fInternalMode)
700 printUsageInternal(u64Cmd);
701 else
702 printUsage(u64Cmd);
703#endif /* !VBOX_ONLY_DOCS */
704 va_start(args, pszFormat);
705 RTPrintf("\n"
706 "Syntax error: %N\n", pszFormat, &args);
707 va_end(args);
708 return 1;
709}
710
711/**
712 * errorSyntax for RTGetOpt users.
713 *
714 * @returns 1.
715 *
716 * @param fUsageCategory The usage category of the command.
717 * @param rc The RTGetOpt return code.
718 * @param pValueUnion The value union.
719 */
720int errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
721{
722 showLogo(); // show logo even if suppressed
723#ifndef VBOX_ONLY_DOCS
724 if (g_fInternalMode)
725 printUsageInternal(fUsageCategory);
726 else
727 printUsage(fUsageCategory);
728#endif /* !VBOX_ONLY_DOCS */
729
730 if (rc == VINF_GETOPT_NOT_OPTION)
731 return RTPrintf("error: Invalid parameter '%s'\n", pValueUnion->psz);
732 if (rc > 0)
733 {
734 if (RT_C_IS_PRINT(rc))
735 return RTPrintf("error: Invalid option -%c\n", rc);
736 return RTPrintf("error: Invalid option case %i\n", rc);
737 }
738 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
739 return RTPrintf("error: unknown option: %s\n", pValueUnion->psz);
740 if (pValueUnion->pDef)
741 return RTPrintf("error: %s: %Rrs\n", pValueUnion->pDef->pszLong, rc);
742 return RTPrintf("error: %Rrs\n", rc);
743}
744
745/**
746 * Print an error message without the syntax stuff.
747 */
748int errorArgument(const char *pszFormat, ...)
749{
750 va_list args;
751 va_start(args, pszFormat);
752 RTPrintf("error: %N\n", pszFormat, &args);
753 va_end(args);
754 return 1;
755}
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