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