VirtualBox

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

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

FE/VBoxManage: Show usage for --cputhotplug and --plugcpu/unplugcpu commands

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 32.1 KB
Line 
1/* $Id: VBoxManageHelp.cpp 29865 2010-05-28 14:53:07Z 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|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 " [--iobandwidthmax <Maximum I/O bandwidth in MB/s>]\n"
322#endif
323 );
324 RTPrintf("\n");
325 }
326
327 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
328 {
329 RTPrintf("VBoxManage import <ovf> [--dry-run|-n] [more options]\n"
330 " (run with -n to have options displayed\n"
331 " for a particular OVF)\n\n");
332 }
333
334 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
335 {
336 RTPrintf("VBoxManage export <machines> --output|-o <ovf>\n"
337 " [--legacy09]\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
349 if (u64Cmd & USAGE_STARTVM)
350 {
351 RTPrintf("VBoxManage startvm <uuid>|<name>\n");
352 RTPrintf(" [--type gui");
353 if (fVBoxSDL)
354 RTPrintf( "|sdl");
355 if (fVRDP)
356 RTPrintf( "|vrdp");
357 RTPrintf( "|headless]\n");
358 RTPrintf("\n");
359 }
360
361 if (u64Cmd & USAGE_CONTROLVM)
362 {
363 RTPrintf("VBoxManage controlvm <uuid>|<name>\n"
364 " pause|resume|reset|poweroff|savestate|\n"
365 " acpipowerbutton|acpisleepbutton|\n"
366 " keyboardputscancode <hex> [<hex> ...]|\n"
367 " injectnmi|\n"
368 " setlinkstate<1-N> on|off |\n"
369#ifdef VBOX_DYNAMIC_NET_ATTACH
370#if defined(VBOX_WITH_NETFLT)
371 " nic<1-N> null|nat|bridged|intnet|hostonly\n"
372 " [<devicename>] |\n"
373#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
374 " nic<1-N> null|nat|bridged|intnet\n"
375 " [<devicename>] |\n"
376#endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
377 " nictrace<1-N> on|off\n"
378 " nictracefile<1-N> <filename>\n"
379#endif /* VBOX_DYNAMIC_NET_ATTACH */
380 " guestmemoryballoon <balloonsize in MB>]\n"
381 " gueststatisticsinterval <seconds>]\n"
382 " usbattach <uuid>|<address> |\n"
383 " usbdetach <uuid>|<address> |\n");
384 if (fVRDP)
385 {
386 RTPrintf(" vrdp on|off |\n");
387 RTPrintf(" vrdpport default|<ports> |\n"
388 " vrdpvideochannelquality <percent>\n");
389 }
390 RTPrintf(" setvideomodehint <xres> <yres> <bpp> [display] |\n"
391 " setcredentials <username> <password> <domain>\n"
392 " [--allowlocallogon <yes|no>] |\n"
393 " teleport --host <name> --port <port>\n"
394 " [--maxdowntime <msec>] [--password password]\n"
395 " plugcpu <id>\n"
396 " unplugcpu <id>\n"
397 "\n");
398 }
399
400 if (u64Cmd & USAGE_DISCARDSTATE)
401 {
402 RTPrintf("VBoxManage discardstate <uuid>|<name>\n"
403 "\n");
404 }
405
406 if (u64Cmd & USAGE_ADOPTSTATE)
407 {
408 RTPrintf("VBoxManage adoptstate <uuid>|<name> <state_file>\n"
409 "\n");
410 }
411
412 if (u64Cmd & USAGE_SNAPSHOT)
413 {
414 RTPrintf("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
426 if (u64Cmd & USAGE_OPENMEDIUM)
427 {
428 RTPrintf("VBoxManage openmedium disk|dvd|floppy <filename>\n"
429 " [--type normal|immutable|writethrough] (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] (default: normal)\n"
483 " [--comment <comment>]\n"
484 " [--remember]\n"
485 "\n");
486 }
487
488 if (u64Cmd & USAGE_MODIFYHD)
489 {
490 RTPrintf("VBoxManage modifyhd <uuid>|<filename>\n"
491 " [--type normal|writethrough|immutable]\n"
492 " [--autoreset on|off]\n"
493 " [--compact]\n"
494 "\n");
495 }
496
497 if (u64Cmd & USAGE_CLONEHD)
498 {
499 RTPrintf("VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
500 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
501 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
502 " [--type normal|writethrough|immutable]\n"
503 " [--remember] [--existing]\n"
504 "\n");
505 }
506
507 if (u64Cmd & USAGE_CONVERTFROMRAW)
508 {
509 RTPrintf("VBoxManage convertfromraw <filename> <outputfile>\n"
510 " [--format VDI|VMDK|VHD]\n"
511 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
512 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
513 " [--format VDI|VMDK|VHD]\n"
514 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
515 "\n");
516 }
517
518 if (u64Cmd & USAGE_ADDISCSIDISK)
519 {
520 RTPrintf("VBoxManage addiscsidisk --server <name>|<ip>\n"
521 " --target <target>\n"
522 " [--port <port>]\n"
523 " [--lun <lun>]\n"
524 " [--encodedlun <lun>]\n"
525 " [--username <username>]\n"
526 " [--password <password>]\n"
527 " [--type normal|writethrough|immutable]\n"
528 " [--intnet]\n"
529 "\n");
530 }
531
532 if (u64Cmd & USAGE_GETEXTRADATA)
533 {
534 RTPrintf("VBoxManage getextradata global|<uuid>|<name>\n"
535 " <key>|enumerate\n"
536 "\n");
537 }
538
539 if (u64Cmd & USAGE_SETEXTRADATA)
540 {
541 RTPrintf("VBoxManage setextradata global|<uuid>|<name>\n"
542 " <key>\n"
543 " [<value>] (no value deletes key)\n"
544 "\n");
545 }
546
547 if (u64Cmd & USAGE_SETPROPERTY)
548 {
549 RTPrintf("VBoxManage setproperty hdfolder default|<folder> |\n"
550 " machinefolder default|<folder> |\n"
551 " vrdpauthlibrary default|<library> |\n"
552 " websrvauthlibrary default|null|<library> |\n"
553 " loghistorycount <value>\n"
554 "\n");
555 }
556
557 if (u64Cmd & USAGE_USBFILTER_ADD)
558 {
559 RTPrintf("VBoxManage usbfilter add <index,0-N>\n"
560 " --target <uuid>|<name>|global\n"
561 " --name <string>\n"
562 " --action ignore|hold (global filters only)\n"
563 " [--active yes|no] (yes)\n"
564 " [--vendorid <XXXX>] (null)\n"
565 " [--productid <XXXX>] (null)\n"
566 " [--revision <IIFF>] (null)\n"
567 " [--manufacturer <string>] (null)\n"
568 " [--product <string>] (null)\n"
569 " [--remote yes|no] (null, VM filters only)\n"
570 " [--serialnumber <string>] (null)\n"
571 " [--maskedinterfaces <XXXXXXXX>]\n"
572 "\n");
573 }
574
575 if (u64Cmd & USAGE_USBFILTER_MODIFY)
576 {
577 RTPrintf("VBoxManage usbfilter modify <index,0-N>\n"
578 " --target <uuid>|<name>|global\n"
579 " [--name <string>]\n"
580 " [--action ignore|hold] (global filters only)\n"
581 " [--active yes|no]\n"
582 " [--vendorid <XXXX>|\"\"]\n"
583 " [--productid <XXXX>|\"\"]\n"
584 " [--revision <IIFF>|\"\"]\n"
585 " [--manufacturer <string>|\"\"]\n"
586 " [--product <string>|\"\"]\n"
587 " [--remote yes|no] (null, VM filters only)\n"
588 " [--serialnumber <string>|\"\"]\n"
589 " [--maskedinterfaces <XXXXXXXX>]\n"
590 "\n");
591 }
592
593 if (u64Cmd & USAGE_USBFILTER_REMOVE)
594 {
595 RTPrintf("VBoxManage usbfilter remove <index,0-N>\n"
596 " --target <uuid>|<name>|global\n"
597 "\n");
598 }
599
600 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
601 {
602 RTPrintf("VBoxManage sharedfolder add <vmname>|<uuid>\n"
603 " --name <name> --hostpath <hostpath>\n"
604 " [--transient] [--readonly]\n"
605 "\n");
606 }
607
608 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
609 {
610 RTPrintf("VBoxManage sharedfolder remove <vmname>|<uuid>\n"
611 " --name <name> [--transient]\n"
612 "\n");
613 }
614
615 if (u64Cmd & USAGE_VM_STATISTICS)
616 {
617 RTPrintf("VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
618 " [--pattern <pattern>] [--descriptions]\n"
619 "\n");
620 }
621
622#ifdef VBOX_WITH_GUEST_PROPS
623 if (u64Cmd & USAGE_GUESTPROPERTY)
624 usageGuestProperty();
625#endif /* VBOX_WITH_GUEST_PROPS defined */
626
627#ifdef VBOX_WITH_GUEST_CONTROL
628 if (u64Cmd & USAGE_GUESTCONTROL)
629 usageGuestControl();
630#endif /* VBOX_WITH_GUEST_CONTROL defined */
631
632 if (u64Cmd & USAGE_METRICS)
633 {
634 RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
635 " (comma-separated)\n\n"
636 "VBoxManage metrics setup\n"
637 " [--period <seconds>] (default: 1)\n"
638 " [--samples <count>] (default: 1)\n"
639 " [--list]\n"
640 " [*|host|<vmname> [<metric_list>]]\n\n"
641 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
642 "VBoxManage metrics enable\n"
643 " [--list]\n"
644 " [*|host|<vmname> [<metric_list>]]\n\n"
645 "VBoxManage metrics disable\n"
646 " [--list]\n"
647 " [*|host|<vmname> [<metric_list>]]\n\n"
648 "VBoxManage metrics collect\n"
649 " [--period <seconds>] (default: 1)\n"
650 " [--samples <count>] (default: 1)\n"
651 " [--list]\n"
652 " [--detach]\n"
653 " [*|host|<vmname> [<metric_list>]]\n"
654 "\n");
655 }
656#if defined(VBOX_WITH_NETFLT)
657 if (u64Cmd & USAGE_HOSTONLYIFS)
658 {
659 RTPrintf("VBoxManage hostonlyif ipconfig <name>\n"
660 " [--dhcp |\n"
661 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
662 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
663# if defined(RT_OS_WINDOWS)
664 " create |\n"
665 " remove <name>\n"
666# endif
667 "\n");
668 }
669#endif
670
671 if (u64Cmd & USAGE_DHCPSERVER)
672 {
673 RTPrintf("VBoxManage dhcpserver add|modify --netname <network_name> |\n"
674#if defined(VBOX_WITH_NETFLT)
675 " --ifname <hostonly_if_name>\n"
676#endif
677 " [--ip <ip_address>\n"
678 " --netmask <network_mask>\n"
679 " --lowerip <lower_ip>\n"
680 " --upperip <upper_ip>]\n"
681 " [--enable | --disable]\n\n"
682 "VBoxManage dhcpserver remove --netname <network_name> |\n"
683#if defined(VBOX_WITH_NETFLT)
684 " --ifname <hostonly_if_name>\n"
685#endif
686 "\n");
687 }
688}
689
690/**
691 * Print a usage synopsis and the syntax error message.
692 */
693int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
694{
695 va_list args;
696 showLogo(); // show logo even if suppressed
697#ifndef VBOX_ONLY_DOCS
698 if (g_fInternalMode)
699 printUsageInternal(u64Cmd);
700 else
701 printUsage(u64Cmd);
702#endif /* !VBOX_ONLY_DOCS */
703 va_start(args, pszFormat);
704 RTPrintf("\n"
705 "Syntax error: %N\n", pszFormat, &args);
706 va_end(args);
707 return 1;
708}
709
710/**
711 * errorSyntax for RTGetOpt users.
712 *
713 * @returns 1.
714 *
715 * @param fUsageCategory The usage category of the command.
716 * @param rc The RTGetOpt return code.
717 * @param pValueUnion The value union.
718 */
719int errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
720{
721 showLogo(); // show logo even if suppressed
722#ifndef VBOX_ONLY_DOCS
723 if (g_fInternalMode)
724 printUsageInternal(fUsageCategory);
725 else
726 printUsage(fUsageCategory);
727#endif /* !VBOX_ONLY_DOCS */
728
729 if (rc == VINF_GETOPT_NOT_OPTION)
730 return RTPrintf("error: Invalid parameter '%s'\n", pValueUnion->psz);
731 if (rc > 0)
732 {
733 if (RT_C_IS_PRINT(rc))
734 return RTPrintf("error: Invalid option -%c\n", rc);
735 return RTPrintf("error: Invalid option case %i\n", rc);
736 }
737 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
738 return RTPrintf("error: unknown option: %s\n", pValueUnion->psz);
739 if (pValueUnion->pDef)
740 return RTPrintf("error: %s: %Rrs\n", pValueUnion->pDef->pszLong, rc);
741 return RTPrintf("error: %Rrs\n", rc);
742}
743
744/**
745 * Print an error message without the syntax stuff.
746 */
747int errorArgument(const char *pszFormat, ...)
748{
749 va_list args;
750 va_start(args, pszFormat);
751 RTPrintf("error: %N\n", pszFormat, &args);
752 va_end(args);
753 return 1;
754}
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