1 | /* $Id: VBoxManageHelp.cpp 78025 2019-04-05 10:28:09Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - help and other message output.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 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/assert.h>
|
---|
27 | #include <iprt/env.h>
|
---|
28 | #include <iprt/err.h>
|
---|
29 | #include <iprt/getopt.h>
|
---|
30 | #include <iprt/stream.h>
|
---|
31 | #include <iprt/message.h>
|
---|
32 |
|
---|
33 | #include "VBoxManage.h"
|
---|
34 |
|
---|
35 |
|
---|
36 | /*********************************************************************************************************************************
|
---|
37 | * Defined Constants And Macros *
|
---|
38 | *********************************************************************************************************************************/
|
---|
39 | /** If the usage is the given number of length long or longer, the error is
|
---|
40 | * repeated so the user can actually see it. */
|
---|
41 | #define ERROR_REPEAT_AFTER_USAGE_LENGTH 16
|
---|
42 |
|
---|
43 |
|
---|
44 | /*********************************************************************************************************************************
|
---|
45 | * Global Variables *
|
---|
46 | *********************************************************************************************************************************/
|
---|
47 | #ifndef VBOX_ONLY_DOCS
|
---|
48 | static enum HELP_CMD_VBOXMANAGE g_enmCurCommand = HELP_CMD_VBOXMANAGE_INVALID;
|
---|
49 | /** The scope mask for the current subcommand. */
|
---|
50 | static uint64_t g_fCurSubcommandScope = RTMSGREFENTRYSTR_SCOPE_GLOBAL;
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Sets the current command.
|
---|
54 | *
|
---|
55 | * This affects future calls to error and help functions.
|
---|
56 | *
|
---|
57 | * @param enmCommand The command.
|
---|
58 | */
|
---|
59 | void setCurrentCommand(enum HELP_CMD_VBOXMANAGE enmCommand)
|
---|
60 | {
|
---|
61 | Assert(g_enmCurCommand == HELP_CMD_VBOXMANAGE_INVALID);
|
---|
62 | g_enmCurCommand = enmCommand;
|
---|
63 | g_fCurSubcommandScope = RTMSGREFENTRYSTR_SCOPE_GLOBAL;
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Sets the current subcommand.
|
---|
69 | *
|
---|
70 | * This affects future calls to error and help functions.
|
---|
71 | *
|
---|
72 | * @param fSubcommandScope The subcommand scope.
|
---|
73 | */
|
---|
74 | void setCurrentSubcommand(uint64_t fSubcommandScope)
|
---|
75 | {
|
---|
76 | g_fCurSubcommandScope = fSubcommandScope;
|
---|
77 | }
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Prints brief help for a command or subcommand.
|
---|
84 | *
|
---|
85 | * @returns Number of lines written.
|
---|
86 | * @param enmCommand The command.
|
---|
87 | * @param fSubcommandScope The subcommand scope, REFENTRYSTR_SCOPE_GLOBAL
|
---|
88 | * for all.
|
---|
89 | * @param pStrm The output stream.
|
---|
90 | */
|
---|
91 | static uint32_t printBriefCommandOrSubcommandHelp(enum HELP_CMD_VBOXMANAGE enmCommand, uint64_t fSubcommandScope, PRTSTREAM pStrm)
|
---|
92 | {
|
---|
93 | uint32_t cLinesWritten = 0;
|
---|
94 | uint32_t cPendingBlankLines = 0;
|
---|
95 | uint32_t cFound = 0;
|
---|
96 | for (uint32_t i = 0; i < g_cHelpEntries; i++)
|
---|
97 | {
|
---|
98 | PCRTMSGREFENTRY pHelp = g_apHelpEntries[i];
|
---|
99 | if (pHelp->idInternal == (int64_t)enmCommand)
|
---|
100 | {
|
---|
101 | cFound++;
|
---|
102 | if (cFound == 1)
|
---|
103 | {
|
---|
104 | if (fSubcommandScope == RTMSGREFENTRYSTR_SCOPE_GLOBAL)
|
---|
105 | RTStrmPrintf(pStrm, "Usage - %c%s:\n", RT_C_TO_UPPER(pHelp->pszBrief[0]), pHelp->pszBrief + 1);
|
---|
106 | else
|
---|
107 | RTStrmPrintf(pStrm, "Usage:\n");
|
---|
108 | }
|
---|
109 | RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Synopsis, fSubcommandScope, &cPendingBlankLines, &cLinesWritten);
|
---|
110 | if (!cPendingBlankLines)
|
---|
111 | cPendingBlankLines = 1;
|
---|
112 | }
|
---|
113 | }
|
---|
114 | Assert(cFound > 0);
|
---|
115 | return cLinesWritten;
|
---|
116 | }
|
---|
117 |
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Prints the brief usage information for the current (sub)command.
|
---|
121 | *
|
---|
122 | * @param pStrm The output stream.
|
---|
123 | */
|
---|
124 | void printUsage(PRTSTREAM pStrm)
|
---|
125 | {
|
---|
126 | printBriefCommandOrSubcommandHelp(g_enmCurCommand, g_fCurSubcommandScope, pStrm);
|
---|
127 | }
|
---|
128 |
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * Prints full help for a command or subcommand.
|
---|
132 | *
|
---|
133 | * @param enmCommand The command.
|
---|
134 | * @param fSubcommandScope The subcommand scope, REFENTRYSTR_SCOPE_GLOBAL
|
---|
135 | * for all.
|
---|
136 | * @param pStrm The output stream.
|
---|
137 | */
|
---|
138 | static void printFullCommandOrSubcommandHelp(enum HELP_CMD_VBOXMANAGE enmCommand, uint64_t fSubcommandScope, PRTSTREAM pStrm)
|
---|
139 | {
|
---|
140 | uint32_t cPendingBlankLines = 0;
|
---|
141 | uint32_t cFound = 0;
|
---|
142 | for (uint32_t i = 0; i < g_cHelpEntries; i++)
|
---|
143 | {
|
---|
144 | PCRTMSGREFENTRY pHelp = g_apHelpEntries[i];
|
---|
145 | if ( pHelp->idInternal == (int64_t)enmCommand
|
---|
146 | || enmCommand == HELP_CMD_VBOXMANAGE_INVALID)
|
---|
147 | {
|
---|
148 | cFound++;
|
---|
149 | RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Help, fSubcommandScope, &cPendingBlankLines, NULL /*pcLinesWritten*/);
|
---|
150 | if (cPendingBlankLines < 2)
|
---|
151 | cPendingBlankLines = 2;
|
---|
152 | }
|
---|
153 | }
|
---|
154 | Assert(cFound > 0);
|
---|
155 | }
|
---|
156 |
|
---|
157 |
|
---|
158 | /**
|
---|
159 | * Prints the full help for the current (sub)command.
|
---|
160 | *
|
---|
161 | * @param pStrm The output stream.
|
---|
162 | */
|
---|
163 | void printHelp(PRTSTREAM pStrm)
|
---|
164 | {
|
---|
165 | printFullCommandOrSubcommandHelp(g_enmCurCommand, g_fCurSubcommandScope, pStrm);
|
---|
166 | }
|
---|
167 |
|
---|
168 |
|
---|
169 | /**
|
---|
170 | * Display no subcommand error message and current command usage.
|
---|
171 | *
|
---|
172 | * @returns RTEXITCODE_SYNTAX.
|
---|
173 | */
|
---|
174 | RTEXITCODE errorNoSubcommand(void)
|
---|
175 | {
|
---|
176 | Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID);
|
---|
177 | Assert(g_fCurSubcommandScope == RTMSGREFENTRYSTR_SCOPE_GLOBAL);
|
---|
178 |
|
---|
179 | return errorSyntax("No subcommand specified");
|
---|
180 | }
|
---|
181 |
|
---|
182 |
|
---|
183 | /**
|
---|
184 | * Display unknown subcommand error message and current command usage.
|
---|
185 | *
|
---|
186 | * May show full command help instead if the subcommand is a common help option.
|
---|
187 | *
|
---|
188 | * @returns RTEXITCODE_SYNTAX, or RTEXITCODE_SUCCESS if common help option.
|
---|
189 | * @param pszSubcommand The name of the alleged subcommand.
|
---|
190 | */
|
---|
191 | RTEXITCODE errorUnknownSubcommand(const char *pszSubcommand)
|
---|
192 | {
|
---|
193 | Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID);
|
---|
194 | Assert(g_fCurSubcommandScope == RTMSGREFENTRYSTR_SCOPE_GLOBAL);
|
---|
195 |
|
---|
196 | /* check if help was requested. */
|
---|
197 | if ( strcmp(pszSubcommand, "--help") == 0
|
---|
198 | || strcmp(pszSubcommand, "-h") == 0
|
---|
199 | || strcmp(pszSubcommand, "-?") == 0)
|
---|
200 | {
|
---|
201 | printFullCommandOrSubcommandHelp(g_enmCurCommand, g_fCurSubcommandScope, g_pStdOut);
|
---|
202 | return RTEXITCODE_SUCCESS;
|
---|
203 | }
|
---|
204 |
|
---|
205 | return errorSyntax("Unknown subcommand: %s", pszSubcommand);
|
---|
206 | }
|
---|
207 |
|
---|
208 |
|
---|
209 | /**
|
---|
210 | * Display too many parameters error message and current command usage.
|
---|
211 | *
|
---|
212 | * May show full command help instead if the subcommand is a common help option.
|
---|
213 | *
|
---|
214 | * @returns RTEXITCODE_SYNTAX, or RTEXITCODE_SUCCESS if common help option.
|
---|
215 | * @param papszArgs The first unwanted parameter. Terminated by
|
---|
216 | * NULL entry.
|
---|
217 | */
|
---|
218 | RTEXITCODE errorTooManyParameters(char **papszArgs)
|
---|
219 | {
|
---|
220 | Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID);
|
---|
221 | Assert(g_fCurSubcommandScope != RTMSGREFENTRYSTR_SCOPE_GLOBAL);
|
---|
222 |
|
---|
223 | /* check if help was requested. */
|
---|
224 | if (papszArgs)
|
---|
225 | {
|
---|
226 | for (uint32_t i = 0; papszArgs[i]; i++)
|
---|
227 | if ( strcmp(papszArgs[i], "--help") == 0
|
---|
228 | || strcmp(papszArgs[i], "-h") == 0
|
---|
229 | || strcmp(papszArgs[i], "-?") == 0)
|
---|
230 | {
|
---|
231 | printFullCommandOrSubcommandHelp(g_enmCurCommand, g_fCurSubcommandScope, g_pStdOut);
|
---|
232 | return RTEXITCODE_SUCCESS;
|
---|
233 | }
|
---|
234 | else if (!strcmp(papszArgs[i], "--"))
|
---|
235 | break;
|
---|
236 | }
|
---|
237 |
|
---|
238 | return errorSyntax("Too many parameters");
|
---|
239 | }
|
---|
240 |
|
---|
241 |
|
---|
242 | /**
|
---|
243 | * Display current (sub)command usage and the custom error message.
|
---|
244 | *
|
---|
245 | * @returns RTEXITCODE_SYNTAX.
|
---|
246 | * @param pszFormat Custom error message format string.
|
---|
247 | * @param ... Format arguments.
|
---|
248 | */
|
---|
249 | RTEXITCODE errorSyntax(const char *pszFormat, ...)
|
---|
250 | {
|
---|
251 | Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID);
|
---|
252 |
|
---|
253 | showLogo(g_pStdErr);
|
---|
254 |
|
---|
255 | va_list va;
|
---|
256 | va_start(va, pszFormat);
|
---|
257 | RTMsgErrorV(pszFormat, va);
|
---|
258 | va_end(va);
|
---|
259 |
|
---|
260 | RTStrmPutCh(g_pStdErr, '\n');
|
---|
261 | if ( printBriefCommandOrSubcommandHelp(g_enmCurCommand, g_fCurSubcommandScope, g_pStdErr)
|
---|
262 | >= ERROR_REPEAT_AFTER_USAGE_LENGTH)
|
---|
263 | {
|
---|
264 | /* Usage was very long, repeat the error message. */
|
---|
265 | RTStrmPutCh(g_pStdErr, '\n');
|
---|
266 | va_start(va, pszFormat);
|
---|
267 | RTMsgErrorV(pszFormat, va);
|
---|
268 | va_end(va);
|
---|
269 | }
|
---|
270 | return RTEXITCODE_SYNTAX;
|
---|
271 | }
|
---|
272 |
|
---|
273 |
|
---|
274 | /**
|
---|
275 | * Worker for errorGetOpt.
|
---|
276 | *
|
---|
277 | * @param rcGetOpt The RTGetOpt return value.
|
---|
278 | * @param pValueUnion The value union returned by RTGetOpt.
|
---|
279 | */
|
---|
280 | static void errorGetOptWorker(int rcGetOpt, union RTGETOPTUNION const *pValueUnion)
|
---|
281 | {
|
---|
282 | if (rcGetOpt == VINF_GETOPT_NOT_OPTION)
|
---|
283 | RTMsgError("Invalid parameter '%s'", pValueUnion->psz);
|
---|
284 | else if (rcGetOpt > 0)
|
---|
285 | {
|
---|
286 | if (RT_C_IS_PRINT(rcGetOpt))
|
---|
287 | RTMsgError("Invalid option -%c", rcGetOpt);
|
---|
288 | else
|
---|
289 | RTMsgError("Invalid option case %i", rcGetOpt);
|
---|
290 | }
|
---|
291 | else if (rcGetOpt == VERR_GETOPT_UNKNOWN_OPTION)
|
---|
292 | RTMsgError("Unknown option: %s", pValueUnion->psz);
|
---|
293 | else if (rcGetOpt == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
|
---|
294 | RTMsgError("Invalid argument format: %s", pValueUnion->psz);
|
---|
295 | else if (pValueUnion->pDef)
|
---|
296 | RTMsgError("%s: %Rrs", pValueUnion->pDef->pszLong, rcGetOpt);
|
---|
297 | else
|
---|
298 | RTMsgError("%Rrs", rcGetOpt);
|
---|
299 | }
|
---|
300 |
|
---|
301 |
|
---|
302 | /**
|
---|
303 | * Handled an RTGetOpt error or common option.
|
---|
304 | *
|
---|
305 | * This implements the 'V' and 'h' cases. It reports appropriate syntax errors
|
---|
306 | * for other @a rcGetOpt values.
|
---|
307 | *
|
---|
308 | * @retval RTEXITCODE_SUCCESS if help or version request.
|
---|
309 | * @retval RTEXITCODE_SYNTAX if not help or version request.
|
---|
310 | * @param rcGetOpt The RTGetOpt return value.
|
---|
311 | * @param pValueUnion The value union returned by RTGetOpt.
|
---|
312 | */
|
---|
313 | RTEXITCODE errorGetOpt(int rcGetOpt, union RTGETOPTUNION const *pValueUnion)
|
---|
314 | {
|
---|
315 | Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID);
|
---|
316 |
|
---|
317 | /*
|
---|
318 | * Check if it is an unhandled standard option.
|
---|
319 | */
|
---|
320 | if (rcGetOpt == 'V')
|
---|
321 | {
|
---|
322 | RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
|
---|
323 | return RTEXITCODE_SUCCESS;
|
---|
324 | }
|
---|
325 |
|
---|
326 | if (rcGetOpt == 'h')
|
---|
327 | {
|
---|
328 | printFullCommandOrSubcommandHelp(g_enmCurCommand, g_fCurSubcommandScope, g_pStdOut);
|
---|
329 | return RTEXITCODE_SUCCESS;
|
---|
330 | }
|
---|
331 |
|
---|
332 | /*
|
---|
333 | * We failed.
|
---|
334 | */
|
---|
335 | showLogo(g_pStdErr);
|
---|
336 | errorGetOptWorker(rcGetOpt, pValueUnion);
|
---|
337 | if ( printBriefCommandOrSubcommandHelp(g_enmCurCommand, g_fCurSubcommandScope, g_pStdErr)
|
---|
338 | >= ERROR_REPEAT_AFTER_USAGE_LENGTH)
|
---|
339 | {
|
---|
340 | /* Usage was very long, repeat the error message. */
|
---|
341 | RTStrmPutCh(g_pStdErr, '\n');
|
---|
342 | errorGetOptWorker(rcGetOpt, pValueUnion);
|
---|
343 | }
|
---|
344 | return RTEXITCODE_SYNTAX;
|
---|
345 | }
|
---|
346 |
|
---|
347 | #endif /* !VBOX_ONLY_DOCS */
|
---|
348 |
|
---|
349 |
|
---|
350 |
|
---|
351 | void showLogo(PRTSTREAM pStrm)
|
---|
352 | {
|
---|
353 | static bool s_fShown; /* show only once */
|
---|
354 |
|
---|
355 | if (!s_fShown)
|
---|
356 | {
|
---|
357 | RTStrmPrintf(pStrm, VBOX_PRODUCT " Command Line Management Interface Version "
|
---|
358 | VBOX_VERSION_STRING "\n"
|
---|
359 | "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
|
---|
360 | "All rights reserved.\n"
|
---|
361 | "\n");
|
---|
362 | s_fShown = true;
|
---|
363 | }
|
---|
364 | }
|
---|
365 |
|
---|
366 |
|
---|
367 |
|
---|
368 |
|
---|
369 | void printUsage(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, PRTSTREAM pStrm)
|
---|
370 | {
|
---|
371 | bool fDumpOpts = false;
|
---|
372 | #ifdef RT_OS_LINUX
|
---|
373 | bool fLinux = true;
|
---|
374 | #else
|
---|
375 | bool fLinux = false;
|
---|
376 | #endif
|
---|
377 | #ifdef RT_OS_WINDOWS
|
---|
378 | bool fWin = true;
|
---|
379 | #else
|
---|
380 | bool fWin = false;
|
---|
381 | #endif
|
---|
382 | #ifdef RT_OS_SOLARIS
|
---|
383 | bool fSolaris = true;
|
---|
384 | #else
|
---|
385 | bool fSolaris = false;
|
---|
386 | #endif
|
---|
387 | #ifdef RT_OS_FREEBSD
|
---|
388 | bool fFreeBSD = true;
|
---|
389 | #else
|
---|
390 | bool fFreeBSD = false;
|
---|
391 | #endif
|
---|
392 | #ifdef RT_OS_DARWIN
|
---|
393 | bool fDarwin = true;
|
---|
394 | #else
|
---|
395 | bool fDarwin = false;
|
---|
396 | #endif
|
---|
397 | #ifdef VBOX_WITH_VBOXSDL
|
---|
398 | bool fVBoxSDL = true;
|
---|
399 | #else
|
---|
400 | bool fVBoxSDL = false;
|
---|
401 | #endif
|
---|
402 |
|
---|
403 | Assert(enmCommand != USAGE_INVALID);
|
---|
404 | Assert(enmCommand != USAGE_S_NEWCMD);
|
---|
405 |
|
---|
406 | if (enmCommand == USAGE_S_DUMPOPTS)
|
---|
407 | {
|
---|
408 | fDumpOpts = true;
|
---|
409 | fLinux = true;
|
---|
410 | fWin = true;
|
---|
411 | fSolaris = true;
|
---|
412 | fFreeBSD = true;
|
---|
413 | fDarwin = true;
|
---|
414 | fVBoxSDL = true;
|
---|
415 | enmCommand = USAGE_S_ALL;
|
---|
416 | }
|
---|
417 |
|
---|
418 | RTStrmPrintf(pStrm,
|
---|
419 | "Usage:\n"
|
---|
420 | "\n");
|
---|
421 |
|
---|
422 | if (enmCommand == USAGE_S_ALL)
|
---|
423 | RTStrmPrintf(pStrm,
|
---|
424 | " VBoxManage [<general option>] <command>\n"
|
---|
425 | " \n \n"
|
---|
426 | "General Options:\n \n"
|
---|
427 | " [-v|--version] print version number and exit\n"
|
---|
428 | " [-q|--nologo] suppress the logo\n"
|
---|
429 | " [--settingspw <pw>] provide the settings password\n"
|
---|
430 | " [--settingspwfile <file>] provide a file containing the settings password\n"
|
---|
431 | " [@<response-file>] load arguments from the given response file (bourne style)\n"
|
---|
432 | " \n \n"
|
---|
433 | "Commands:\n \n");
|
---|
434 |
|
---|
435 | const char *pcszSep1 = " ";
|
---|
436 | const char *pcszSep2 = " ";
|
---|
437 | if (enmCommand != USAGE_S_ALL)
|
---|
438 | {
|
---|
439 | pcszSep1 = "VBoxManage";
|
---|
440 | pcszSep2 = "";
|
---|
441 | }
|
---|
442 |
|
---|
443 | #define SEP pcszSep1, pcszSep2
|
---|
444 |
|
---|
445 | if (enmCommand == USAGE_LIST || enmCommand == USAGE_S_ALL)
|
---|
446 | RTStrmPrintf(pStrm,
|
---|
447 | "%s list [--long|-l] [--sorted|-s]%s vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
|
---|
448 | #if defined(VBOX_WITH_NETFLT)
|
---|
449 | " intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|\n"
|
---|
450 | #else
|
---|
451 | " intnets|bridgedifs|natnets|dhcpservers|hostinfo|\n"
|
---|
452 | #endif
|
---|
453 | " hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|\n"
|
---|
454 | " usbhost|usbfilters|systemproperties|extpacks|\n"
|
---|
455 | " groups|webcams|screenshotformats|cloudproviders|\n"
|
---|
456 | " cloudprofiles\n"
|
---|
457 | "\n", SEP);
|
---|
458 |
|
---|
459 | if (enmCommand == USAGE_SHOWVMINFO || enmCommand == USAGE_S_ALL)
|
---|
460 | RTStrmPrintf(pStrm,
|
---|
461 | "%s showvminfo %s <uuid|vmname> [--details]\n"
|
---|
462 | " [--machinereadable]\n"
|
---|
463 | "%s showvminfo %s <uuid|vmname> --log <idx>\n"
|
---|
464 | "\n", SEP, SEP);
|
---|
465 |
|
---|
466 | if (enmCommand == USAGE_REGISTERVM || enmCommand == USAGE_S_ALL)
|
---|
467 | RTStrmPrintf(pStrm,
|
---|
468 | "%s registervm %s <filename>\n"
|
---|
469 | "\n", SEP);
|
---|
470 |
|
---|
471 | if (enmCommand == USAGE_UNREGISTERVM || enmCommand == USAGE_S_ALL)
|
---|
472 | RTStrmPrintf(pStrm,
|
---|
473 | "%s unregistervm %s <uuid|vmname> [--delete]\n"
|
---|
474 | "\n", SEP);
|
---|
475 |
|
---|
476 | if (enmCommand == USAGE_CREATEVM || enmCommand == USAGE_S_ALL)
|
---|
477 | RTStrmPrintf(pStrm,
|
---|
478 | "%s createvm %s --name <name>\n"
|
---|
479 | " [--groups <group>, ...]\n"
|
---|
480 | " [--ostype <ostype>]\n"
|
---|
481 | " [--register]\n"
|
---|
482 | " [--basefolder <path>]\n"
|
---|
483 | " [--uuid <uuid>]\n"
|
---|
484 | " [--default]\n"
|
---|
485 | "\n", SEP);
|
---|
486 |
|
---|
487 | if (enmCommand == USAGE_MODIFYVM || enmCommand == USAGE_S_ALL)
|
---|
488 | {
|
---|
489 | RTStrmPrintf(pStrm,
|
---|
490 | "%s modifyvm %s <uuid|vmname>\n"
|
---|
491 | " [--name <name>]\n"
|
---|
492 | " [--groups <group>, ...]\n"
|
---|
493 | " [--description <desc>]\n"
|
---|
494 | " [--ostype <ostype>]\n"
|
---|
495 | " [--iconfile <filename>]\n"
|
---|
496 | " [--memory <memorysize in MB>]\n"
|
---|
497 | " [--pagefusion on|off]\n"
|
---|
498 | " [--vram <vramsize in MB>]\n"
|
---|
499 | " [--acpi on|off]\n"
|
---|
500 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
501 | " [--pciattach 03:04.0]\n"
|
---|
502 | " [--pciattach 03:04.0@02:01.0]\n"
|
---|
503 | " [--pcidetach 03:04.0]\n"
|
---|
504 | #endif
|
---|
505 | " [--ioapic on|off]\n"
|
---|
506 | " [--hpet on|off]\n"
|
---|
507 | " [--triplefaultreset on|off]\n"
|
---|
508 | " [--apic on|off]\n"
|
---|
509 | " [--x2apic on|off]\n"
|
---|
510 | " [--paravirtprovider none|default|legacy|minimal|\n"
|
---|
511 | " hyperv|kvm]\n"
|
---|
512 | " [--paravirtdebug <key=value> [,<key=value> ...]]\n"
|
---|
513 | " [--hwvirtex on|off]\n"
|
---|
514 | " [--nestedpaging on|off]\n"
|
---|
515 | " [--largepages on|off]\n"
|
---|
516 | " [--vtxvpid on|off]\n"
|
---|
517 | " [--vtxux on|off]\n"
|
---|
518 | " [--pae on|off]\n"
|
---|
519 | " [--longmode on|off]\n"
|
---|
520 | " [--ibpb-on-vm-exit on|off]\n"
|
---|
521 | " [--ibpb-on-vm-entry on|off]\n"
|
---|
522 | " [--spec-ctrl on|off]\n"
|
---|
523 | " [--l1d-flush-on-sched on|off]\n"
|
---|
524 | " [--l1d-flush-on-vm-entry on|off]\n"
|
---|
525 | " [--nested-hw-virt on|off]\n"
|
---|
526 | " [--cpu-profile \"host|Intel 80[86|286|386]\"]\n"
|
---|
527 | " [--cpuid-portability-level <0..3>]\n"
|
---|
528 | " [--cpuid-set <leaf[:subleaf]> <eax> <ebx> <ecx> <edx>]\n"
|
---|
529 | " [--cpuid-remove <leaf[:subleaf]>]\n"
|
---|
530 | " [--cpuidremoveall]\n"
|
---|
531 | " [--hardwareuuid <uuid>]\n"
|
---|
532 | " [--cpus <number>]\n"
|
---|
533 | " [--cpuhotplug on|off]\n"
|
---|
534 | " [--plugcpu <id>]\n"
|
---|
535 | " [--unplugcpu <id>]\n"
|
---|
536 | " [--cpuexecutioncap <1-100>]\n"
|
---|
537 | " [--rtcuseutc on|off]\n"
|
---|
538 | #ifdef VBOX_WITH_VMSVGA
|
---|
539 | " [--graphicscontroller none|vboxvga|vmsvga|vboxsvga]\n"
|
---|
540 | #else
|
---|
541 | " [--graphicscontroller none|vboxvga]\n"
|
---|
542 | #endif
|
---|
543 | " [--monitorcount <number>]\n"
|
---|
544 | " [--accelerate3d on|off]\n"
|
---|
545 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
546 | " [--accelerate2dvideo on|off]\n"
|
---|
547 | #endif
|
---|
548 | " [--firmware bios|efi|efi32|efi64]\n"
|
---|
549 | " [--chipset ich9|piix3]\n"
|
---|
550 | " [--bioslogofadein on|off]\n"
|
---|
551 | " [--bioslogofadeout on|off]\n"
|
---|
552 | " [--bioslogodisplaytime <msec>]\n"
|
---|
553 | " [--bioslogoimagepath <imagepath>]\n"
|
---|
554 | " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
|
---|
555 | " [--biosapic disabled|apic|x2apic]\n"
|
---|
556 | " [--biossystemtimeoffset <msec>]\n"
|
---|
557 | " [--biospxedebug on|off]\n"
|
---|
558 | " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
|
---|
559 | " [--nic<1-N> none|null|nat|bridged|intnet"
|
---|
560 | #if defined(VBOX_WITH_NETFLT)
|
---|
561 | "|hostonly"
|
---|
562 | #endif
|
---|
563 | "|\n"
|
---|
564 | " generic|natnetwork"
|
---|
565 | "]\n"
|
---|
566 | " [--nictype<1-N> Am79C970A|Am79C973"
|
---|
567 | #ifdef VBOX_WITH_E1000
|
---|
568 | "|\n 82540EM|82543GC|82545EM"
|
---|
569 | #endif
|
---|
570 | #ifdef VBOX_WITH_VIRTIO
|
---|
571 | "|\n virtio"
|
---|
572 | #endif /* VBOX_WITH_VIRTIO */
|
---|
573 | "]\n"
|
---|
574 | " [--cableconnected<1-N> on|off]\n"
|
---|
575 | " [--nictrace<1-N> on|off]\n"
|
---|
576 | " [--nictracefile<1-N> <filename>]\n"
|
---|
577 | " [--nicproperty<1-N> name=[value]]\n"
|
---|
578 | " [--nicspeed<1-N> <kbps>]\n"
|
---|
579 | " [--nicbootprio<1-N> <priority>]\n"
|
---|
580 | " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
|
---|
581 | " [--nicbandwidthgroup<1-N> none|<name>]\n"
|
---|
582 | " [--bridgeadapter<1-N> none|<devicename>]\n"
|
---|
583 | #if defined(VBOX_WITH_NETFLT)
|
---|
584 | " [--hostonlyadapter<1-N> none|<devicename>]\n"
|
---|
585 | #endif
|
---|
586 | " [--intnet<1-N> <network name>]\n"
|
---|
587 | " [--nat-network<1-N> <network name>]\n"
|
---|
588 | " [--nicgenericdrv<1-N> <driver>]\n"
|
---|
589 | " [--natnet<1-N> <network>|default]\n"
|
---|
590 | " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
|
---|
591 | " [<sockrcv>],[<tcpsnd>],\n"
|
---|
592 | " [<tcprcv>]]\n"
|
---|
593 | " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
|
---|
594 | " <hostport>,[<guestip>],<guestport>]\n"
|
---|
595 | " [--natpf<1-N> delete <rulename>]\n"
|
---|
596 | " [--nattftpprefix<1-N> <prefix>]\n"
|
---|
597 | " [--nattftpfile<1-N> <file>]\n"
|
---|
598 | " [--nattftpserver<1-N> <ip>]\n"
|
---|
599 | " [--natbindip<1-N> <ip>]\n"
|
---|
600 | " [--natdnspassdomain<1-N> on|off]\n"
|
---|
601 | " [--natdnsproxy<1-N> on|off]\n"
|
---|
602 | " [--natdnshostresolver<1-N> on|off]\n"
|
---|
603 | " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
|
---|
604 | " [sameports]]\n"
|
---|
605 | " [--macaddress<1-N> auto|<mac>]\n"
|
---|
606 | " [--mouse ps2|usb|usbtablet|usbmultitouch]\n"
|
---|
607 | " [--keyboard ps2|usb]\n"
|
---|
608 | " [--uart<1-N> off|<I/O base> <IRQ>]\n"
|
---|
609 | " [--uartmode<1-N> disconnected|\n"
|
---|
610 | " server <pipe>|\n"
|
---|
611 | " client <pipe>|\n"
|
---|
612 | " tcpserver <port>|\n"
|
---|
613 | " tcpclient <hostname:port>|\n"
|
---|
614 | " file <file>|\n"
|
---|
615 | " <devicename>]\n"
|
---|
616 | " [--uarttype<1-N> 16450|16550A|16750]\n"
|
---|
617 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
618 | " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
|
---|
619 | " [--lptmode<1-N> <devicename>]\n"
|
---|
620 | #endif
|
---|
621 | " [--guestmemoryballoon <balloonsize in MB>]\n"
|
---|
622 | " [--vm-process-priority default|flat|low|normal|high]\n"
|
---|
623 | " [--audio none|null", SEP);
|
---|
624 | if (fWin)
|
---|
625 | {
|
---|
626 | #ifdef VBOX_WITH_WINMM
|
---|
627 | RTStrmPrintf(pStrm, "|winmm|dsound");
|
---|
628 | #else
|
---|
629 | RTStrmPrintf(pStrm, "|dsound");
|
---|
630 | #endif
|
---|
631 | }
|
---|
632 | if (fLinux || fSolaris)
|
---|
633 | {
|
---|
634 | RTStrmPrintf(pStrm, ""
|
---|
635 | #ifdef VBOX_WITH_AUDIO_OSS
|
---|
636 | "|oss"
|
---|
637 | #endif
|
---|
638 | #ifdef VBOX_WITH_AUDIO_ALSA
|
---|
639 | "|alsa"
|
---|
640 | #endif
|
---|
641 | #ifdef VBOX_WITH_AUDIO_PULSE
|
---|
642 | "|pulse"
|
---|
643 | #endif
|
---|
644 | );
|
---|
645 | }
|
---|
646 | if (fFreeBSD)
|
---|
647 | {
|
---|
648 | #ifdef VBOX_WITH_AUDIO_OSS
|
---|
649 | /* Get the line break sorted when dumping all option variants. */
|
---|
650 | if (fDumpOpts)
|
---|
651 | {
|
---|
652 | RTStrmPrintf(pStrm, "|\n"
|
---|
653 | " oss");
|
---|
654 | }
|
---|
655 | else
|
---|
656 | RTStrmPrintf(pStrm, "|oss");
|
---|
657 | #endif
|
---|
658 | #ifdef VBOX_WITH_AUDIO_PULSE
|
---|
659 | RTStrmPrintf(pStrm, "|pulse");
|
---|
660 | #endif
|
---|
661 | }
|
---|
662 | if (fDarwin)
|
---|
663 | {
|
---|
664 | RTStrmPrintf(pStrm, "|coreaudio");
|
---|
665 | }
|
---|
666 | RTStrmPrintf(pStrm, "]\n");
|
---|
667 | RTStrmPrintf(pStrm,
|
---|
668 | " [--audioin on|off]\n"
|
---|
669 | " [--audioout on|off]\n"
|
---|
670 | " [--audiocontroller ac97|hda|sb16]\n"
|
---|
671 | " [--audiocodec stac9700|ad1980|stac9221|sb16]\n"
|
---|
672 | " [--clipboard disabled|hosttoguest|guesttohost|\n"
|
---|
673 | " bidirectional]\n"
|
---|
674 | " [--draganddrop disabled|hosttoguest|guesttohost|\n"
|
---|
675 | " bidirectional]\n");
|
---|
676 | RTStrmPrintf(pStrm,
|
---|
677 | " [--vrde on|off]\n"
|
---|
678 | " [--vrdeextpack default|<name>]\n"
|
---|
679 | " [--vrdeproperty <name=[value]>]\n"
|
---|
680 | " [--vrdeport <hostport>]\n"
|
---|
681 | " [--vrdeaddress <hostip>]\n"
|
---|
682 | " [--vrdeauthtype null|external|guest]\n"
|
---|
683 | " [--vrdeauthlibrary default|<name>]\n"
|
---|
684 | " [--vrdemulticon on|off]\n"
|
---|
685 | " [--vrdereusecon on|off]\n"
|
---|
686 | " [--vrdevideochannel on|off]\n"
|
---|
687 | " [--vrdevideochannelquality <percent>]\n");
|
---|
688 | RTStrmPrintf(pStrm,
|
---|
689 | " [--usbohci on|off]\n"
|
---|
690 | " [--usbehci on|off]\n"
|
---|
691 | " [--usbxhci on|off]\n"
|
---|
692 | " [--usbrename <oldname> <newname>]\n"
|
---|
693 | " [--snapshotfolder default|<path>]\n"
|
---|
694 | " [--teleporter on|off]\n"
|
---|
695 | " [--teleporterport <port>]\n"
|
---|
696 | " [--teleporteraddress <address|empty>]\n"
|
---|
697 | " [--teleporterpassword <password>]\n"
|
---|
698 | " [--teleporterpasswordfile <file>|stdin]\n"
|
---|
699 | " [--tracing-enabled on|off]\n"
|
---|
700 | " [--tracing-config <config-string>]\n"
|
---|
701 | " [--tracing-allow-vm-access on|off]\n"
|
---|
702 | #if 0
|
---|
703 | " [--iocache on|off]\n"
|
---|
704 | " [--iocachesize <I/O cache size in MB>]\n"
|
---|
705 | #endif
|
---|
706 | #if 0
|
---|
707 | " [--faulttolerance master|standby]\n"
|
---|
708 | " [--faulttoleranceaddress <name>]\n"
|
---|
709 | " [--faulttoleranceport <port>]\n"
|
---|
710 | " [--faulttolerancesyncinterval <msec>]\n"
|
---|
711 | " [--faulttolerancepassword <password>]\n"
|
---|
712 | #endif
|
---|
713 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
714 | " [--usbcardreader on|off]\n"
|
---|
715 | #endif
|
---|
716 | " [--autostart-enabled on|off]\n"
|
---|
717 | " [--autostart-delay <seconds>]\n"
|
---|
718 | #if 0
|
---|
719 | " [--autostop-type disabled|savestate|poweroff|\n"
|
---|
720 | " acpishutdown]\n"
|
---|
721 | #endif
|
---|
722 | #ifdef VBOX_WITH_RECORDING
|
---|
723 | " [--recording on|off]\n"
|
---|
724 | " [--recordingscreens all|<screen ID> [<screen ID> ...]]\n"
|
---|
725 | " [--recordingfile <filename>]\n"
|
---|
726 | " [--recordingvideores <width> <height>]\n"
|
---|
727 | " [--recordingvideorate <rate>]\n"
|
---|
728 | " [--recordingvideofps <fps>]\n"
|
---|
729 | " [--recordingmaxtime <s>]\n"
|
---|
730 | " [--recordingmaxsize <MB>]\n"
|
---|
731 | " [--recordingopts <key=value> [,<key=value> ...]]\n"
|
---|
732 | #endif
|
---|
733 | " [--defaultfrontend default|<name>]\n"
|
---|
734 | "\n");
|
---|
735 | }
|
---|
736 |
|
---|
737 | if (enmCommand == USAGE_MOVEVM || enmCommand == USAGE_S_ALL)
|
---|
738 | RTStrmPrintf(pStrm,
|
---|
739 | "%s movevm %s <uuid|vmname>\n"
|
---|
740 | " --type basic\n"
|
---|
741 | " [--folder <path>]\n"
|
---|
742 | "\n", SEP);
|
---|
743 |
|
---|
744 | if (enmCommand == USAGE_IMPORTAPPLIANCE || enmCommand == USAGE_S_ALL)
|
---|
745 | RTStrmPrintf(pStrm,
|
---|
746 | "%s import %s <ovfname/ovaname>\n"
|
---|
747 | " [--dry-run|-n]\n"
|
---|
748 | " [--options keepallmacs|keepnatmacs|importtovdi]\n"
|
---|
749 | " [more options]\n"
|
---|
750 | " (run with -n to have options displayed\n"
|
---|
751 | " for a particular OVF)\n\n", SEP);
|
---|
752 |
|
---|
753 | if (enmCommand == USAGE_EXPORTAPPLIANCE || enmCommand == USAGE_S_ALL)
|
---|
754 | RTStrmPrintf(pStrm,
|
---|
755 | "%s export %s <machines> --output|-o <name>.<ovf/ova/tar.gz>\n"
|
---|
756 | " [--legacy09|--ovf09|--ovf10|--ovf20|--opc10]\n"
|
---|
757 | " [--manifest]\n"
|
---|
758 | " [--iso]\n"
|
---|
759 | " [--options manifest|iso|nomacs|nomacsbutnat]\n"
|
---|
760 | " [--vsys <number of virtual system>]\n"
|
---|
761 | " [--vmname <name>]\n"
|
---|
762 | " [--product <product name>]\n"
|
---|
763 | " [--producturl <product url>]\n"
|
---|
764 | " [--vendor <vendor name>]\n"
|
---|
765 | " [--vendorurl <vendor url>]\n"
|
---|
766 | " [--version <version info>]\n"
|
---|
767 | " [--description <description info>]\n"
|
---|
768 | " [--eula <license text>]\n"
|
---|
769 | " [--eulafile <filename>]\n"
|
---|
770 | " [--cloud <number of virtual system>]\n"
|
---|
771 | " [--vmname <name>]\n"
|
---|
772 | " [--cloudprofile <cloud profile name>]\n"
|
---|
773 | " [--cloudshape <shape>]\n"
|
---|
774 | " [--clouddomain <domain>]\n"
|
---|
775 | " [--clouddisksize <disk size in GB>]\n"
|
---|
776 | " [--cloudbucket <bucket name>]\n"
|
---|
777 | " [--cloudocivcn <OCI vcn id>]\n"
|
---|
778 | " [--cloudocisubnet <OCI subnet id>]\n"
|
---|
779 | " [--cloudkeepobject <true/false>]\n"
|
---|
780 | " [--cloudlaunchinstance <true/false>]\n"
|
---|
781 | " [--cloudpublicip <true/false>]\n"
|
---|
782 | "\n", SEP);
|
---|
783 |
|
---|
784 | if (enmCommand == USAGE_STARTVM || enmCommand == USAGE_S_ALL)
|
---|
785 | {
|
---|
786 | RTStrmPrintf(pStrm,
|
---|
787 | "%s startvm %s <uuid|vmname>...\n"
|
---|
788 | " [--type gui", SEP);
|
---|
789 | if (fVBoxSDL)
|
---|
790 | RTStrmPrintf(pStrm, "|sdl");
|
---|
791 | RTStrmPrintf(pStrm, "|headless|separate]\n");
|
---|
792 | RTStrmPrintf(pStrm,
|
---|
793 | " [-E|--putenv <NAME>[=<VALUE>]]\n"
|
---|
794 | "\n");
|
---|
795 | }
|
---|
796 |
|
---|
797 | if (enmCommand == USAGE_CONTROLVM || enmCommand == USAGE_S_ALL)
|
---|
798 | {
|
---|
799 | RTStrmPrintf(pStrm,
|
---|
800 | "%s controlvm %s <uuid|vmname>\n"
|
---|
801 | " pause|resume|reset|poweroff|savestate|\n"
|
---|
802 | " acpipowerbutton|acpisleepbutton|\n"
|
---|
803 | " keyboardputscancode <hex> [<hex> ...]|\n"
|
---|
804 | " keyboardputstring <string1> [<string2> ...]|\n"
|
---|
805 | " keyboardputfile <filename>|\n"
|
---|
806 | " setlinkstate<1-N> on|off |\n"
|
---|
807 | #if defined(VBOX_WITH_NETFLT)
|
---|
808 | " nic<1-N> null|nat|bridged|intnet|hostonly|generic|\n"
|
---|
809 | " natnetwork [<devicename>] |\n"
|
---|
810 | #else /* !VBOX_WITH_NETFLT */
|
---|
811 | " nic<1-N> null|nat|bridged|intnet|generic|natnetwork\n"
|
---|
812 | " [<devicename>] |\n"
|
---|
813 | #endif /* !VBOX_WITH_NETFLT */
|
---|
814 | " nictrace<1-N> on|off |\n"
|
---|
815 | " nictracefile<1-N> <filename> |\n"
|
---|
816 | " nicproperty<1-N> name=[value] |\n"
|
---|
817 | " nicpromisc<1-N> deny|allow-vms|allow-all |\n"
|
---|
818 | " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
|
---|
819 | " <hostport>,[<guestip>],<guestport> |\n"
|
---|
820 | " natpf<1-N> delete <rulename> |\n"
|
---|
821 | " guestmemoryballoon <balloonsize in MB> |\n"
|
---|
822 | " usbattach <uuid>|<address>\n"
|
---|
823 | " [--capturefile <filename>] |\n"
|
---|
824 | " usbdetach <uuid>|<address> |\n"
|
---|
825 | " audioin on|off |\n"
|
---|
826 | " audioout on|off |\n"
|
---|
827 | " clipboard disabled|hosttoguest|guesttohost|\n"
|
---|
828 | " bidirectional |\n"
|
---|
829 | " draganddrop disabled|hosttoguest|guesttohost|\n"
|
---|
830 | " bidirectional |\n"
|
---|
831 | " vrde on|off |\n"
|
---|
832 | " vrdeport <port> |\n"
|
---|
833 | " vrdeproperty <name=[value]> |\n"
|
---|
834 | " vrdevideochannelquality <percent> |\n"
|
---|
835 | " setvideomodehint <xres> <yres> <bpp>\n"
|
---|
836 | " [[<display>] [<enabled:yes|no> |\n"
|
---|
837 | " [<xorigin> <yorigin>]]] |\n"
|
---|
838 | " setscreenlayout <display> on|primary <xorigin> <yorigin> <xres> <yres> <bpp> | off\n"
|
---|
839 | " screenshotpng <file> [display] |\n"
|
---|
840 | #ifdef VBOX_WITH_RECORDING
|
---|
841 | " recording on|off |\n"
|
---|
842 | " recording screens all|none|<screen>,[<screen>...] |\n"
|
---|
843 | " recording filename <file> |\n"
|
---|
844 | " recording videores <width>x<height> |\n"
|
---|
845 | " recording videorate <rate> |\n"
|
---|
846 | " recording videofps <fps> |\n"
|
---|
847 | " recording maxtime <s> |\n"
|
---|
848 | " recording maxfilesize <MB> |\n"
|
---|
849 | #endif /* VBOX_WITH_RECORDING */
|
---|
850 | " setcredentials <username>\n"
|
---|
851 | " --passwordfile <file> | <password>\n"
|
---|
852 | " <domain>\n"
|
---|
853 | " [--allowlocallogon <yes|no>] |\n"
|
---|
854 | " teleport --host <name> --port <port>\n"
|
---|
855 | " [--maxdowntime <msec>]\n"
|
---|
856 | " [--passwordfile <file> |\n"
|
---|
857 | " --password <password>] |\n"
|
---|
858 | " plugcpu <id> |\n"
|
---|
859 | " unplugcpu <id> |\n"
|
---|
860 | " cpuexecutioncap <1-100>\n"
|
---|
861 | " webcam <attach [path [settings]]> | <detach [path]> | <list>\n"
|
---|
862 | " addencpassword <id>\n"
|
---|
863 | " <password file>|-\n"
|
---|
864 | " [--removeonsuspend <yes|no>]\n"
|
---|
865 | " removeencpassword <id>\n"
|
---|
866 | " removeallencpasswords\n"
|
---|
867 | " changeuartmode<1-N> disconnected|\n"
|
---|
868 | " server <pipe>|\n"
|
---|
869 | " client <pipe>|\n"
|
---|
870 | " tcpserver <port>|\n"
|
---|
871 | " tcpclient <hostname:port>|\n"
|
---|
872 | " file <file>|\n"
|
---|
873 | " <devicename>\n"
|
---|
874 | " vm-process-priority default|flat|low|normal|high\n"
|
---|
875 | "\n", SEP);
|
---|
876 | }
|
---|
877 |
|
---|
878 | if (enmCommand == USAGE_DISCARDSTATE || enmCommand == USAGE_S_ALL)
|
---|
879 | RTStrmPrintf(pStrm,
|
---|
880 | "%s discardstate %s <uuid|vmname>\n"
|
---|
881 | "\n", SEP);
|
---|
882 |
|
---|
883 | if (enmCommand == USAGE_ADOPTSTATE || enmCommand == USAGE_S_ALL)
|
---|
884 | RTStrmPrintf(pStrm,
|
---|
885 | "%s adoptstate %s <uuid|vmname> <state_file>\n"
|
---|
886 | "\n", SEP);
|
---|
887 |
|
---|
888 | if (enmCommand == USAGE_CLOSEMEDIUM || enmCommand == USAGE_S_ALL)
|
---|
889 | RTStrmPrintf(pStrm,
|
---|
890 | "%s closemedium %s [disk|dvd|floppy] <uuid|filename>\n"
|
---|
891 | " [--delete]\n"
|
---|
892 | "\n", SEP);
|
---|
893 |
|
---|
894 | if (enmCommand == USAGE_STORAGEATTACH || enmCommand == USAGE_S_ALL)
|
---|
895 | RTStrmPrintf(pStrm,
|
---|
896 | "%s storageattach %s <uuid|vmname>\n"
|
---|
897 | " --storagectl <name>\n"
|
---|
898 | " [--port <number>]\n"
|
---|
899 | " [--device <number>]\n"
|
---|
900 | " [--type dvddrive|hdd|fdd]\n"
|
---|
901 | " [--medium none|emptydrive|additions|\n"
|
---|
902 | " <uuid|filename>|host:<drive>|iscsi]\n"
|
---|
903 | " [--mtype normal|writethrough|immutable|shareable|\n"
|
---|
904 | " readonly|multiattach]\n"
|
---|
905 | " [--comment <text>]\n"
|
---|
906 | " [--setuuid <uuid>]\n"
|
---|
907 | " [--setparentuuid <uuid>]\n"
|
---|
908 | " [--passthrough on|off]\n"
|
---|
909 | " [--tempeject on|off]\n"
|
---|
910 | " [--nonrotational on|off]\n"
|
---|
911 | " [--discard on|off]\n"
|
---|
912 | " [--hotpluggable on|off]\n"
|
---|
913 | " [--bandwidthgroup <name>]\n"
|
---|
914 | " [--forceunmount]\n"
|
---|
915 | " [--server <name>|<ip>]\n"
|
---|
916 | " [--target <target>]\n"
|
---|
917 | " [--tport <port>]\n"
|
---|
918 | " [--lun <lun>]\n"
|
---|
919 | " [--encodedlun <lun>]\n"
|
---|
920 | " [--username <username>]\n"
|
---|
921 | " [--password <password>]\n"
|
---|
922 | " [--passwordfile <file>]\n"
|
---|
923 | " [--initiator <initiator>]\n"
|
---|
924 | " [--intnet]\n"
|
---|
925 | "\n", SEP);
|
---|
926 |
|
---|
927 | if (enmCommand == USAGE_STORAGECONTROLLER || enmCommand == USAGE_S_ALL)
|
---|
928 | RTStrmPrintf(pStrm,
|
---|
929 | "%s storagectl %s <uuid|vmname>\n"
|
---|
930 | " --name <name>\n"
|
---|
931 | " [--add ide|sata|scsi|floppy|sas|usb|pcie]\n"
|
---|
932 | " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
|
---|
933 | " IntelAHCI|PIIX3|PIIX4|ICH6|I82078|\n"
|
---|
934 | " [ USB|NVMe]\n"
|
---|
935 | " [--portcount <1-n>]\n"
|
---|
936 | " [--hostiocache on|off]\n"
|
---|
937 | " [--bootable on|off]\n"
|
---|
938 | " [--rename <name>]\n"
|
---|
939 | " [--remove]\n"
|
---|
940 | "\n", SEP);
|
---|
941 |
|
---|
942 | if (enmCommand == USAGE_BANDWIDTHCONTROL || enmCommand == USAGE_S_ALL)
|
---|
943 | RTStrmPrintf(pStrm,
|
---|
944 | "%s bandwidthctl %s <uuid|vmname>\n"
|
---|
945 | " add <name> --type disk|network\n"
|
---|
946 | " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
|
---|
947 | " set <name>\n"
|
---|
948 | " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
|
---|
949 | " remove <name> |\n"
|
---|
950 | " list [--machinereadable]\n"
|
---|
951 | " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
|
---|
952 | " K=kilobyte, M=megabyte, G=gigabyte)\n"
|
---|
953 | "\n", SEP);
|
---|
954 |
|
---|
955 | if (enmCommand == USAGE_SHOWMEDIUMINFO || enmCommand == USAGE_S_ALL)
|
---|
956 | RTStrmPrintf(pStrm,
|
---|
957 | "%s showmediuminfo %s [disk|dvd|floppy] <uuid|filename>\n"
|
---|
958 | "\n", SEP);
|
---|
959 |
|
---|
960 | if (enmCommand == USAGE_CREATEMEDIUM || enmCommand == USAGE_S_ALL)
|
---|
961 | RTStrmPrintf(pStrm,
|
---|
962 | "%s createmedium %s [disk|dvd|floppy] --filename <filename>\n"
|
---|
963 | " [--size <megabytes>|--sizebyte <bytes>]\n"
|
---|
964 | " [--diffparent <uuid>|<filename>]\n"
|
---|
965 | " [--format VDI|VMDK|VHD] (default: VDI)]\n"
|
---|
966 | " [--variant Standard,Fixed,Split2G,Stream,ESX,\n"
|
---|
967 | " Formatted]\n"
|
---|
968 | " [[--property <name>=<value>] --property <name>=<value]...\n"
|
---|
969 | "\n", SEP);
|
---|
970 |
|
---|
971 | if (enmCommand == USAGE_MODIFYMEDIUM || enmCommand == USAGE_S_ALL)
|
---|
972 | RTStrmPrintf(pStrm,
|
---|
973 | "%s modifymedium %s [disk|dvd|floppy] <uuid|filename>\n"
|
---|
974 | " [--type normal|writethrough|immutable|shareable|\n"
|
---|
975 | " readonly|multiattach]\n"
|
---|
976 | " [--autoreset on|off]\n"
|
---|
977 | " [--property <name=[value]>]\n"
|
---|
978 | " [--compact]\n"
|
---|
979 | " [--resize <megabytes>|--resizebyte <bytes>]\n"
|
---|
980 | " [--move <path>]\n"
|
---|
981 | " [--setlocation <path>]\n"
|
---|
982 | " [--description <description string>]"
|
---|
983 | "\n", SEP);
|
---|
984 |
|
---|
985 | if (enmCommand == USAGE_CLONEMEDIUM || enmCommand == USAGE_S_ALL)
|
---|
986 | RTStrmPrintf(pStrm,
|
---|
987 | "%s clonemedium %s [disk|dvd|floppy] <uuid|inputfile> <uuid|outputfile>\n"
|
---|
988 | " [--format VDI|VMDK|VHD|RAW|<other>]\n"
|
---|
989 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
990 | " [--existing]\n"
|
---|
991 | "\n", SEP);
|
---|
992 |
|
---|
993 | if (enmCommand == USAGE_MEDIUMPROPERTY || enmCommand == USAGE_S_ALL)
|
---|
994 | RTStrmPrintf(pStrm,
|
---|
995 | "%s mediumproperty %s [disk|dvd|floppy] set <uuid|filename>\n"
|
---|
996 | " <property> <value>\n"
|
---|
997 | "\n"
|
---|
998 | " [disk|dvd|floppy] get <uuid|filename>\n"
|
---|
999 | " <property>\n"
|
---|
1000 | "\n"
|
---|
1001 | " [disk|dvd|floppy] delete <uuid|filename>\n"
|
---|
1002 | " <property>\n"
|
---|
1003 | "\n", SEP);
|
---|
1004 |
|
---|
1005 | if (enmCommand == USAGE_ENCRYPTMEDIUM || enmCommand == USAGE_S_ALL)
|
---|
1006 | RTStrmPrintf(pStrm,
|
---|
1007 | "%s encryptmedium %s <uuid|filename>\n"
|
---|
1008 | " [--newpassword <file>|-]\n"
|
---|
1009 | " [--oldpassword <file>|-]\n"
|
---|
1010 | " [--cipher <cipher identifier>]\n"
|
---|
1011 | " [--newpasswordid <password identifier>]\n"
|
---|
1012 | "\n", SEP);
|
---|
1013 |
|
---|
1014 | if (enmCommand == USAGE_MEDIUMENCCHKPWD || enmCommand == USAGE_S_ALL)
|
---|
1015 | RTStrmPrintf(pStrm,
|
---|
1016 | "%s checkmediumpwd %s <uuid|filename>\n"
|
---|
1017 | " <pwd file>|-\n"
|
---|
1018 | "\n", SEP);
|
---|
1019 |
|
---|
1020 | if (enmCommand == USAGE_CONVERTFROMRAW || enmCommand == USAGE_S_ALL)
|
---|
1021 | RTStrmPrintf(pStrm,
|
---|
1022 | "%s convertfromraw %s <filename> <outputfile>\n"
|
---|
1023 | " [--format VDI|VMDK|VHD]\n"
|
---|
1024 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
1025 | " [--uuid <uuid>]\n"
|
---|
1026 | "%s convertfromraw %s stdin <outputfile> <bytes>\n"
|
---|
1027 | " [--format VDI|VMDK|VHD]\n"
|
---|
1028 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
1029 | " [--uuid <uuid>]\n"
|
---|
1030 | "\n", SEP, SEP);
|
---|
1031 |
|
---|
1032 | if (enmCommand == USAGE_GETEXTRADATA || enmCommand == USAGE_S_ALL)
|
---|
1033 | RTStrmPrintf(pStrm,
|
---|
1034 | "%s getextradata %s global|<uuid|vmname>\n"
|
---|
1035 | " <key>|[enumerate]\n"
|
---|
1036 | "\n", SEP);
|
---|
1037 |
|
---|
1038 | if (enmCommand == USAGE_SETEXTRADATA || enmCommand == USAGE_S_ALL)
|
---|
1039 | RTStrmPrintf(pStrm,
|
---|
1040 | "%s setextradata %s global|<uuid|vmname>\n"
|
---|
1041 | " <key>\n"
|
---|
1042 | " [<value>] (no value deletes key)\n"
|
---|
1043 | "\n", SEP);
|
---|
1044 |
|
---|
1045 | if (enmCommand == USAGE_SETPROPERTY || enmCommand == USAGE_S_ALL)
|
---|
1046 | RTStrmPrintf(pStrm,
|
---|
1047 | "%s setproperty %s machinefolder default|<folder> |\n"
|
---|
1048 | " hwvirtexclusive on|off |\n"
|
---|
1049 | " vrdeauthlibrary default|<library> |\n"
|
---|
1050 | " websrvauthlibrary default|null|<library> |\n"
|
---|
1051 | " vrdeextpack null|<library> |\n"
|
---|
1052 | " autostartdbpath null|<folder> |\n"
|
---|
1053 | " loghistorycount <value>\n"
|
---|
1054 | " defaultfrontend default|<name>\n"
|
---|
1055 | " logginglevel <log setting>\n"
|
---|
1056 | " proxymode system|noproxy|manual\n"
|
---|
1057 | " proxyurl <url>\n"
|
---|
1058 | "\n", SEP);
|
---|
1059 |
|
---|
1060 | if (enmCommand == USAGE_USBFILTER || enmCommand == USAGE_S_ALL)
|
---|
1061 | {
|
---|
1062 | if (fSubcommandScope & HELP_SCOPE_USBFILTER_ADD)
|
---|
1063 | RTStrmPrintf(pStrm,
|
---|
1064 | "%s usbfilter %s add <index,0-N>\n"
|
---|
1065 | " --target <uuid|vmname>|global\n"
|
---|
1066 | " --name <string>\n"
|
---|
1067 | " --action ignore|hold (global filters only)\n"
|
---|
1068 | " [--active yes|no] (yes)\n"
|
---|
1069 | " [--vendorid <XXXX>] (null)\n"
|
---|
1070 | " [--productid <XXXX>] (null)\n"
|
---|
1071 | " [--revision <IIFF>] (null)\n"
|
---|
1072 | " [--manufacturer <string>] (null)\n"
|
---|
1073 | " [--product <string>] (null)\n"
|
---|
1074 | " [--remote yes|no] (null, VM filters only)\n"
|
---|
1075 | " [--serialnumber <string>] (null)\n"
|
---|
1076 | " [--maskedinterfaces <XXXXXXXX>]\n"
|
---|
1077 | "\n", SEP);
|
---|
1078 |
|
---|
1079 | if (fSubcommandScope & HELP_SCOPE_USBFILTER_MODIFY)
|
---|
1080 | RTStrmPrintf(pStrm,
|
---|
1081 | "%s usbfilter %s modify <index,0-N>\n"
|
---|
1082 | " --target <uuid|vmname>|global\n"
|
---|
1083 | " [--name <string>]\n"
|
---|
1084 | " [--action ignore|hold] (global filters only)\n"
|
---|
1085 | " [--active yes|no]\n"
|
---|
1086 | " [--vendorid <XXXX>|\"\"]\n"
|
---|
1087 | " [--productid <XXXX>|\"\"]\n"
|
---|
1088 | " [--revision <IIFF>|\"\"]\n"
|
---|
1089 | " [--manufacturer <string>|\"\"]\n"
|
---|
1090 | " [--product <string>|\"\"]\n"
|
---|
1091 | " [--remote yes|no] (null, VM filters only)\n"
|
---|
1092 | " [--serialnumber <string>|\"\"]\n"
|
---|
1093 | " [--maskedinterfaces <XXXXXXXX>]\n"
|
---|
1094 | "\n", SEP);
|
---|
1095 |
|
---|
1096 | if (fSubcommandScope & HELP_SCOPE_USBFILTER_REMOVE)
|
---|
1097 | RTStrmPrintf(pStrm,
|
---|
1098 | "%s usbfilter %s remove <index,0-N>\n"
|
---|
1099 | " --target <uuid|vmname>|global\n"
|
---|
1100 | "\n", SEP);
|
---|
1101 | }
|
---|
1102 |
|
---|
1103 | if (enmCommand == USAGE_SHAREDFOLDER || enmCommand == USAGE_S_ALL)
|
---|
1104 | {
|
---|
1105 | if (fSubcommandScope & HELP_SCOPE_SHAREDFOLDER_ADD)
|
---|
1106 | RTStrmPrintf(pStrm,
|
---|
1107 | "%s sharedfolder %s add <uuid|vmname>\n"
|
---|
1108 | " --name <name> --hostpath <hostpath>\n"
|
---|
1109 | " [--transient] [--readonly] [--automount]\n"
|
---|
1110 | "\n", SEP);
|
---|
1111 |
|
---|
1112 | if (fSubcommandScope & HELP_SCOPE_SHAREDFOLDER_REMOVE)
|
---|
1113 | RTStrmPrintf(pStrm,
|
---|
1114 | "%s sharedfolder %s remove <uuid|vmname>\n"
|
---|
1115 | " --name <name> [--transient]\n"
|
---|
1116 | "\n", SEP);
|
---|
1117 | }
|
---|
1118 |
|
---|
1119 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
1120 | if (enmCommand == USAGE_GUESTPROPERTY || enmCommand == USAGE_S_ALL)
|
---|
1121 | usageGuestProperty(pStrm, SEP);
|
---|
1122 | #endif /* VBOX_WITH_GUEST_PROPS defined */
|
---|
1123 |
|
---|
1124 | #ifdef VBOX_WITH_GUEST_CONTROL
|
---|
1125 | if (enmCommand == USAGE_GUESTCONTROL || enmCommand == USAGE_S_ALL)
|
---|
1126 | usageGuestControl(pStrm, SEP, fSubcommandScope);
|
---|
1127 | #endif /* VBOX_WITH_GUEST_CONTROL defined */
|
---|
1128 |
|
---|
1129 | if (enmCommand == USAGE_METRICS || enmCommand == USAGE_S_ALL)
|
---|
1130 | RTStrmPrintf(pStrm,
|
---|
1131 | "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
|
---|
1132 | " (comma-separated)\n\n"
|
---|
1133 | "%s metrics %s setup\n"
|
---|
1134 | " [--period <seconds>] (default: 1)\n"
|
---|
1135 | " [--samples <count>] (default: 1)\n"
|
---|
1136 | " [--list]\n"
|
---|
1137 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
1138 | "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
1139 | "%s metrics %s enable\n"
|
---|
1140 | " [--list]\n"
|
---|
1141 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
1142 | "%s metrics %s disable\n"
|
---|
1143 | " [--list]\n"
|
---|
1144 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
1145 | "%s metrics %s collect\n"
|
---|
1146 | " [--period <seconds>] (default: 1)\n"
|
---|
1147 | " [--samples <count>] (default: 1)\n"
|
---|
1148 | " [--list]\n"
|
---|
1149 | " [--detach]\n"
|
---|
1150 | " [*|host|<vmname> [<metric_list>]]\n"
|
---|
1151 | "\n", SEP, SEP, SEP, SEP, SEP, SEP);
|
---|
1152 |
|
---|
1153 | #if defined(VBOX_WITH_NAT_SERVICE)
|
---|
1154 | if (enmCommand == USAGE_NATNETWORK || enmCommand == USAGE_S_ALL)
|
---|
1155 | {
|
---|
1156 | RTStrmPrintf(pStrm,
|
---|
1157 | "%s natnetwork %s add --netname <name>\n"
|
---|
1158 | " --network <network>\n"
|
---|
1159 | " [--enable|--disable]\n"
|
---|
1160 | " [--dhcp on|off]\n"
|
---|
1161 | " [--port-forward-4 <rule>]\n"
|
---|
1162 | " [--loopback-4 <rule>]\n"
|
---|
1163 | " [--ipv6 on|off]\n"
|
---|
1164 | " [--port-forward-6 <rule>]\n"
|
---|
1165 | " [--loopback-6 <rule>]\n\n"
|
---|
1166 | "%s natnetwork %s remove --netname <name>\n\n"
|
---|
1167 | "%s natnetwork %s modify --netname <name>\n"
|
---|
1168 | " [--network <network>]\n"
|
---|
1169 | " [--enable|--disable]\n"
|
---|
1170 | " [--dhcp on|off]\n"
|
---|
1171 | " [--port-forward-4 <rule>]\n"
|
---|
1172 | " [--loopback-4 <rule>]\n"
|
---|
1173 | " [--ipv6 on|off]\n"
|
---|
1174 | " [--port-forward-6 <rule>]\n"
|
---|
1175 | " [--loopback-6 <rule>]\n\n"
|
---|
1176 | "%s natnetwork %s start --netname <name>\n\n"
|
---|
1177 | "%s natnetwork %s stop --netname <name>\n\n"
|
---|
1178 | "%s natnetwork %s list [<pattern>]\n"
|
---|
1179 | "\n", SEP, SEP, SEP, SEP, SEP, SEP);
|
---|
1180 |
|
---|
1181 |
|
---|
1182 | }
|
---|
1183 | #endif
|
---|
1184 |
|
---|
1185 | #if defined(VBOX_WITH_NETFLT)
|
---|
1186 | if (enmCommand == USAGE_HOSTONLYIFS || enmCommand == USAGE_S_ALL)
|
---|
1187 | {
|
---|
1188 | RTStrmPrintf(pStrm,
|
---|
1189 | "%s hostonlyif %s ipconfig <name>\n"
|
---|
1190 | " [--dhcp |\n"
|
---|
1191 | " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
|
---|
1192 | " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
|
---|
1193 | # if !defined(RT_OS_SOLARIS) || defined(VBOX_ONLY_DOCS)
|
---|
1194 | " create |\n"
|
---|
1195 | " remove <name>\n"
|
---|
1196 | # endif
|
---|
1197 | "\n", SEP);
|
---|
1198 | }
|
---|
1199 | #endif
|
---|
1200 |
|
---|
1201 | if (enmCommand == USAGE_DHCPSERVER || enmCommand == USAGE_S_ALL)
|
---|
1202 | {
|
---|
1203 | RTStrmPrintf(pStrm,
|
---|
1204 | "%s dhcpserver %s add|modify --netname <network_name> |\n"
|
---|
1205 | #if defined(VBOX_WITH_NETFLT)
|
---|
1206 | " --ifname <hostonly_if_name>\n"
|
---|
1207 | #endif
|
---|
1208 | " [--ip <ip_address>\n"
|
---|
1209 | " --netmask <network_mask>\n"
|
---|
1210 | " --lowerip <lower_ip>\n"
|
---|
1211 | " --upperip <upper_ip>]\n"
|
---|
1212 | " [--enable | --disable]\n"
|
---|
1213 | " [--options [--vm <name> --nic <1-N>]\n"
|
---|
1214 | " --id <number> [--value <string> | --remove]]\n"
|
---|
1215 | " (multiple options allowed after --options)\n\n"
|
---|
1216 | "%s dhcpserver %s remove --netname <network_name> |\n"
|
---|
1217 | #if defined(VBOX_WITH_NETFLT)
|
---|
1218 | " --ifname <hostonly_if_name>\n"
|
---|
1219 | #endif
|
---|
1220 | "\n", SEP, SEP);
|
---|
1221 | }
|
---|
1222 |
|
---|
1223 | if (enmCommand == USAGE_USBDEVSOURCE || enmCommand == USAGE_S_ALL)
|
---|
1224 | {
|
---|
1225 | RTStrmPrintf(pStrm,
|
---|
1226 | "%s usbdevsource %s add <source name>\n"
|
---|
1227 | " --backend <backend>\n"
|
---|
1228 | " --address <address>\n"
|
---|
1229 | "%s usbdevsource %s remove <source name>\n"
|
---|
1230 | "\n", SEP, SEP);
|
---|
1231 | }
|
---|
1232 |
|
---|
1233 | #ifndef VBOX_ONLY_DOCS /* Converted to man page, not needed. */
|
---|
1234 | if (enmCommand == USAGE_S_ALL)
|
---|
1235 | {
|
---|
1236 | uint32_t cPendingBlankLines = 0;
|
---|
1237 | for (uint32_t i = 0; i < g_cHelpEntries; i++)
|
---|
1238 | {
|
---|
1239 | PCRTMSGREFENTRY pHelp = g_apHelpEntries[i];
|
---|
1240 | while (cPendingBlankLines-- > 0)
|
---|
1241 | RTStrmPutCh(pStrm, '\n');
|
---|
1242 | RTStrmPrintf(pStrm, " %c%s:\n", RT_C_TO_UPPER(pHelp->pszBrief[0]), pHelp->pszBrief + 1);
|
---|
1243 | cPendingBlankLines = 0;
|
---|
1244 | RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Synopsis, RTMSGREFENTRYSTR_SCOPE_GLOBAL,
|
---|
1245 | &cPendingBlankLines, NULL /*pcLinesWritten*/);
|
---|
1246 | cPendingBlankLines = RT_MAX(cPendingBlankLines, 1);
|
---|
1247 | }
|
---|
1248 | }
|
---|
1249 | #endif
|
---|
1250 | }
|
---|
1251 |
|
---|
1252 | /**
|
---|
1253 | * Print a usage synopsis and the syntax error message.
|
---|
1254 | * @returns RTEXITCODE_SYNTAX.
|
---|
1255 | */
|
---|
1256 | RTEXITCODE errorSyntax(USAGECATEGORY enmCommand, const char *pszFormat, ...)
|
---|
1257 | {
|
---|
1258 | va_list args;
|
---|
1259 | showLogo(g_pStdErr); // show logo even if suppressed
|
---|
1260 | #ifndef VBOX_ONLY_DOCS
|
---|
1261 | if (g_fInternalMode)
|
---|
1262 | printUsageInternal(enmCommand, g_pStdErr);
|
---|
1263 | else
|
---|
1264 | printUsage(enmCommand, RTMSGREFENTRYSTR_SCOPE_GLOBAL, g_pStdErr);
|
---|
1265 | #else
|
---|
1266 | RT_NOREF_PV(enmCommand);
|
---|
1267 | #endif
|
---|
1268 | va_start(args, pszFormat);
|
---|
1269 | RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
|
---|
1270 | va_end(args);
|
---|
1271 | return RTEXITCODE_SYNTAX;
|
---|
1272 | }
|
---|
1273 |
|
---|
1274 | /**
|
---|
1275 | * Print a usage synopsis and the syntax error message.
|
---|
1276 | * @returns RTEXITCODE_SYNTAX.
|
---|
1277 | */
|
---|
1278 | RTEXITCODE errorSyntaxEx(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, const char *pszFormat, ...)
|
---|
1279 | {
|
---|
1280 | va_list args;
|
---|
1281 | showLogo(g_pStdErr); // show logo even if suppressed
|
---|
1282 | #ifndef VBOX_ONLY_DOCS
|
---|
1283 | if (g_fInternalMode)
|
---|
1284 | printUsageInternal(enmCommand, g_pStdErr);
|
---|
1285 | else
|
---|
1286 | printUsage(enmCommand, fSubcommandScope, g_pStdErr);
|
---|
1287 | #else
|
---|
1288 | RT_NOREF2(enmCommand, fSubcommandScope);
|
---|
1289 | #endif
|
---|
1290 | va_start(args, pszFormat);
|
---|
1291 | RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
|
---|
1292 | va_end(args);
|
---|
1293 | return RTEXITCODE_SYNTAX;
|
---|
1294 | }
|
---|
1295 |
|
---|
1296 | /**
|
---|
1297 | * errorSyntax for RTGetOpt users.
|
---|
1298 | *
|
---|
1299 | * @returns RTEXITCODE_SYNTAX.
|
---|
1300 | *
|
---|
1301 | * @param enmCommand The command.
|
---|
1302 | * @param fSubcommandScope The subcommand scope, REFENTRYSTR_SCOPE_GLOBAL
|
---|
1303 | * for all.
|
---|
1304 | * @param rc The RTGetOpt return code.
|
---|
1305 | * @param pValueUnion The value union.
|
---|
1306 | */
|
---|
1307 | RTEXITCODE errorGetOptEx(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, int rc, union RTGETOPTUNION const *pValueUnion)
|
---|
1308 | {
|
---|
1309 | /*
|
---|
1310 | * Check if it is an unhandled standard option.
|
---|
1311 | */
|
---|
1312 | #ifndef VBOX_ONLY_DOCS
|
---|
1313 | if (rc == 'V')
|
---|
1314 | {
|
---|
1315 | RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
|
---|
1316 | return RTEXITCODE_SUCCESS;
|
---|
1317 | }
|
---|
1318 | #endif
|
---|
1319 |
|
---|
1320 | if (rc == 'h')
|
---|
1321 | {
|
---|
1322 | showLogo(g_pStdErr);
|
---|
1323 | #ifndef VBOX_ONLY_DOCS
|
---|
1324 | if (g_fInternalMode)
|
---|
1325 | printUsageInternal(enmCommand, g_pStdOut);
|
---|
1326 | else
|
---|
1327 | printUsage(enmCommand, fSubcommandScope, g_pStdOut);
|
---|
1328 | #endif
|
---|
1329 | return RTEXITCODE_SUCCESS;
|
---|
1330 | }
|
---|
1331 |
|
---|
1332 | /*
|
---|
1333 | * General failure.
|
---|
1334 | */
|
---|
1335 | showLogo(g_pStdErr); // show logo even if suppressed
|
---|
1336 | #ifndef VBOX_ONLY_DOCS
|
---|
1337 | if (g_fInternalMode)
|
---|
1338 | printUsageInternal(enmCommand, g_pStdErr);
|
---|
1339 | else
|
---|
1340 | printUsage(enmCommand, fSubcommandScope, g_pStdErr);
|
---|
1341 | #else
|
---|
1342 | RT_NOREF2(enmCommand, fSubcommandScope);
|
---|
1343 | #endif
|
---|
1344 |
|
---|
1345 | if (rc == VINF_GETOPT_NOT_OPTION)
|
---|
1346 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
|
---|
1347 | if (rc > 0)
|
---|
1348 | {
|
---|
1349 | if (RT_C_IS_PRINT(rc))
|
---|
1350 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
|
---|
1351 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
|
---|
1352 | }
|
---|
1353 | if (rc == VERR_GETOPT_UNKNOWN_OPTION)
|
---|
1354 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
|
---|
1355 | if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
|
---|
1356 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
|
---|
1357 | if (pValueUnion->pDef)
|
---|
1358 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
|
---|
1359 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
|
---|
1360 | }
|
---|
1361 |
|
---|
1362 | /**
|
---|
1363 | * errorSyntax for RTGetOpt users.
|
---|
1364 | *
|
---|
1365 | * @returns RTEXITCODE_SYNTAX.
|
---|
1366 | *
|
---|
1367 | * @param enmCommand The command.
|
---|
1368 | * @param rc The RTGetOpt return code.
|
---|
1369 | * @param pValueUnion The value union.
|
---|
1370 | */
|
---|
1371 | RTEXITCODE errorGetOpt(USAGECATEGORY enmCommand, int rc, union RTGETOPTUNION const *pValueUnion)
|
---|
1372 | {
|
---|
1373 | return errorGetOptEx(enmCommand, RTMSGREFENTRYSTR_SCOPE_GLOBAL, rc, pValueUnion);
|
---|
1374 | }
|
---|
1375 |
|
---|
1376 | /**
|
---|
1377 | * Print an error message without the syntax stuff.
|
---|
1378 | *
|
---|
1379 | * @returns RTEXITCODE_SYNTAX.
|
---|
1380 | */
|
---|
1381 | RTEXITCODE errorArgument(const char *pszFormat, ...)
|
---|
1382 | {
|
---|
1383 | va_list args;
|
---|
1384 | va_start(args, pszFormat);
|
---|
1385 | RTMsgErrorV(pszFormat, args);
|
---|
1386 | va_end(args);
|
---|
1387 | return RTEXITCODE_SYNTAX;
|
---|
1388 | }
|
---|
1389 |
|
---|