VirtualBox

Ignore:
Timestamp:
Mar 17, 2022 12:47:49 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150557
Message:

doc/manual,FE/VBoxManage: Make use of the general options from the refentry XML files when printing the help text and some more cleanups getting rid of all the legacy help code, bugref:9186

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r94240 r94290  
    4949DECLARE_TRANSLATION_CONTEXT(Help);
    5050
    51 static enum HELP_CMD_VBOXMANAGE    g_enmCurCommand = HELP_CMD_VBOXMANAGE_INVALID;
     51static enum HELP_CMD_VBOXMANAGE    g_enmCurCommand = HELP_CMD_COMMON;
    5252/** The scope mask for the current subcommand. */
    5353static uint64_t                    g_fCurSubcommandScope = RTMSGREFENTRYSTR_SCOPE_GLOBAL;
     
    6262void setCurrentCommand(enum HELP_CMD_VBOXMANAGE enmCommand)
    6363{
    64     Assert(g_enmCurCommand == HELP_CMD_VBOXMANAGE_INVALID);
     64    Assert(g_enmCurCommand == HELP_CMD_COMMON);
    6565    g_enmCurCommand       = enmCommand;
    6666    g_fCurSubcommandScope = RTMSGREFENTRYSTR_SCOPE_GLOBAL;
     
    128128        {
    129129            PCRTMSGREFENTRY pHelp = apHelpLangEntries[k]->papHelpEntries[i];
    130             if (pHelp->idInternal == (int64_t)enmCommand)
     130            if (   pHelp->idInternal == (int64_t)enmCommand
     131                || enmCommand == HELP_CMD_COMMON)
    131132            {
    132133                cFound++;
     
    194195
    195196            if (   pHelp->idInternal == (int64_t)enmCommand
    196                 || enmCommand == HELP_CMD_VBOXMANAGE_INVALID)
     197                || enmCommand == HELP_CMD_COMMON)
    197198            {
    198199                cFound++;
     
    503504    }
    504505}
    505 
    506 
    507 
    508 
    509 void printUsage(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, PRTSTREAM pStrm)
    510 {
    511     RT_NOREF(fSubcommandScope);
    512 
    513     Assert(enmCommand != USAGE_INVALID);
    514     Assert(enmCommand != USAGE_S_NEWCMD);
    515 
    516     if (enmCommand == USAGE_S_DUMPOPTS)
    517         enmCommand = USAGE_S_ALL;
    518 
    519     RTStrmPrintf(pStrm,
    520                  Help::tr("Usage:\n"
    521                           "\n"));
    522 
    523     if (enmCommand == USAGE_S_ALL)
    524         RTStrmPrintf(pStrm,
    525                      "  VBoxManage [<general option>] <command>\n"
    526                      "\n"
    527                      "\n"
    528                      "General Options:\n"
    529                      "\n"
    530                      "  [-V|--version]            print version number and exit\n"
    531                      "  [--dump-build-type]       print build type and exit\n"
    532                      "  [-q|--nologo]             suppress the logo\n"
    533                      "  [--settingspw <pw>]       provide the settings password\n"
    534                      "  [--settingspwfile <file>] provide a file containing the settings password\n"
    535                      "  [@<response-file>]        load arguments from the given response file (bourne style)\n"
    536                      "\n"
    537                      "\n"
    538                      "Commands:\n"
    539                      "\n");
    540 
    541     if (enmCommand == USAGE_S_ALL)
    542     {
    543         uint32_t            cPendingBlankLines = 0;
    544         PCHELP_LANG_ENTRY_T pHelpLangEntry     = ASMAtomicUoReadPtrT(&g_pHelpLangEntry, PCHELP_LANG_ENTRY_T);
    545         uint32_t const      cHelpEntries       = *pHelpLangEntry->pcHelpEntries;
    546         for (uint32_t i = 0; i < cHelpEntries; i++)
    547         {
    548             PCRTMSGREFENTRY pHelp = pHelpLangEntry->papHelpEntries[i];
    549 
    550             while (cPendingBlankLines-- > 0)
    551                 RTStrmPutCh(pStrm, '\n');
    552 
    553             char szFirstChar[8];
    554             RTStrmPrintf(pStrm, " %s%s:\n", szFirstChar, captialize(pHelp->pszBrief, szFirstChar));
    555 
    556             cPendingBlankLines = 0;
    557             RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Synopsis, RTMSGREFENTRYSTR_SCOPE_GLOBAL,
    558                                           &cPendingBlankLines, NULL /*pcLinesWritten*/);
    559             cPendingBlankLines = RT_MAX(cPendingBlankLines, 1);
    560         }
    561     }
    562 }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette