1 | /* $Id: VBoxManageHelp.cpp 54725 2015-03-11 20:39:08Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - help and other message output.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2015 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/buildconfig.h>
|
---|
25 | #include <iprt/ctype.h>
|
---|
26 | #include <iprt/err.h>
|
---|
27 | #include <iprt/getopt.h>
|
---|
28 | #include <iprt/stream.h>
|
---|
29 |
|
---|
30 | #include "VBoxManage.h"
|
---|
31 |
|
---|
32 |
|
---|
33 |
|
---|
34 | void showLogo(PRTSTREAM pStrm)
|
---|
35 | {
|
---|
36 | static bool s_fShown; /* show only once */
|
---|
37 |
|
---|
38 | if (!s_fShown)
|
---|
39 | {
|
---|
40 | RTStrmPrintf(pStrm, VBOX_PRODUCT " Command Line Management Interface Version "
|
---|
41 | VBOX_VERSION_STRING "\n"
|
---|
42 | "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
|
---|
43 | "All rights reserved.\n"
|
---|
44 | "\n");
|
---|
45 | s_fShown = true;
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
|
---|
50 | {
|
---|
51 | bool fDumpOpts = false;
|
---|
52 | #ifdef RT_OS_LINUX
|
---|
53 | bool fLinux = true;
|
---|
54 | #else
|
---|
55 | bool fLinux = false;
|
---|
56 | #endif
|
---|
57 | #ifdef RT_OS_WINDOWS
|
---|
58 | bool fWin = true;
|
---|
59 | #else
|
---|
60 | bool fWin = false;
|
---|
61 | #endif
|
---|
62 | #ifdef RT_OS_SOLARIS
|
---|
63 | bool fSolaris = true;
|
---|
64 | #else
|
---|
65 | bool fSolaris = false;
|
---|
66 | #endif
|
---|
67 | #ifdef RT_OS_FREEBSD
|
---|
68 | bool fFreeBSD = true;
|
---|
69 | #else
|
---|
70 | bool fFreeBSD = false;
|
---|
71 | #endif
|
---|
72 | #ifdef RT_OS_DARWIN
|
---|
73 | bool fDarwin = true;
|
---|
74 | #else
|
---|
75 | bool fDarwin = false;
|
---|
76 | #endif
|
---|
77 | #ifdef VBOX_WITH_VBOXSDL
|
---|
78 | bool fVBoxSDL = true;
|
---|
79 | #else
|
---|
80 | bool fVBoxSDL = false;
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | if (fCategory == USAGE_DUMPOPTS)
|
---|
84 | {
|
---|
85 | fDumpOpts = true;
|
---|
86 | fLinux = true;
|
---|
87 | fWin = true;
|
---|
88 | fSolaris = true;
|
---|
89 | fFreeBSD = true;
|
---|
90 | fDarwin = true;
|
---|
91 | fVBoxSDL = true;
|
---|
92 | fCategory = USAGE_ALL;
|
---|
93 | }
|
---|
94 |
|
---|
95 | RTStrmPrintf(pStrm,
|
---|
96 | "Usage:\n"
|
---|
97 | "\n");
|
---|
98 |
|
---|
99 | if (fCategory == USAGE_ALL)
|
---|
100 | RTStrmPrintf(pStrm,
|
---|
101 | " VBoxManage [<general option>] <command>\n"
|
---|
102 | " \n \n"
|
---|
103 | "General Options:\n \n"
|
---|
104 | " [-v|--version] print version number and exit\n"
|
---|
105 | " [-q|--nologo] suppress the logo\n"
|
---|
106 | " [--settingspw <pw>] provide the settings password\n"
|
---|
107 | " [--settingspwfile <file>] provide a file containing the settings password\n"
|
---|
108 | " \n \n"
|
---|
109 | "Commands:\n \n");
|
---|
110 |
|
---|
111 | const char *pcszSep1 = " ";
|
---|
112 | const char *pcszSep2 = " ";
|
---|
113 | if (fCategory != USAGE_ALL)
|
---|
114 | {
|
---|
115 | pcszSep1 = "VBoxManage";
|
---|
116 | pcszSep2 = "";
|
---|
117 | }
|
---|
118 |
|
---|
119 | #define SEP pcszSep1, pcszSep2
|
---|
120 |
|
---|
121 | if (fCategory & USAGE_LIST)
|
---|
122 | RTStrmPrintf(pStrm,
|
---|
123 | "%s list [--long|-l]%s vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
|
---|
124 | #if defined(VBOX_WITH_NETFLT)
|
---|
125 | " intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|\n"
|
---|
126 | #else
|
---|
127 | " intnets|bridgedifs|natnets|dhcpservers|hostinfo|\n"
|
---|
128 | #endif
|
---|
129 | " hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|\n"
|
---|
130 | " usbhost|usbfilters|systemproperties|extpacks|\n"
|
---|
131 | " groups|webcams|screenshotformats\n"
|
---|
132 | "\n", SEP);
|
---|
133 |
|
---|
134 | if (fCategory & USAGE_SHOWVMINFO)
|
---|
135 | RTStrmPrintf(pStrm,
|
---|
136 | "%s showvminfo %s <uuid|vmname> [--details]\n"
|
---|
137 | " [--machinereadable]\n"
|
---|
138 | "%s showvminfo %s <uuid|vmname> --log <idx>\n"
|
---|
139 | "\n", SEP, SEP);
|
---|
140 |
|
---|
141 | if (fCategory & USAGE_REGISTERVM)
|
---|
142 | RTStrmPrintf(pStrm,
|
---|
143 | "%s registervm %s <filename>\n"
|
---|
144 | "\n", SEP);
|
---|
145 |
|
---|
146 | if (fCategory & USAGE_UNREGISTERVM)
|
---|
147 | RTStrmPrintf(pStrm,
|
---|
148 | "%s unregistervm %s <uuid|vmname> [--delete]\n"
|
---|
149 | "\n", SEP);
|
---|
150 |
|
---|
151 | if (fCategory & USAGE_CREATEVM)
|
---|
152 | RTStrmPrintf(pStrm,
|
---|
153 | "%s createvm %s --name <name>\n"
|
---|
154 | " [--groups <group>, ...]\n"
|
---|
155 | " [--ostype <ostype>]\n"
|
---|
156 | " [--register]\n"
|
---|
157 | " [--basefolder <path>]\n"
|
---|
158 | " [--uuid <uuid>]\n"
|
---|
159 | "\n", SEP);
|
---|
160 |
|
---|
161 | if (fCategory & USAGE_MODIFYVM)
|
---|
162 | {
|
---|
163 | RTStrmPrintf(pStrm,
|
---|
164 | "%s modifyvm %s <uuid|vmname>\n"
|
---|
165 | " [--name <name>]\n"
|
---|
166 | " [--groups <group>, ...]\n"
|
---|
167 | " [--description <desc>]\n"
|
---|
168 | " [--ostype <ostype>]\n"
|
---|
169 | " [--iconfile <filename>]\n"
|
---|
170 | " [--memory <memorysize in MB>]\n"
|
---|
171 | " [--pagefusion on|off]\n"
|
---|
172 | " [--vram <vramsize in MB>]\n"
|
---|
173 | " [--acpi on|off]\n"
|
---|
174 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
175 | " [--pciattach 03:04.0]\n"
|
---|
176 | " [--pciattach 03:04.0@02:01.0]\n"
|
---|
177 | " [--pcidetach 03:04.0]\n"
|
---|
178 | #endif
|
---|
179 | " [--ioapic on|off]\n"
|
---|
180 | " [--hpet on|off]\n"
|
---|
181 | " [--triplefaultreset on|off]\n"
|
---|
182 | " [--paravirtprovider none|default|legacy|minimal|\n"
|
---|
183 | " hyperv]\n"
|
---|
184 | " [--hwvirtex on|off]\n"
|
---|
185 | " [--nestedpaging on|off]\n"
|
---|
186 | " [--largepages on|off]\n"
|
---|
187 | " [--vtxvpid on|off]\n"
|
---|
188 | " [--vtxux on|off]\n"
|
---|
189 | " [--pae on|off]\n"
|
---|
190 | " [--longmode on|off]\n"
|
---|
191 | " [--synthcpu on|off]\n"
|
---|
192 | " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
|
---|
193 | " [--cpuidremove <leaf>]\n"
|
---|
194 | " [--cpuidremoveall]\n"
|
---|
195 | " [--hardwareuuid <uuid>]\n"
|
---|
196 | " [--cpus <number>]\n"
|
---|
197 | " [--cpuhotplug on|off]\n"
|
---|
198 | " [--plugcpu <id>]\n"
|
---|
199 | " [--unplugcpu <id>]\n"
|
---|
200 | " [--cpuexecutioncap <1-100>]\n"
|
---|
201 | " [--rtcuseutc on|off]\n"
|
---|
202 | #ifdef VBOX_WITH_VMSVGA
|
---|
203 | " [--graphicscontroller none|vboxvga|vmsvga]\n"
|
---|
204 | #else
|
---|
205 | " [--graphicscontroller none|vboxvga]\n"
|
---|
206 | #endif
|
---|
207 | " [--monitorcount <number>]\n"
|
---|
208 | " [--accelerate3d on|off]\n"
|
---|
209 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
210 | " [--accelerate2dvideo on|off]\n"
|
---|
211 | #endif
|
---|
212 | " [--firmware bios|efi|efi32|efi64]\n"
|
---|
213 | " [--chipset ich9|piix3]\n"
|
---|
214 | " [--bioslogofadein on|off]\n"
|
---|
215 | " [--bioslogofadeout on|off]\n"
|
---|
216 | " [--bioslogodisplaytime <msec>]\n"
|
---|
217 | " [--bioslogoimagepath <imagepath>]\n"
|
---|
218 | " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
|
---|
219 | " [--biossystemtimeoffset <msec>]\n"
|
---|
220 | " [--biospxedebug on|off]\n"
|
---|
221 | " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
|
---|
222 | " [--nic<1-N> none|null|nat|bridged|intnet"
|
---|
223 | #if defined(VBOX_WITH_NETFLT)
|
---|
224 | "|hostonly"
|
---|
225 | #endif
|
---|
226 | "|\n"
|
---|
227 | " generic|natnetwork"
|
---|
228 | "]\n"
|
---|
229 | " [--nictype<1-N> Am79C970A|Am79C973"
|
---|
230 | #ifdef VBOX_WITH_E1000
|
---|
231 | "|\n 82540EM|82543GC|82545EM"
|
---|
232 | #endif
|
---|
233 | #ifdef VBOX_WITH_VIRTIO
|
---|
234 | "|\n virtio"
|
---|
235 | #endif /* VBOX_WITH_VIRTIO */
|
---|
236 | "]\n"
|
---|
237 | " [--cableconnected<1-N> on|off]\n"
|
---|
238 | " [--nictrace<1-N> on|off]\n"
|
---|
239 | " [--nictracefile<1-N> <filename>]\n"
|
---|
240 | " [--nicproperty<1-N> name=[value]]\n"
|
---|
241 | " [--nicspeed<1-N> <kbps>]\n"
|
---|
242 | " [--nicbootprio<1-N> <priority>]\n"
|
---|
243 | " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
|
---|
244 | " [--nicbandwidthgroup<1-N> none|<name>]\n"
|
---|
245 | " [--bridgeadapter<1-N> none|<devicename>]\n"
|
---|
246 | #if defined(VBOX_WITH_NETFLT)
|
---|
247 | " [--hostonlyadapter<1-N> none|<devicename>]\n"
|
---|
248 | #endif
|
---|
249 | " [--intnet<1-N> <network name>]\n"
|
---|
250 | " [--nat-network<1-N> <network name>]\n"
|
---|
251 | " [--nicgenericdrv<1-N> <driver>\n"
|
---|
252 | " [--natnet<1-N> <network>|default]\n"
|
---|
253 | " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
|
---|
254 | " [<sockrcv>],[<tcpsnd>],\n"
|
---|
255 | " [<tcprcv>]]\n"
|
---|
256 | " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
|
---|
257 | " <hostport>,[<guestip>],<guestport>]\n"
|
---|
258 | " [--natpf<1-N> delete <rulename>]\n"
|
---|
259 | " [--nattftpprefix<1-N> <prefix>]\n"
|
---|
260 | " [--nattftpfile<1-N> <file>]\n"
|
---|
261 | " [--nattftpserver<1-N> <ip>]\n"
|
---|
262 | " [--natbindip<1-N> <ip>\n"
|
---|
263 | " [--natdnspassdomain<1-N> on|off]\n"
|
---|
264 | " [--natdnsproxy<1-N> on|off]\n"
|
---|
265 | " [--natdnshostresolver<1-N> on|off]\n"
|
---|
266 | " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
|
---|
267 | " [sameports]]\n"
|
---|
268 | " [--macaddress<1-N> auto|<mac>]\n"
|
---|
269 | " [--mouse ps2|usb|usbtablet|usbmultitouch]\n"
|
---|
270 | " [--keyboard ps2|usb\n"
|
---|
271 | " [--uart<1-N> off|<I/O base> <IRQ>]\n"
|
---|
272 | " [--uartmode<1-N> disconnected|\n"
|
---|
273 | " server <pipe>|\n"
|
---|
274 | " client <pipe>|\n"
|
---|
275 | " file <file>|\n"
|
---|
276 | " <devicename>]\n"
|
---|
277 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
278 | " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
|
---|
279 | " [--lptmode<1-N> <devicename>]\n"
|
---|
280 | #endif
|
---|
281 | " [--guestmemoryballoon <balloonsize in MB>]\n"
|
---|
282 | " [--audio none|null", SEP);
|
---|
283 | if (fWin)
|
---|
284 | {
|
---|
285 | #ifdef VBOX_WITH_WINMM
|
---|
286 | RTStrmPrintf(pStrm, "|winmm|dsound");
|
---|
287 | #else
|
---|
288 | RTStrmPrintf(pStrm, "|dsound");
|
---|
289 | #endif
|
---|
290 | }
|
---|
291 | if (fSolaris)
|
---|
292 | {
|
---|
293 | RTStrmPrintf(pStrm, "|solaudio"
|
---|
294 | #ifdef VBOX_WITH_SOLARIS_OSS
|
---|
295 | "|oss"
|
---|
296 | #endif
|
---|
297 | );
|
---|
298 | }
|
---|
299 | if (fLinux)
|
---|
300 | {
|
---|
301 | RTStrmPrintf(pStrm, "|oss"
|
---|
302 | #ifdef VBOX_WITH_ALSA
|
---|
303 | "|alsa"
|
---|
304 | #endif
|
---|
305 | #ifdef VBOX_WITH_PULSE
|
---|
306 | "|pulse"
|
---|
307 | #endif
|
---|
308 | );
|
---|
309 | }
|
---|
310 | if (fFreeBSD)
|
---|
311 | {
|
---|
312 | /* Get the line break sorted when dumping all option variants. */
|
---|
313 | if (fDumpOpts)
|
---|
314 | {
|
---|
315 | RTStrmPrintf(pStrm, "|\n"
|
---|
316 | " oss");
|
---|
317 | }
|
---|
318 | else
|
---|
319 | RTStrmPrintf(pStrm, "|oss");
|
---|
320 | #ifdef VBOX_WITH_PULSE
|
---|
321 | RTStrmPrintf(pStrm, "|pulse");
|
---|
322 | #endif
|
---|
323 | }
|
---|
324 | if (fDarwin)
|
---|
325 | {
|
---|
326 | RTStrmPrintf(pStrm, "|coreaudio");
|
---|
327 | }
|
---|
328 | RTStrmPrintf(pStrm, "]\n");
|
---|
329 | RTStrmPrintf(pStrm,
|
---|
330 | " [--audiocontroller ac97|hda|sb16]\n"
|
---|
331 | " [--clipboard disabled|hosttoguest|guesttohost|\n"
|
---|
332 | " bidirectional]\n"
|
---|
333 | " [--draganddrop disabled|hosttoguest]\n");
|
---|
334 | RTStrmPrintf(pStrm,
|
---|
335 | " [--vrde on|off]\n"
|
---|
336 | " [--vrdeextpack default|<name>\n"
|
---|
337 | " [--vrdeproperty <name=[value]>]\n"
|
---|
338 | " [--vrdeport <hostport>]\n"
|
---|
339 | " [--vrdeaddress <hostip>]\n"
|
---|
340 | " [--vrdeauthtype null|external|guest]\n"
|
---|
341 | " [--vrdeauthlibrary default|<name>\n"
|
---|
342 | " [--vrdemulticon on|off]\n"
|
---|
343 | " [--vrdereusecon on|off]\n"
|
---|
344 | " [--vrdevideochannel on|off]\n"
|
---|
345 | " [--vrdevideochannelquality <percent>]\n");
|
---|
346 | RTStrmPrintf(pStrm,
|
---|
347 | " [--usb on|off]\n"
|
---|
348 | " [--usbehci on|off]\n"
|
---|
349 | " [--snapshotfolder default|<path>]\n"
|
---|
350 | " [--teleporter on|off]\n"
|
---|
351 | " [--teleporterport <port>]\n"
|
---|
352 | " [--teleporteraddress <address|empty>\n"
|
---|
353 | " [--teleporterpassword <password>]\n"
|
---|
354 | " [--teleporterpasswordfile <file>|stdin]\n"
|
---|
355 | " [--tracing-enabled on|off]\n"
|
---|
356 | " [--tracing-config <config-string>]\n"
|
---|
357 | " [--tracing-allow-vm-access on|off]\n"
|
---|
358 | #if 0
|
---|
359 | " [--iocache on|off]\n"
|
---|
360 | " [--iocachesize <I/O cache size in MB>]\n"
|
---|
361 | #endif
|
---|
362 | #if 0
|
---|
363 | " [--faulttolerance master|standby]\n"
|
---|
364 | " [--faulttoleranceaddress <name>]\n"
|
---|
365 | " [--faulttoleranceport <port>]\n"
|
---|
366 | " [--faulttolerancesyncinterval <msec>]\n"
|
---|
367 | " [--faulttolerancepassword <password>]\n"
|
---|
368 | #endif
|
---|
369 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
370 | " [--usbcardreader on|off]\n"
|
---|
371 | #endif
|
---|
372 | " [--autostart-enabled on|off]\n"
|
---|
373 | " [--autostart-delay <seconds>]\n"
|
---|
374 | #if 0
|
---|
375 | " [--autostop-type disabled|savestate|poweroff|\n"
|
---|
376 | " acpishutdown]\n"
|
---|
377 | #endif
|
---|
378 | #ifdef VBOX_WITH_VPX
|
---|
379 | " [--videocap on|off]\n"
|
---|
380 | " [--videocapscreens all|<screen ID> [<screen ID> ...]]\n"
|
---|
381 | " [--videocapfile <filename>]\n"
|
---|
382 | " [--videocapres <width> <height>]\n"
|
---|
383 | " [--videocaprate <rate>]\n"
|
---|
384 | " [--videocapfps <fps>]\n"
|
---|
385 | " [--videocapmaxtime <time>]\n"
|
---|
386 | " [--videocapmaxsize <MB>]\n"
|
---|
387 | " [--videocapopts <key=value> [<key=value> ...]]\n"
|
---|
388 | #endif
|
---|
389 | " [--defaultfrontend default|<name>]\n"
|
---|
390 | "\n");
|
---|
391 | }
|
---|
392 |
|
---|
393 | if (fCategory & USAGE_CLONEVM)
|
---|
394 | RTStrmPrintf(pStrm,
|
---|
395 | "%s clonevm %s <uuid|vmname>\n"
|
---|
396 | " [--snapshot <uuid>|<name>]\n"
|
---|
397 | " [--mode machine|machineandchildren|all]\n"
|
---|
398 | " [--options link|keepallmacs|keepnatmacs|\n"
|
---|
399 | " keepdisknames]\n"
|
---|
400 | " [--name <name>]\n"
|
---|
401 | " [--groups <group>, ...]\n"
|
---|
402 | " [--basefolder <basefolder>]\n"
|
---|
403 | " [--uuid <uuid>]\n"
|
---|
404 | " [--register]\n"
|
---|
405 | "\n", SEP);
|
---|
406 |
|
---|
407 | if (fCategory & USAGE_IMPORTAPPLIANCE)
|
---|
408 | RTStrmPrintf(pStrm,
|
---|
409 | "%s import %s <ovfname/ovaname>\n"
|
---|
410 | " [--dry-run|-n]\n"
|
---|
411 | " [--options keepallmacs|keepnatmacs]\n"
|
---|
412 | " [more options]\n"
|
---|
413 | " (run with -n to have options displayed\n"
|
---|
414 | " for a particular OVF)\n\n", SEP);
|
---|
415 |
|
---|
416 | if (fCategory & USAGE_EXPORTAPPLIANCE)
|
---|
417 | RTStrmPrintf(pStrm,
|
---|
418 | "%s export %s <machines> --output|-o <name>.<ovf/ova>\n"
|
---|
419 | " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
|
---|
420 | " [--manifest]\n"
|
---|
421 | " [--iso]\n"
|
---|
422 | " [--options manifest|iso|nomacs|nomacsbutnat]\n"
|
---|
423 | " [--vsys <number of virtual system>]\n"
|
---|
424 | " [--product <product name>]\n"
|
---|
425 | " [--producturl <product url>]\n"
|
---|
426 | " [--vendor <vendor name>]\n"
|
---|
427 | " [--vendorurl <vendor url>]\n"
|
---|
428 | " [--version <version info>]\n"
|
---|
429 | " [--description <description info>]\n"
|
---|
430 | " [--eula <license text>]\n"
|
---|
431 | " [--eulafile <filename>]\n"
|
---|
432 | "\n", SEP);
|
---|
433 |
|
---|
434 | if (fCategory & USAGE_STARTVM)
|
---|
435 | {
|
---|
436 | RTStrmPrintf(pStrm,
|
---|
437 | "%s startvm %s <uuid|vmname>...\n"
|
---|
438 | " [--type gui", SEP);
|
---|
439 | if (fVBoxSDL)
|
---|
440 | RTStrmPrintf(pStrm, "|sdl");
|
---|
441 | RTStrmPrintf(pStrm, "|headless]\n");
|
---|
442 | RTStrmPrintf(pStrm,
|
---|
443 | "\n");
|
---|
444 | }
|
---|
445 |
|
---|
446 | if (fCategory & USAGE_CONTROLVM)
|
---|
447 | {
|
---|
448 | RTStrmPrintf(pStrm,
|
---|
449 | "%s controlvm %s <uuid|vmname>\n"
|
---|
450 | " pause|resume|reset|poweroff|savestate|\n"
|
---|
451 | " acpipowerbutton|acpisleepbutton|\n"
|
---|
452 | " keyboardputscancode <hex> [<hex> ...]|\n"
|
---|
453 | " setlinkstate<1-N> on|off |\n"
|
---|
454 | #if defined(VBOX_WITH_NETFLT)
|
---|
455 | " nic<1-N> null|nat|bridged|intnet|hostonly|generic|\n"
|
---|
456 | " natnetwork [<devicename>] |\n"
|
---|
457 | #else /* !VBOX_WITH_NETFLT */
|
---|
458 | " nic<1-N> null|nat|bridged|intnet|generic|natnetwork\n"
|
---|
459 | " [<devicename>] |\n"
|
---|
460 | #endif /* !VBOX_WITH_NETFLT */
|
---|
461 | " nictrace<1-N> on|off |\n"
|
---|
462 | " nictracefile<1-N> <filename> |\n"
|
---|
463 | " nicproperty<1-N> name=[value] |\n"
|
---|
464 | " nicpromisc<1-N> deny|allow-vms|allow-all |\n"
|
---|
465 | " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
|
---|
466 | " <hostport>,[<guestip>],<guestport> |\n"
|
---|
467 | " natpf<1-N> delete <rulename> |\n"
|
---|
468 | " guestmemoryballoon <balloonsize in MB> |\n"
|
---|
469 | " usbattach <uuid>|<address>\n"
|
---|
470 | " [--capturefile <filename>] |\n"
|
---|
471 | " usbdetach <uuid>|<address> |\n"
|
---|
472 | " clipboard disabled|hosttoguest|guesttohost|\n"
|
---|
473 | " bidirectional |\n"
|
---|
474 | " draganddrop disabled|hosttoguest |\n"
|
---|
475 | " vrde on|off |\n"
|
---|
476 | " vrdeport <port> |\n"
|
---|
477 | " vrdeproperty <name=[value]> |\n"
|
---|
478 | " vrdevideochannelquality <percent> |\n"
|
---|
479 | " setvideomodehint <xres> <yres> <bpp>\n"
|
---|
480 | " [[<display>] [<enabled:yes|no> |\n"
|
---|
481 | " [<xorigin> <yorigin>]]] |\n"
|
---|
482 | " screenshotpng <file> [display] |\n"
|
---|
483 | " vcpenabled on|off |\n"
|
---|
484 | " vcpscreens all|none|<screen>,[<screen>...] |\n"
|
---|
485 | " setcredentials <username>\n"
|
---|
486 | " --passwordfile <file> | <password>\n"
|
---|
487 | " <domain>\n"
|
---|
488 | " [--allowlocallogon <yes|no>] |\n"
|
---|
489 | " teleport --host <name> --port <port>\n"
|
---|
490 | " [--maxdowntime <msec>]\n"
|
---|
491 | " [--passwordfile <file> |\n"
|
---|
492 | " --password <password>] |\n"
|
---|
493 | " plugcpu <id> |\n"
|
---|
494 | " unplugcpu <id> |\n"
|
---|
495 | " cpuexecutioncap <1-100>\n"
|
---|
496 | " webcam <attach [path [settings]]> | <detach [path]> | <list>\n"
|
---|
497 | " addencpassword <id>\n"
|
---|
498 | " <password>\n"
|
---|
499 | " [--removeonsuspend <yes|no>]\n"
|
---|
500 | " removeencpassword <id>\n"
|
---|
501 | " removeallencpasswords\n"
|
---|
502 | "\n", SEP);
|
---|
503 | }
|
---|
504 |
|
---|
505 | if (fCategory & USAGE_DISCARDSTATE)
|
---|
506 | RTStrmPrintf(pStrm,
|
---|
507 | "%s discardstate %s <uuid|vmname>\n"
|
---|
508 | "\n", SEP);
|
---|
509 |
|
---|
510 | if (fCategory & USAGE_ADOPTSTATE)
|
---|
511 | RTStrmPrintf(pStrm,
|
---|
512 | "%s adoptstate %s <uuid|vmname> <state_file>\n"
|
---|
513 | "\n", SEP);
|
---|
514 |
|
---|
515 | if (fCategory & USAGE_SNAPSHOT)
|
---|
516 | RTStrmPrintf(pStrm,
|
---|
517 | "%s snapshot %s <uuid|vmname>\n"
|
---|
518 | " take <name> [--description <desc>] [--live] |\n"
|
---|
519 | " delete <uuid|snapname> |\n"
|
---|
520 | " restore <uuid|snapname> |\n"
|
---|
521 | " restorecurrent |\n"
|
---|
522 | " edit <uuid|snapname>|--current\n"
|
---|
523 | " [--name <name>]\n"
|
---|
524 | " [--description <desc>] |\n"
|
---|
525 | " list [--details|--machinereadable]\n"
|
---|
526 | " showvminfo <uuid|snapname>\n"
|
---|
527 | "\n", SEP);
|
---|
528 |
|
---|
529 | if (fCategory & USAGE_CLOSEMEDIUM)
|
---|
530 | RTStrmPrintf(pStrm,
|
---|
531 | "%s closemedium %s [disk|dvd|floppy] <uuid|filename>\n"
|
---|
532 | " [--delete]\n"
|
---|
533 | "\n", SEP);
|
---|
534 |
|
---|
535 | if (fCategory & USAGE_STORAGEATTACH)
|
---|
536 | RTStrmPrintf(pStrm,
|
---|
537 | "%s storageattach %s <uuid|vmname>\n"
|
---|
538 | " --storagectl <name>\n"
|
---|
539 | " [--port <number>]\n"
|
---|
540 | " [--device <number>]\n"
|
---|
541 | " [--type dvddrive|hdd|fdd]\n"
|
---|
542 | " [--medium none|emptydrive|additions|\n"
|
---|
543 | " <uuid|filename>|host:<drive>|iscsi]\n"
|
---|
544 | " [--mtype normal|writethrough|immutable|shareable|\n"
|
---|
545 | " readonly|multiattach]\n"
|
---|
546 | " [--comment <text>]\n"
|
---|
547 | " [--setuuid <uuid>]\n"
|
---|
548 | " [--setparentuuid <uuid>]\n"
|
---|
549 | " [--passthrough on|off]\n"
|
---|
550 | " [--tempeject on|off]\n"
|
---|
551 | " [--nonrotational on|off]\n"
|
---|
552 | " [--discard on|off]\n"
|
---|
553 | " [--hotpluggable on|off]\n"
|
---|
554 | " [--bandwidthgroup <name>]\n"
|
---|
555 | " [--forceunmount]\n"
|
---|
556 | " [--server <name>|<ip>]\n"
|
---|
557 | " [--target <target>]\n"
|
---|
558 | " [--tport <port>]\n"
|
---|
559 | " [--lun <lun>]\n"
|
---|
560 | " [--encodedlun <lun>]\n"
|
---|
561 | " [--username <username>]\n"
|
---|
562 | " [--password <password>]\n"
|
---|
563 | " [--initiator <initiator>]\n"
|
---|
564 | " [--intnet]\n"
|
---|
565 | "\n", SEP);
|
---|
566 |
|
---|
567 | if (fCategory & USAGE_STORAGECONTROLLER)
|
---|
568 | RTStrmPrintf(pStrm,
|
---|
569 | "%s storagectl %s <uuid|vmname>\n"
|
---|
570 | " --name <name>\n"
|
---|
571 | " [--add ide|sata|scsi|floppy|sas]\n"
|
---|
572 | " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
|
---|
573 | " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
|
---|
574 | " [--portcount <1-n>]\n"
|
---|
575 | " [--hostiocache on|off]\n"
|
---|
576 | " [--bootable on|off]\n"
|
---|
577 | " [--remove]\n"
|
---|
578 | "\n", SEP);
|
---|
579 |
|
---|
580 | if (fCategory & USAGE_BANDWIDTHCONTROL)
|
---|
581 | RTStrmPrintf(pStrm,
|
---|
582 | "%s bandwidthctl %s <uuid|vmname>\n"
|
---|
583 | " add <name> --type disk|network\n"
|
---|
584 | " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
|
---|
585 | " set <name>\n"
|
---|
586 | " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
|
---|
587 | " remove <name> |\n"
|
---|
588 | " list [--machinereadable]\n"
|
---|
589 | " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
|
---|
590 | " K=kilobyte, M=megabyte, G=gigabyte)\n"
|
---|
591 | "\n", SEP);
|
---|
592 |
|
---|
593 | if (fCategory & USAGE_SHOWMEDIUMINFO)
|
---|
594 | RTStrmPrintf(pStrm,
|
---|
595 | "%s showmediuminfo %s [disk|dvd|floppy] <uuid|filename>\n"
|
---|
596 | "\n", SEP);
|
---|
597 |
|
---|
598 | if (fCategory & USAGE_CREATEMEDIUM)
|
---|
599 | RTStrmPrintf(pStrm,
|
---|
600 | "%s createmedium %s [disk|dvd|floppy] --filename <filename>\n"
|
---|
601 | " [--size <megabytes>|--sizebyte <bytes>]\n"
|
---|
602 | " [--diffparent <uuid>|<filename>\n"
|
---|
603 | " [--format VDI|VMDK|VHD] (default: VDI)\n"
|
---|
604 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
605 | "\n", SEP);
|
---|
606 |
|
---|
607 | if (fCategory & USAGE_MODIFYMEDIUM)
|
---|
608 | RTStrmPrintf(pStrm,
|
---|
609 | "%s modifymedium %s [disk|dvd|floppy] <uuid|filename>\n"
|
---|
610 | " [--type normal|writethrough|immutable|shareable|\n"
|
---|
611 | " readonly|multiattach]\n"
|
---|
612 | " [--autoreset on|off]\n"
|
---|
613 | " [--property <name=[value]>]\n"
|
---|
614 | " [--compact]\n"
|
---|
615 | " [--resize <megabytes>|--resizebyte <bytes>]\n"
|
---|
616 | "\n", SEP);
|
---|
617 |
|
---|
618 | if (fCategory & USAGE_CLONEMEDIUM)
|
---|
619 | RTStrmPrintf(pStrm,
|
---|
620 | "%s clonemedium %s [disk|dvd|floppy] <uuid|inputfile> <uuid|outputfile>\n"
|
---|
621 | " [--format VDI|VMDK|VHD|RAW|<other>]\n"
|
---|
622 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
623 | " [--existing]\n"
|
---|
624 | "\n", SEP);
|
---|
625 |
|
---|
626 | if (fCategory & USAGE_MEDIUMPROPERTY)
|
---|
627 | RTStrmPrintf(pStrm,
|
---|
628 | "%s mediumproperty %s [disk|dvd|floppy] set <uuid|filename>\n"
|
---|
629 | " <property> <value>\n"
|
---|
630 | "\n"
|
---|
631 | " [disk|dvd|floppy] get <uuid|filename>\n"
|
---|
632 | " <property>\n"
|
---|
633 | "\n"
|
---|
634 | " [disk|dvd|floppy] delete <uuid|filename>\n"
|
---|
635 | " <property>\n"
|
---|
636 | "\n", SEP);
|
---|
637 |
|
---|
638 | if (fCategory & USAGE_ENCRYPTMEDIUM)
|
---|
639 | RTStrmPrintf(pStrm,
|
---|
640 | "%s encryptmedium %s <uuid|filename>\n"
|
---|
641 | " [--newpassword <file>|-]\n"
|
---|
642 | " [--oldpassword <file>|-]\n"
|
---|
643 | " [--cipher <cipher identifier>]\n"
|
---|
644 | " [--newpasswordid <password identifier>]\n"
|
---|
645 | "\n", SEP);
|
---|
646 |
|
---|
647 | if (fCategory & USAGE_CONVERTFROMRAW)
|
---|
648 | RTStrmPrintf(pStrm,
|
---|
649 | "%s convertfromraw %s <filename> <outputfile>\n"
|
---|
650 | " [--format VDI|VMDK|VHD]\n"
|
---|
651 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
652 | " [--uuid <uuid>]\n"
|
---|
653 | "%s convertfromraw %s stdin <outputfile> <bytes>\n"
|
---|
654 | " [--format VDI|VMDK|VHD]\n"
|
---|
655 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
656 | " [--uuid <uuid>]\n"
|
---|
657 | "\n", SEP, SEP);
|
---|
658 |
|
---|
659 | if (fCategory & USAGE_GETEXTRADATA)
|
---|
660 | RTStrmPrintf(pStrm,
|
---|
661 | "%s getextradata %s global|<uuid|vmname>\n"
|
---|
662 | " <key>|enumerate\n"
|
---|
663 | "\n", SEP);
|
---|
664 |
|
---|
665 | if (fCategory & USAGE_SETEXTRADATA)
|
---|
666 | RTStrmPrintf(pStrm,
|
---|
667 | "%s setextradata %s global|<uuid|vmname>\n"
|
---|
668 | " <key>\n"
|
---|
669 | " [<value>] (no value deletes key)\n"
|
---|
670 | "\n", SEP);
|
---|
671 |
|
---|
672 | if (fCategory & USAGE_SETPROPERTY)
|
---|
673 | RTStrmPrintf(pStrm,
|
---|
674 | "%s setproperty %s machinefolder default|<folder> |\n"
|
---|
675 | " hwvirtexclusive on|off |\n"
|
---|
676 | " vrdeauthlibrary default|<library> |\n"
|
---|
677 | " websrvauthlibrary default|null|<library> |\n"
|
---|
678 | " vrdeextpack null|<library> |\n"
|
---|
679 | " autostartdbpath null|<folder> |\n"
|
---|
680 | " loghistorycount <value>\n"
|
---|
681 | " defaultfrontend default|<name>\n"
|
---|
682 | "\n", SEP);
|
---|
683 |
|
---|
684 | if (fCategory & USAGE_USBFILTER_ADD)
|
---|
685 | RTStrmPrintf(pStrm,
|
---|
686 | "%s usbfilter %s add <index,0-N>\n"
|
---|
687 | " --target <uuid|vmname>|global\n"
|
---|
688 | " --name <string>\n"
|
---|
689 | " --action ignore|hold (global filters only)\n"
|
---|
690 | " [--active yes|no] (yes)\n"
|
---|
691 | " [--vendorid <XXXX>] (null)\n"
|
---|
692 | " [--productid <XXXX>] (null)\n"
|
---|
693 | " [--revision <IIFF>] (null)\n"
|
---|
694 | " [--manufacturer <string>] (null)\n"
|
---|
695 | " [--product <string>] (null)\n"
|
---|
696 | " [--remote yes|no] (null, VM filters only)\n"
|
---|
697 | " [--serialnumber <string>] (null)\n"
|
---|
698 | " [--maskedinterfaces <XXXXXXXX>]\n"
|
---|
699 | "\n", SEP);
|
---|
700 |
|
---|
701 | if (fCategory & USAGE_USBFILTER_MODIFY)
|
---|
702 | RTStrmPrintf(pStrm,
|
---|
703 | "%s usbfilter %s modify <index,0-N>\n"
|
---|
704 | " --target <uuid|vmname>|global\n"
|
---|
705 | " [--name <string>]\n"
|
---|
706 | " [--action ignore|hold] (global filters only)\n"
|
---|
707 | " [--active yes|no]\n"
|
---|
708 | " [--vendorid <XXXX>|\"\"]\n"
|
---|
709 | " [--productid <XXXX>|\"\"]\n"
|
---|
710 | " [--revision <IIFF>|\"\"]\n"
|
---|
711 | " [--manufacturer <string>|\"\"]\n"
|
---|
712 | " [--product <string>|\"\"]\n"
|
---|
713 | " [--remote yes|no] (null, VM filters only)\n"
|
---|
714 | " [--serialnumber <string>|\"\"]\n"
|
---|
715 | " [--maskedinterfaces <XXXXXXXX>]\n"
|
---|
716 | "\n", SEP);
|
---|
717 |
|
---|
718 | if (fCategory & USAGE_USBFILTER_REMOVE)
|
---|
719 | RTStrmPrintf(pStrm,
|
---|
720 | "%s usbfilter %s remove <index,0-N>\n"
|
---|
721 | " --target <uuid|vmname>|global\n"
|
---|
722 | "\n", SEP);
|
---|
723 |
|
---|
724 | if (fCategory & USAGE_SHAREDFOLDER_ADD)
|
---|
725 | RTStrmPrintf(pStrm,
|
---|
726 | "%s sharedfolder %s add <uuid|vmname>\n"
|
---|
727 | " --name <name> --hostpath <hostpath>\n"
|
---|
728 | " [--transient] [--readonly] [--automount]\n"
|
---|
729 | "\n", SEP);
|
---|
730 |
|
---|
731 | if (fCategory & USAGE_SHAREDFOLDER_REMOVE)
|
---|
732 | RTStrmPrintf(pStrm,
|
---|
733 | "%s sharedfolder %s remove <uuid|vmname>\n"
|
---|
734 | " --name <name> [--transient]\n"
|
---|
735 | "\n", SEP);
|
---|
736 |
|
---|
737 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
738 | if (fCategory & USAGE_GUESTPROPERTY)
|
---|
739 | usageGuestProperty(pStrm, SEP);
|
---|
740 | #endif /* VBOX_WITH_GUEST_PROPS defined */
|
---|
741 |
|
---|
742 | #ifdef VBOX_WITH_GUEST_CONTROL
|
---|
743 | if (fCategory & USAGE_GUESTCONTROL)
|
---|
744 | usageGuestControl(pStrm, SEP, fSubCategory);
|
---|
745 | #endif /* VBOX_WITH_GUEST_CONTROL defined */
|
---|
746 |
|
---|
747 | if (fCategory & USAGE_DEBUGVM)
|
---|
748 | {
|
---|
749 | RTStrmPrintf(pStrm,
|
---|
750 | "%s debugvm %s <uuid|vmname>\n"
|
---|
751 | " dumpguestcore --filename <name> |\n"
|
---|
752 | " info <item> [args] |\n"
|
---|
753 | " injectnmi |\n"
|
---|
754 | " log [--release|--debug] <settings> ...|\n"
|
---|
755 | " logdest [--release|--debug] <settings> ...|\n"
|
---|
756 | " logflags [--release|--debug] <settings> ...|\n"
|
---|
757 | " osdetect |\n"
|
---|
758 | " osinfo |\n"
|
---|
759 | " getregisters [--cpu <id>] <reg>|all ... |\n"
|
---|
760 | " setregisters [--cpu <id>] <reg>=<value> ... |\n"
|
---|
761 | " show [--human-readable|--sh-export|--sh-eval|\n"
|
---|
762 | " --cmd-set] \n"
|
---|
763 | " <logdbg-settings|logrel-settings>\n"
|
---|
764 | " [[opt] what ...] |\n"
|
---|
765 | " statistics [--reset] [--pattern <pattern>]\n"
|
---|
766 | " [--descriptions]\n"
|
---|
767 | "\n", SEP);
|
---|
768 | }
|
---|
769 | if (fCategory & USAGE_METRICS)
|
---|
770 | RTStrmPrintf(pStrm,
|
---|
771 | "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
|
---|
772 | " (comma-separated)\n\n"
|
---|
773 | "%s metrics %s setup\n"
|
---|
774 | " [--period <seconds>] (default: 1)\n"
|
---|
775 | " [--samples <count>] (default: 1)\n"
|
---|
776 | " [--list]\n"
|
---|
777 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
778 | "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
779 | "%s metrics %s enable\n"
|
---|
780 | " [--list]\n"
|
---|
781 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
782 | "%s metrics %s disable\n"
|
---|
783 | " [--list]\n"
|
---|
784 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
785 | "%s metrics %s collect\n"
|
---|
786 | " [--period <seconds>] (default: 1)\n"
|
---|
787 | " [--samples <count>] (default: 1)\n"
|
---|
788 | " [--list]\n"
|
---|
789 | " [--detach]\n"
|
---|
790 | " [*|host|<vmname> [<metric_list>]]\n"
|
---|
791 | "\n", SEP, SEP, SEP, SEP, SEP, SEP);
|
---|
792 |
|
---|
793 | #if defined(VBOX_WITH_NAT_SERVICE)
|
---|
794 | if (fCategory & USAGE_NATNETWORK)
|
---|
795 | {
|
---|
796 | RTStrmPrintf(pStrm,
|
---|
797 | "%s natnetwork %s add --netname <name>\n"
|
---|
798 | " --network <network>\n"
|
---|
799 | " [--enable|--disable]\n"
|
---|
800 | " [--dhcp on|off]\n"
|
---|
801 | " [--port-forward-4 <rule>]\n"
|
---|
802 | " [--loopback-4 <rule>]\n"
|
---|
803 | " [--ipv6 on|off]\n"
|
---|
804 | " [--port-forward-6 <rule>]\n"
|
---|
805 | " [--loopback-6 <rule>]\n\n"
|
---|
806 | "%s natnetwork %s remove --netname <name>\n\n"
|
---|
807 | "%s natnetwork %s modify --netname <name>\n"
|
---|
808 | " [--network <network>]\n"
|
---|
809 | " [--enable|--disable]\n"
|
---|
810 | " [--dhcp on|off]\n"
|
---|
811 | " [--port-forward-4 <rule>]\n"
|
---|
812 | " [--loopback-4 <rule>]\n"
|
---|
813 | " [--ipv6 on|off]\n"
|
---|
814 | " [--port-forward-6 <rule>]\n"
|
---|
815 | " [--loopback-6 <rule>]\n\n"
|
---|
816 | "%s natnetwork %s start --netname <name>\n\n"
|
---|
817 | "%s natnetwork %s stop --netname <name>\n"
|
---|
818 | "\n", SEP, SEP, SEP, SEP, SEP);
|
---|
819 |
|
---|
820 |
|
---|
821 | }
|
---|
822 | #endif
|
---|
823 |
|
---|
824 | #if defined(VBOX_WITH_NETFLT)
|
---|
825 | if (fCategory & USAGE_HOSTONLYIFS)
|
---|
826 | {
|
---|
827 | RTStrmPrintf(pStrm,
|
---|
828 | "%s hostonlyif %s ipconfig <name>\n"
|
---|
829 | " [--dhcp |\n"
|
---|
830 | " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
|
---|
831 | " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
|
---|
832 | # if !defined(RT_OS_SOLARIS)
|
---|
833 | " create |\n"
|
---|
834 | " remove <name>\n"
|
---|
835 | # endif
|
---|
836 | "\n", SEP);
|
---|
837 | }
|
---|
838 | #endif
|
---|
839 |
|
---|
840 | if (fCategory & USAGE_DHCPSERVER)
|
---|
841 | {
|
---|
842 | RTStrmPrintf(pStrm,
|
---|
843 | "%s dhcpserver %s add|modify --netname <network_name> |\n"
|
---|
844 | #if defined(VBOX_WITH_NETFLT)
|
---|
845 | " --ifname <hostonly_if_name>\n"
|
---|
846 | #endif
|
---|
847 | " [--ip <ip_address>\n"
|
---|
848 | " --netmask <network_mask>\n"
|
---|
849 | " --lowerip <lower_ip>\n"
|
---|
850 | " --upperip <upper_ip>]\n"
|
---|
851 | " [--enable | --disable]\n\n"
|
---|
852 | "%s dhcpserver %s remove --netname <network_name> |\n"
|
---|
853 | #if defined(VBOX_WITH_NETFLT)
|
---|
854 | " --ifname <hostonly_if_name>\n"
|
---|
855 | #endif
|
---|
856 | "\n", SEP, SEP);
|
---|
857 | }
|
---|
858 | if (fCategory & USAGE_EXTPACK)
|
---|
859 | {
|
---|
860 | RTStrmPrintf(pStrm,
|
---|
861 | "%s extpack %s install [--replace] <tarball> |\n"
|
---|
862 | " uninstall [--force] <name> |\n"
|
---|
863 | " cleanup\n"
|
---|
864 | "\n", SEP);
|
---|
865 | }
|
---|
866 | }
|
---|
867 |
|
---|
868 | /**
|
---|
869 | * Print a usage synopsis and the syntax error message.
|
---|
870 | * @returns RTEXITCODE_SYNTAX.
|
---|
871 | */
|
---|
872 | RTEXITCODE errorSyntax(USAGECATEGORY fCategory, const char *pszFormat, ...)
|
---|
873 | {
|
---|
874 | va_list args;
|
---|
875 | showLogo(g_pStdErr); // show logo even if suppressed
|
---|
876 | #ifndef VBOX_ONLY_DOCS
|
---|
877 | if (g_fInternalMode)
|
---|
878 | printUsageInternal(fCategory, g_pStdErr);
|
---|
879 | else
|
---|
880 | printUsage(fCategory, ~0U, g_pStdErr);
|
---|
881 | #endif /* !VBOX_ONLY_DOCS */
|
---|
882 | va_start(args, pszFormat);
|
---|
883 | RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
|
---|
884 | va_end(args);
|
---|
885 | return RTEXITCODE_SYNTAX;
|
---|
886 | }
|
---|
887 |
|
---|
888 | /**
|
---|
889 | * Print a usage synopsis and the syntax error message.
|
---|
890 | * @returns RTEXITCODE_SYNTAX.
|
---|
891 | */
|
---|
892 | RTEXITCODE errorSyntaxEx(USAGECATEGORY fCategory, uint32_t fSubCategory, const char *pszFormat, ...)
|
---|
893 | {
|
---|
894 | va_list args;
|
---|
895 | showLogo(g_pStdErr); // show logo even if suppressed
|
---|
896 | #ifndef VBOX_ONLY_DOCS
|
---|
897 | if (g_fInternalMode)
|
---|
898 | printUsageInternal(fCategory, g_pStdErr);
|
---|
899 | else
|
---|
900 | printUsage(fCategory, fSubCategory, g_pStdErr);
|
---|
901 | #endif /* !VBOX_ONLY_DOCS */
|
---|
902 | va_start(args, pszFormat);
|
---|
903 | RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
|
---|
904 | va_end(args);
|
---|
905 | return RTEXITCODE_SYNTAX;
|
---|
906 | }
|
---|
907 |
|
---|
908 | /**
|
---|
909 | * errorSyntax for RTGetOpt users.
|
---|
910 | *
|
---|
911 | * @returns RTEXITCODE_SYNTAX.
|
---|
912 | *
|
---|
913 | * @param fCategory The usage category of the command.
|
---|
914 | * @param fSubCategory The usage sub-category of the command.
|
---|
915 | * @param rc The RTGetOpt return code.
|
---|
916 | * @param pValueUnion The value union.
|
---|
917 | */
|
---|
918 | RTEXITCODE errorGetOptEx(USAGECATEGORY fCategory, uint32_t fSubCategory, int rc, union RTGETOPTUNION const *pValueUnion)
|
---|
919 | {
|
---|
920 | /*
|
---|
921 | * Check if it is an unhandled standard option.
|
---|
922 | */
|
---|
923 | if (rc == 'V')
|
---|
924 | {
|
---|
925 | RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
|
---|
926 | return RTEXITCODE_SUCCESS;
|
---|
927 | }
|
---|
928 |
|
---|
929 | if (rc == 'h')
|
---|
930 | {
|
---|
931 | showLogo(g_pStdErr);
|
---|
932 | #ifndef VBOX_ONLY_DOCS
|
---|
933 | if (g_fInternalMode)
|
---|
934 | printUsageInternal(fCategory, g_pStdOut);
|
---|
935 | else
|
---|
936 | printUsage(fCategory, fSubCategory, g_pStdOut);
|
---|
937 | #endif
|
---|
938 | return RTEXITCODE_SUCCESS;
|
---|
939 | }
|
---|
940 |
|
---|
941 | /*
|
---|
942 | * General failure.
|
---|
943 | */
|
---|
944 | showLogo(g_pStdErr); // show logo even if suppressed
|
---|
945 | #ifndef VBOX_ONLY_DOCS
|
---|
946 | if (g_fInternalMode)
|
---|
947 | printUsageInternal(fCategory, g_pStdErr);
|
---|
948 | else
|
---|
949 | printUsage(fCategory, fSubCategory, g_pStdErr);
|
---|
950 | #endif /* !VBOX_ONLY_DOCS */
|
---|
951 |
|
---|
952 | if (rc == VINF_GETOPT_NOT_OPTION)
|
---|
953 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
|
---|
954 | if (rc > 0)
|
---|
955 | {
|
---|
956 | if (RT_C_IS_PRINT(rc))
|
---|
957 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
|
---|
958 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
|
---|
959 | }
|
---|
960 | if (rc == VERR_GETOPT_UNKNOWN_OPTION)
|
---|
961 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
|
---|
962 | if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
|
---|
963 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
|
---|
964 | if (pValueUnion->pDef)
|
---|
965 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
|
---|
966 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
|
---|
967 | }
|
---|
968 |
|
---|
969 | /**
|
---|
970 | * errorSyntax for RTGetOpt users.
|
---|
971 | *
|
---|
972 | * @returns RTEXITCODE_SYNTAX.
|
---|
973 | *
|
---|
974 | * @param fUsageCategory The usage category of the command.
|
---|
975 | * @param rc The RTGetOpt return code.
|
---|
976 | * @param pValueUnion The value union.
|
---|
977 | */
|
---|
978 | RTEXITCODE errorGetOpt(USAGECATEGORY fCategory, int rc, union RTGETOPTUNION const *pValueUnion)
|
---|
979 | {
|
---|
980 | return errorGetOptEx(fCategory, ~0U, rc, pValueUnion);
|
---|
981 | }
|
---|
982 |
|
---|
983 | /**
|
---|
984 | * Print an error message without the syntax stuff.
|
---|
985 | *
|
---|
986 | * @returns RTEXITCODE_SYNTAX.
|
---|
987 | */
|
---|
988 | RTEXITCODE errorArgument(const char *pszFormat, ...)
|
---|
989 | {
|
---|
990 | va_list args;
|
---|
991 | va_start(args, pszFormat);
|
---|
992 | RTMsgErrorV(pszFormat, args);
|
---|
993 | va_end(args);
|
---|
994 | return RTEXITCODE_SYNTAX;
|
---|
995 | }
|
---|