1 | /* $Id: VBoxManageHelp.cpp 17549 2009-03-09 06:27:25Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - help and other message output.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2009 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.215389.xyz. 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 | #include <iprt/stream.h>
|
---|
23 | #include <iprt/getopt.h>
|
---|
24 |
|
---|
25 | #include "VBoxManage.h"
|
---|
26 |
|
---|
27 | void printUsage(USAGECATEGORY u64Cmd)
|
---|
28 | {
|
---|
29 | #ifdef RT_OS_LINUX
|
---|
30 | bool fLinux = true;
|
---|
31 | #else
|
---|
32 | bool fLinux = false;
|
---|
33 | #endif
|
---|
34 | #ifdef RT_OS_WINDOWS
|
---|
35 | bool fWin = true;
|
---|
36 | #else
|
---|
37 | bool fWin = false;
|
---|
38 | #endif
|
---|
39 | #ifdef RT_OS_SOLARIS
|
---|
40 | bool fSolaris = true;
|
---|
41 | #else
|
---|
42 | bool fSolaris = false;
|
---|
43 | #endif
|
---|
44 | #ifdef RT_OS_DARWIN
|
---|
45 | bool fDarwin = true;
|
---|
46 | #else
|
---|
47 | bool fDarwin = false;
|
---|
48 | #endif
|
---|
49 | #ifdef VBOX_WITH_VRDP
|
---|
50 | bool fVRDP = true;
|
---|
51 | #else
|
---|
52 | bool fVRDP = false;
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | if (u64Cmd == USAGE_DUMPOPTS)
|
---|
56 | {
|
---|
57 | fLinux = true;
|
---|
58 | fWin = true;
|
---|
59 | fSolaris = true;
|
---|
60 | fDarwin = true;
|
---|
61 | fVRDP = true;
|
---|
62 | u64Cmd = USAGE_ALL;
|
---|
63 | }
|
---|
64 |
|
---|
65 | RTPrintf("Usage:\n"
|
---|
66 | "\n");
|
---|
67 |
|
---|
68 | if (u64Cmd == USAGE_ALL)
|
---|
69 | {
|
---|
70 | RTPrintf("VBoxManage [-v|-version] print version number and exit\n"
|
---|
71 | "VBoxManage -nologo ... suppress the logo\n"
|
---|
72 | "\n");
|
---|
73 | }
|
---|
74 |
|
---|
75 | if (u64Cmd & USAGE_LIST)
|
---|
76 | {
|
---|
77 | RTPrintf("VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
|
---|
78 | #if (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
|
---|
79 | " bridgedifs|hostonlyifs|hostinfo|hddbackends|hdds|dvds|floppies|\n"
|
---|
80 | #else
|
---|
81 | " bridgedifs|hostinfo|hddbackends|hdds|dvds|floppies|\n"
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | " usbhost|usbfilters|systemproperties\n"
|
---|
85 | "\n");
|
---|
86 | }
|
---|
87 |
|
---|
88 | if (u64Cmd & USAGE_SHOWVMINFO)
|
---|
89 | {
|
---|
90 | RTPrintf("VBoxManage showvminfo <uuid>|<name> [-details] [-statistics]\n"
|
---|
91 | " [-machinereadable]\n"
|
---|
92 | "\n");
|
---|
93 | }
|
---|
94 |
|
---|
95 | if (u64Cmd & USAGE_REGISTERVM)
|
---|
96 | {
|
---|
97 | RTPrintf("VBoxManage registervm <filename>\n"
|
---|
98 | "\n");
|
---|
99 | }
|
---|
100 |
|
---|
101 | if (u64Cmd & USAGE_UNREGISTERVM)
|
---|
102 | {
|
---|
103 | RTPrintf("VBoxManage unregistervm <uuid>|<name> [-delete]\n"
|
---|
104 | "\n");
|
---|
105 | }
|
---|
106 |
|
---|
107 | if (u64Cmd & USAGE_CREATEVM)
|
---|
108 | {
|
---|
109 | RTPrintf("VBoxManage createvm -name <name>\n"
|
---|
110 | " [-ostype <ostype>]\n"
|
---|
111 | " [-register]\n"
|
---|
112 | " [-basefolder <path> | -settingsfile <path>]\n"
|
---|
113 | " [-uuid <uuid>]\n"
|
---|
114 | "\n");
|
---|
115 | }
|
---|
116 |
|
---|
117 | if (u64Cmd & USAGE_IMPORTAPPLIANCE)
|
---|
118 | {
|
---|
119 | RTPrintf("VBoxManage import <ovf>\n"
|
---|
120 | "\n"); // @todo
|
---|
121 | }
|
---|
122 |
|
---|
123 | if (u64Cmd & USAGE_EXPORTAPPLIANCE)
|
---|
124 | {
|
---|
125 | RTPrintf("VBoxManage export <machines> [--output|-o] <ovf>\n"
|
---|
126 | "\n");
|
---|
127 | }
|
---|
128 |
|
---|
129 | if (u64Cmd & USAGE_MODIFYVM)
|
---|
130 | {
|
---|
131 | RTPrintf("VBoxManage modifyvm <uuid|name>\n"
|
---|
132 | " [-name <name>]\n"
|
---|
133 | " [-ostype <ostype>]\n"
|
---|
134 | " [-memory <memorysize in MB>]\n"
|
---|
135 | " [-vram <vramsize in MB>]\n"
|
---|
136 | " [-acpi on|off]\n"
|
---|
137 | " [-ioapic on|off]\n"
|
---|
138 | " [-pae on|off]\n"
|
---|
139 | " [-hwvirtex on|off|default]\n"
|
---|
140 | " [-nestedpaging on|off]\n"
|
---|
141 | " [-vtxvpid on|off]\n"
|
---|
142 | " [-monitorcount <number>]\n"
|
---|
143 | " [-accelerate3d <on|off>]\n"
|
---|
144 | " [-bioslogofadein on|off]\n"
|
---|
145 | " [-bioslogofadeout on|off]\n"
|
---|
146 | " [-bioslogodisplaytime <msec>]\n"
|
---|
147 | " [-bioslogoimagepath <imagepath>]\n"
|
---|
148 | " [-biosbootmenu disabled|menuonly|messageandmenu]\n"
|
---|
149 | " [-biossystemtimeoffset <msec>]\n"
|
---|
150 | " [-biospxedebug on|off]\n"
|
---|
151 | " [-boot<1-4> none|floppy|dvd|disk|net>]\n"
|
---|
152 | " [-hd<a|b|d> none|<uuid>|<filename>]\n"
|
---|
153 | " [-idecontroller PIIX3|PIIX4]\n"
|
---|
154 | #ifdef VBOX_WITH_AHCI
|
---|
155 | " [-sata on|off]\n"
|
---|
156 | " [-sataportcount <1-30>]\n"
|
---|
157 | " [-sataport<1-30> none|<uuid>|<filename>]\n"
|
---|
158 | " [-sataideemulation<1-4> <1-30>]\n"
|
---|
159 | #endif
|
---|
160 | " [-dvd none|<uuid>|<filename>|host:<drive>]\n"
|
---|
161 | " [-dvdpassthrough on|off]\n"
|
---|
162 | " [-floppy disabled|empty|<uuid>|\n"
|
---|
163 | " <filename>|host:<drive>]\n"
|
---|
164 | #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
|
---|
165 | " [-nic<1-N> none|null|nat|bridged|intnet|hostonly]\n"
|
---|
166 | #else /* !RT_OS_LINUX && !RT_OS_DARWIN */
|
---|
167 | " [-nic<1-N> none|null|nat|bridged|intnet]\n"
|
---|
168 | #endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
|
---|
169 | " [-nictype<1-N> Am79C970A|Am79C973"
|
---|
170 | #ifdef VBOX_WITH_E1000
|
---|
171 | "|82540EM|82543GC"
|
---|
172 | #endif
|
---|
173 | "]\n"
|
---|
174 | " [-cableconnected<1-N> on|off]\n"
|
---|
175 | " [-nictrace<1-N> on|off]\n"
|
---|
176 | " [-nictracefile<1-N> <filename>]\n"
|
---|
177 | " [-nicspeed<1-N> <kbps>]\n"
|
---|
178 | " [-bridgeadapter<1-N> none|<devicename>]\n"
|
---|
179 | #if (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
|
---|
180 | " [-hostonlyadapter<1-N> none|<devicename>]\n"
|
---|
181 | #endif
|
---|
182 | " [-intnet<1-N> <network name>]\n"
|
---|
183 | " [-natnet<1-N> <network>|default]\n"
|
---|
184 | " [-macaddress<1-N> auto|<mac>]\n"
|
---|
185 | " [-uart<1-N> off|<I/O base> <IRQ>]\n"
|
---|
186 | " [-uartmode<1-N> disconnected|\n"
|
---|
187 | " server <pipe>|\n"
|
---|
188 | " client <pipe>|\n"
|
---|
189 | " <devicename>]\n"
|
---|
190 | #ifdef VBOX_WITH_MEM_BALLOONING
|
---|
191 | " [-guestmemoryballoon <balloonsize in MB>]\n"
|
---|
192 | #endif
|
---|
193 | " [-gueststatisticsinterval <seconds>]\n"
|
---|
194 | );
|
---|
195 | RTPrintf(" [-audio none|null");
|
---|
196 | if (fWin)
|
---|
197 | {
|
---|
198 | #ifdef VBOX_WITH_WINMM
|
---|
199 | RTPrintf( "|winmm|dsound");
|
---|
200 | #else
|
---|
201 | RTPrintf( "|dsound");
|
---|
202 | #endif
|
---|
203 | }
|
---|
204 | if (fSolaris)
|
---|
205 | {
|
---|
206 | RTPrintf( "|solaudio");
|
---|
207 | }
|
---|
208 | if (fLinux)
|
---|
209 | {
|
---|
210 | RTPrintf( "|oss"
|
---|
211 | #ifdef VBOX_WITH_ALSA
|
---|
212 | "|alsa"
|
---|
213 | #endif
|
---|
214 | #ifdef VBOX_WITH_PULSE
|
---|
215 | "|pulse"
|
---|
216 | #endif
|
---|
217 | );
|
---|
218 | }
|
---|
219 | if (fDarwin)
|
---|
220 | {
|
---|
221 | RTPrintf( "|coreaudio");
|
---|
222 | }
|
---|
223 | RTPrintf( "]\n");
|
---|
224 | RTPrintf(" [-audiocontroller ac97|sb16]\n"
|
---|
225 | " [-clipboard disabled|hosttoguest|guesttohost|\n"
|
---|
226 | " bidirectional]\n");
|
---|
227 | if (fVRDP)
|
---|
228 | {
|
---|
229 | RTPrintf(" [-vrdp on|off]\n"
|
---|
230 | " [-vrdpport default|<port>]\n"
|
---|
231 | " [-vrdpaddress <host>]\n"
|
---|
232 | " [-vrdpauthtype null|external|guest]\n"
|
---|
233 | " [-vrdpmulticon on|off]\n"
|
---|
234 | " [-vrdpreusecon on|off]\n");
|
---|
235 | }
|
---|
236 | RTPrintf(" [-usb on|off]\n"
|
---|
237 | " [-usbehci on|off]\n"
|
---|
238 | " [-snapshotfolder default|<path>]\n");
|
---|
239 | RTPrintf("\n");
|
---|
240 | }
|
---|
241 |
|
---|
242 | if (u64Cmd & USAGE_STARTVM)
|
---|
243 | {
|
---|
244 | RTPrintf("VBoxManage startvm <uuid>|<name>\n");
|
---|
245 | if (fVRDP)
|
---|
246 | RTPrintf(" [-type gui|vrdp]\n");
|
---|
247 | RTPrintf("\n");
|
---|
248 | }
|
---|
249 |
|
---|
250 | if (u64Cmd & USAGE_CONTROLVM)
|
---|
251 | {
|
---|
252 | RTPrintf("VBoxManage controlvm <uuid>|<name>\n"
|
---|
253 | " pause|resume|reset|poweroff|savestate|\n"
|
---|
254 | " acpipowerbutton|acpisleepbutton|\n"
|
---|
255 | " keyboardputscancode <hex> [<hex> ...]|\n"
|
---|
256 | " injectnmi|\n"
|
---|
257 | " setlinkstate<1-4> on|off |\n"
|
---|
258 | " usbattach <uuid>|<address> |\n"
|
---|
259 | " usbdetach <uuid>|<address> |\n"
|
---|
260 | " dvdattach none|<uuid>|<filename>|host:<drive> |\n"
|
---|
261 | " floppyattach none|<uuid>|<filename>|host:<drive> |\n");
|
---|
262 | if (fVRDP)
|
---|
263 | {
|
---|
264 | RTPrintf(" vrdp on|off] |\n");
|
---|
265 | }
|
---|
266 | RTPrintf(" setvideomodehint <xres> <yres> <bpp> [display]|\n"
|
---|
267 | " setcredentials <username> <password> <domain>\n"
|
---|
268 | " [-allowlocallogon <yes|no>]\n"
|
---|
269 | "\n");
|
---|
270 | }
|
---|
271 |
|
---|
272 | if (u64Cmd & USAGE_DISCARDSTATE)
|
---|
273 | {
|
---|
274 | RTPrintf("VBoxManage discardstate <uuid>|<name>\n"
|
---|
275 | "\n");
|
---|
276 | }
|
---|
277 |
|
---|
278 | if (u64Cmd & USAGE_ADOPTSTATE)
|
---|
279 | {
|
---|
280 | RTPrintf("VBoxManage adoptstate <uuid>|<name> <state_file>\n"
|
---|
281 | "\n");
|
---|
282 | }
|
---|
283 |
|
---|
284 | if (u64Cmd & USAGE_SNAPSHOT)
|
---|
285 | {
|
---|
286 | RTPrintf("VBoxManage snapshot <uuid>|<name>\n"
|
---|
287 | " take <name> [-desc <desc>] |\n"
|
---|
288 | " discard <uuid>|<name> |\n"
|
---|
289 | " discardcurrent -state|-all |\n"
|
---|
290 | " edit <uuid>|<name>|-current\n"
|
---|
291 | " [-newname <name>]\n"
|
---|
292 | " [-newdesc <desc>] |\n"
|
---|
293 | " showvminfo <uuid>|<name>\n"
|
---|
294 | "\n");
|
---|
295 | }
|
---|
296 |
|
---|
297 | if (u64Cmd & USAGE_REGISTERIMAGE)
|
---|
298 | {
|
---|
299 | RTPrintf("VBoxManage openmedium disk|dvd|floppy <filename>\n"
|
---|
300 | " [-type normal|immutable|writethrough] (disk only)\n"
|
---|
301 | "\n");
|
---|
302 | }
|
---|
303 |
|
---|
304 | if (u64Cmd & USAGE_UNREGISTERIMAGE)
|
---|
305 | {
|
---|
306 | RTPrintf("VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
|
---|
307 | "\n");
|
---|
308 | }
|
---|
309 |
|
---|
310 | if (u64Cmd & USAGE_SHOWHDINFO)
|
---|
311 | {
|
---|
312 | RTPrintf("VBoxManage showhdinfo <uuid>|<filename>\n"
|
---|
313 | "\n");
|
---|
314 | }
|
---|
315 |
|
---|
316 | if (u64Cmd & USAGE_CREATEHD)
|
---|
317 | {
|
---|
318 | /// @todo NEWMEDIA add -format to specify the hard disk backend
|
---|
319 | RTPrintf("VBoxManage createhd -filename <filename>\n"
|
---|
320 | " -size <megabytes>\n"
|
---|
321 | " [-format VDI|VMDK|VHD]\n"
|
---|
322 | " [-static]\n"
|
---|
323 | " [-comment <comment>]\n"
|
---|
324 | " [-register]\n"
|
---|
325 | " [-type normal|writethrough] (default: normal)\n"
|
---|
326 | "\n");
|
---|
327 | }
|
---|
328 |
|
---|
329 | if (u64Cmd & USAGE_MODIFYHD)
|
---|
330 | {
|
---|
331 | RTPrintf("VBoxManage modifyhd <uuid>|<filename>\n"
|
---|
332 | " settype normal|writethrough|immutable |\n"
|
---|
333 | " autoreset on|off |\n"
|
---|
334 | " compact\n"
|
---|
335 | "\n");
|
---|
336 | }
|
---|
337 |
|
---|
338 | if (u64Cmd & USAGE_CLONEHD)
|
---|
339 | {
|
---|
340 | RTPrintf("VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
|
---|
341 | " [-format VDI|VMDK|VHD|RAW|<other>]\n"
|
---|
342 | " [-remember]\n"
|
---|
343 | "\n");
|
---|
344 | }
|
---|
345 |
|
---|
346 | if (u64Cmd & USAGE_CONVERTFROMRAW)
|
---|
347 | {
|
---|
348 | RTPrintf("VBoxManage convertfromraw [-static] [-format VDI|VMDK|VHD]\n"
|
---|
349 | " <filename> <outputfile>\n"
|
---|
350 | "VBoxManage convertfromraw [-static] [-format VDI|VMDK|VHD]\n"
|
---|
351 | " stdin <outputfile> <bytes>\n"
|
---|
352 | "\n");
|
---|
353 | }
|
---|
354 |
|
---|
355 | if (u64Cmd & USAGE_ADDISCSIDISK)
|
---|
356 | {
|
---|
357 | RTPrintf("VBoxManage addiscsidisk -server <name>|<ip>\n"
|
---|
358 | " -target <target>\n"
|
---|
359 | " [-port <port>]\n"
|
---|
360 | " [-lun <lun>]\n"
|
---|
361 | " [-encodedlun <lun>]\n"
|
---|
362 | " [-username <username>]\n"
|
---|
363 | " [-password <password>]\n"
|
---|
364 | " [-comment <comment>]\n"
|
---|
365 | " [-intnet]\n"
|
---|
366 | "\n");
|
---|
367 | }
|
---|
368 |
|
---|
369 | if (u64Cmd & USAGE_GETEXTRADATA)
|
---|
370 | {
|
---|
371 | RTPrintf("VBoxManage getextradata global|<uuid>|<name>\n"
|
---|
372 | " <key>|enumerate\n"
|
---|
373 | "\n");
|
---|
374 | }
|
---|
375 |
|
---|
376 | if (u64Cmd & USAGE_SETEXTRADATA)
|
---|
377 | {
|
---|
378 | RTPrintf("VBoxManage setextradata global|<uuid>|<name>\n"
|
---|
379 | " <key>\n"
|
---|
380 | " [<value>] (no value deletes key)\n"
|
---|
381 | "\n");
|
---|
382 | }
|
---|
383 |
|
---|
384 | if (u64Cmd & USAGE_SETPROPERTY)
|
---|
385 | {
|
---|
386 | RTPrintf("VBoxManage setproperty hdfolder default|<folder> |\n"
|
---|
387 | " machinefolder default|<folder> |\n"
|
---|
388 | " vrdpauthlibrary default|<library> |\n"
|
---|
389 | " websrvauthlibrary default|null|<library> |\n"
|
---|
390 | " hwvirtexenabled yes|no\n"
|
---|
391 | " loghistorycount <value>\n"
|
---|
392 | "\n");
|
---|
393 | }
|
---|
394 |
|
---|
395 | if (u64Cmd & USAGE_USBFILTER_ADD)
|
---|
396 | {
|
---|
397 | RTPrintf("VBoxManage usbfilter add <index,0-N>\n"
|
---|
398 | " -target <uuid>|<name>|global\n"
|
---|
399 | " -name <string>\n"
|
---|
400 | " -action ignore|hold (global filters only)\n"
|
---|
401 | " [-active yes|no] (yes)\n"
|
---|
402 | " [-vendorid <XXXX>] (null)\n"
|
---|
403 | " [-productid <XXXX>] (null)\n"
|
---|
404 | " [-revision <IIFF>] (null)\n"
|
---|
405 | " [-manufacturer <string>] (null)\n"
|
---|
406 | " [-product <string>] (null)\n"
|
---|
407 | " [-remote yes|no] (null, VM filters only)\n"
|
---|
408 | " [-serialnumber <string>] (null)\n"
|
---|
409 | " [-maskedinterfaces <XXXXXXXX>]\n"
|
---|
410 | "\n");
|
---|
411 | }
|
---|
412 |
|
---|
413 | if (u64Cmd & USAGE_USBFILTER_MODIFY)
|
---|
414 | {
|
---|
415 | RTPrintf("VBoxManage usbfilter modify <index,0-N>\n"
|
---|
416 | " -target <uuid>|<name>|global\n"
|
---|
417 | " [-name <string>]\n"
|
---|
418 | " [-action ignore|hold] (global filters only)\n"
|
---|
419 | " [-active yes|no]\n"
|
---|
420 | " [-vendorid <XXXX>|\"\"]\n"
|
---|
421 | " [-productid <XXXX>|\"\"]\n"
|
---|
422 | " [-revision <IIFF>|\"\"]\n"
|
---|
423 | " [-manufacturer <string>|\"\"]\n"
|
---|
424 | " [-product <string>|\"\"]\n"
|
---|
425 | " [-remote yes|no] (null, VM filters only)\n"
|
---|
426 | " [-serialnumber <string>|\"\"]\n"
|
---|
427 | " [-maskedinterfaces <XXXXXXXX>]\n"
|
---|
428 | "\n");
|
---|
429 | }
|
---|
430 |
|
---|
431 | if (u64Cmd & USAGE_USBFILTER_REMOVE)
|
---|
432 | {
|
---|
433 | RTPrintf("VBoxManage usbfilter remove <index,0-N>\n"
|
---|
434 | " -target <uuid>|<name>|global\n"
|
---|
435 | "\n");
|
---|
436 | }
|
---|
437 |
|
---|
438 | if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
|
---|
439 | {
|
---|
440 | RTPrintf("VBoxManage sharedfolder add <vmname>|<uuid>\n"
|
---|
441 | " -name <name> -hostpath <hostpath>\n"
|
---|
442 | " [-transient] [-readonly]\n"
|
---|
443 | "\n");
|
---|
444 | }
|
---|
445 |
|
---|
446 | if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
|
---|
447 | {
|
---|
448 | RTPrintf("VBoxManage sharedfolder remove <vmname>|<uuid>\n"
|
---|
449 | " -name <name> [-transient]\n"
|
---|
450 | "\n");
|
---|
451 | }
|
---|
452 |
|
---|
453 | if (u64Cmd & USAGE_VM_STATISTICS)
|
---|
454 | {
|
---|
455 | RTPrintf("VBoxManage vmstatistics <vmname>|<uuid> [-reset]\n"
|
---|
456 | " [-pattern <pattern>] [-descriptions]\n"
|
---|
457 | "\n");
|
---|
458 | }
|
---|
459 |
|
---|
460 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
461 | if (u64Cmd & USAGE_GUESTPROPERTY)
|
---|
462 | usageGuestProperty();
|
---|
463 | #endif /* VBOX_WITH_GUEST_PROPS defined */
|
---|
464 |
|
---|
465 | if (u64Cmd & USAGE_METRICS)
|
---|
466 | {
|
---|
467 | RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]] (comma-separated)\n\n"
|
---|
468 | "VBoxManage metrics setup\n"
|
---|
469 | " [-period <seconds>]\n"
|
---|
470 | " [-samples <count>]\n"
|
---|
471 | " [-list]\n"
|
---|
472 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
473 | "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
474 | "VBoxManage metrics collect\n"
|
---|
475 | " [-period <seconds>]\n"
|
---|
476 | " [-samples <count>]\n"
|
---|
477 | " [-list]\n"
|
---|
478 | " [-detach]\n"
|
---|
479 | " [*|host|<vmname> [<metric_list>]]\n"
|
---|
480 | "\n");
|
---|
481 | }
|
---|
482 |
|
---|
483 | #if !defined(RT_OS_WINDOWS) || defined(VBOX_WITH_NETFLT)
|
---|
484 | if (u64Cmd & USAGE_HOSTONLYIFS)
|
---|
485 | {
|
---|
486 | RTPrintf("VBoxManage hostonlyif ipconfig <name> [-dhcp| -ip<ipv4> -netmask<ipv4> | -ipv6<ipv6> -netmasklengthv6<length>]"
|
---|
487 | # if defined(RT_OS_WINDOWS)
|
---|
488 | "|\n"
|
---|
489 | " create <name>|\n"
|
---|
490 | " remove <name>\n"
|
---|
491 | # endif
|
---|
492 | "\n");
|
---|
493 | }
|
---|
494 | #endif
|
---|
495 | }
|
---|
496 |
|
---|
497 | /**
|
---|
498 | * Print a usage synopsis and the syntax error message.
|
---|
499 | */
|
---|
500 | int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
|
---|
501 | {
|
---|
502 | va_list args;
|
---|
503 | showLogo(); // show logo even if suppressed
|
---|
504 | #ifndef VBOX_ONLY_DOCS
|
---|
505 | if (g_fInternalMode)
|
---|
506 | printUsageInternal(u64Cmd);
|
---|
507 | else
|
---|
508 | printUsage(u64Cmd);
|
---|
509 | #endif /* !VBOX_ONLY_DOCS */
|
---|
510 | va_start(args, pszFormat);
|
---|
511 | RTPrintf("\n"
|
---|
512 | "Syntax error: %N\n", pszFormat, &args);
|
---|
513 | va_end(args);
|
---|
514 | return 1;
|
---|
515 | }
|
---|
516 |
|
---|
517 | /**
|
---|
518 | * Print an error message without the syntax stuff.
|
---|
519 | */
|
---|
520 | int errorArgument(const char *pszFormat, ...)
|
---|
521 | {
|
---|
522 | va_list args;
|
---|
523 | va_start(args, pszFormat);
|
---|
524 | RTPrintf("error: %N\n", pszFormat, &args);
|
---|
525 | va_end(args);
|
---|
526 | return 1;
|
---|
527 | }
|
---|
528 |
|
---|
529 | #ifndef VBOX_ONLY_DOCS
|
---|
530 | /**
|
---|
531 | * Print out progress on the console
|
---|
532 | */
|
---|
533 | void showProgress(ComPtr<IProgress> progress)
|
---|
534 | {
|
---|
535 | BOOL fCompleted;
|
---|
536 | LONG currentPercent;
|
---|
537 | LONG lastPercent = 0;
|
---|
538 |
|
---|
539 | RTPrintf("0%%...");
|
---|
540 | RTStrmFlush(g_pStdOut);
|
---|
541 | while (SUCCEEDED(progress->COMGETTER(Completed(&fCompleted))))
|
---|
542 | {
|
---|
543 | progress->COMGETTER(Percent(¤tPercent));
|
---|
544 |
|
---|
545 | /* did we cross a 10% mark? */
|
---|
546 | if (((currentPercent / 10) > (lastPercent / 10)))
|
---|
547 | {
|
---|
548 | /* make sure to also print out missed steps */
|
---|
549 | for (LONG curVal = (lastPercent / 10) * 10 + 10; curVal <= (currentPercent / 10) * 10; curVal += 10)
|
---|
550 | {
|
---|
551 | if (curVal < 100)
|
---|
552 | {
|
---|
553 | RTPrintf("%ld%%...", curVal);
|
---|
554 | RTStrmFlush(g_pStdOut);
|
---|
555 | }
|
---|
556 | }
|
---|
557 | lastPercent = (currentPercent / 10) * 10;
|
---|
558 | }
|
---|
559 | if (fCompleted)
|
---|
560 | break;
|
---|
561 |
|
---|
562 | /* make sure the loop is not too tight */
|
---|
563 | progress->WaitForCompletion(100);
|
---|
564 | }
|
---|
565 |
|
---|
566 | /* complete the line. */
|
---|
567 | HRESULT rc;
|
---|
568 | if (SUCCEEDED(progress->COMGETTER(ResultCode)(&rc)))
|
---|
569 | {
|
---|
570 | if (SUCCEEDED(rc))
|
---|
571 | RTPrintf("100%%\n");
|
---|
572 | else
|
---|
573 | RTPrintf("FAILED\n");
|
---|
574 | }
|
---|
575 | else
|
---|
576 | RTPrintf("\n");
|
---|
577 | RTStrmFlush(g_pStdOut);
|
---|
578 | }
|
---|
579 |
|
---|
580 | #endif /* !VBOX_ONLY_DOCS */
|
---|