VirtualBox

Changeset 42521 in vbox


Ignore:
Timestamp:
Aug 1, 2012 8:13:21 PM (12 years ago)
Author:
vboxsync
Message:

Additions/common/VBoxService: clean up toolbox help slightly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp

    r42515 r42521  
    107107
    108108/**
     109 * Displays a common header for all help text to stdout.
     110 */
     111static void VBoxServiceToolboxShowUsageHeader(void)
     112{
     113    RTPrintf(VBOX_PRODUCT " Guest Toolbox Version "
     114             VBOX_VERSION_STRING "\n"
     115             "(C) " VBOX_C_YEAR " " VBOX_VENDOR "\n"
     116             "All rights reserved.\n"
     117             "\n");
     118    RTPrintf("Usage:\n\n");
     119}
     120
     121
     122/**
    109123 * Displays a help text to stdout.
    110124 */
    111125static void VBoxServiceToolboxShowUsage(void)
    112126{
    113     RTPrintf("Toolbox Usage:\n"
    114              "cat [FILE] - Concatenate FILE(s), or standard input, to standard output.\n"
     127    VBoxServiceToolboxShowUsageHeader();
     128    RTPrintf("  VBoxService [--use-toolbox] vbox_<command> <general options> <parameters>\n\n"
     129             "General options:\n\n"
     130             "  --machinereadable          produce all output in machine-readable form\n"
     131             "  -V                         print version number and exit\n"
    115132             "\n"
    116              /** @todo Document options! */
    117              "ls [OPTION]... FILE... - List information about the FILEs (the current directory by default).\n"
    118              "\n"
    119              /** @todo Document options! */
    120              "rm [OPTION]... FILE... - delete FILEs (the current directory by default).\n"
    121              "\n"
    122              /** @todo Document options! */
    123              "mkdir [OPTION]... DIRECTORY... - Create the DIRECTORY(ies), if they do not already exist.\n"
    124              "\n"
    125              /** @todo Document options! */
    126              "stat [OPTION]... FILE... - Display file or file system status.\n"
    127              "\n"
    128              /** @todo Document options! */
     133             "Commands:\n\n"
     134             "  cat <general options>      <file>...\n"
     135             "  ls <general options>       [--dereference|-L] [-l] [-R]\n"
     136             "                             [--verbose|-v] [<file>...]\n"
     137             "  rm <general options>       [-r|-R] <file>...\n"
     138             "  mkdir <general options>    [--mode|-m] [--parents|-p]\n"
     139             "                             [--verbose|-v] <directory>...\n"
     140             "  stat <general options>     [--file-system|-f]\n"
     141             "                             [--dereference|-L] [--terse|-t]\n"
     142             "                             [--verbose|-v] <file>...\n"
    129143             "\n");
    130144}
     
    291305
    292306
     307/** @todo Document options! */
     308static char g_paszCatHelp[] =
     309    "  VBoxService [--use-toolbox] vbox_cat <general options> <file>...\n\n"
     310    "Concatenate files, or standard input, to standard output.\n"
     311    "\n";
     312
     313
    293314/**
    294315 * Main function for tool "vbox_cat".
     
    360381
    361382            case 'h':
    362                 VBoxServiceToolboxShowUsage();
     383                VBoxServiceToolboxShowUsageHeader();
     384                RTPrintf("%s", g_paszCatHelp);
    363385                return RTEXITCODE_SUCCESS;
    364386
     
    744766
    745767
     768/** @todo Document options! */
     769static char g_paszLsHelp[] =
     770    "  VBoxService [--use-toolbox] vbox_ls <general options> [option]...\n"
     771    "                                      [<file>...]\n\n"
     772    "List information about files (the current directory by default).\n\n"
     773    "Options:\n\n"
     774    "  [--dereference|-L]\n"
     775    "  [-l][-R]\n"
     776    "  [--verbose|-v]\n"
     777    "  [<file>...]\n"
     778    "\n";
     779
     780
    746781/**
    747782 * Main function for tool "vbox_ls".
     
    785820        {
    786821            case 'h':
    787                 VBoxServiceToolboxShowUsage();
     822                VBoxServiceToolboxShowUsageHeader();
     823                RTPrintf("%s", g_paszLsHelp);
    788824                return RTEXITCODE_SUCCESS;
    789825
     
    903939
    904940
     941static char g_paszRmHelp[] =
     942    "  VBoxService [--use-toolbox] vbox_rm <general options> <file>...\n\n"
     943    "Delete files and optionally directories if the '-R' or '-r' option is specified.\n"
     944    "If a file or directory cannot be deleted, an error message is printed if the\n"
     945    "'--machine-readable' option is not specified and the next file will be\n"
     946    "processed. The root directory is always ignored.\n\n"
     947    "Options:\n\n"
     948    "  [-R|-r]                    Recursively delete directories too.\n"
     949    "\n";
     950
     951
    905952/**
    906953 * Main function for tool "vbox_rm".
     
    947994        {
    948995            case 'h':
    949                 VBoxServiceToolboxShowUsage();
     996                VBoxServiceToolboxShowUsageHeader();
     997                RTPrintf("%s", g_paszRmHelp);
    950998                return RTEXITCODE_SUCCESS;
    951999
     
    10421090
    10431091
     1092/** @todo Document options! */
     1093static char g_paszMkDirHelp[] =
     1094    "  VBoxService [--use-toolbox] vbox_mkdir <general options> [options]\n"
     1095    "                                         <directory>...\n\n"
     1096    "Options:\n\n"
     1097    "  [--mode=<mode>|-m <mode>]  The file mode to set (chmod) on the created\n"
     1098    "                             directories.  Default: a=rwx & umask.\n"
     1099    "  [--parents|-p]             Create parent directories as needed, no\n"
     1100    "                             error if the directory already exists.\n"
     1101    "  [--verbose|-v]             Display a message for each created directory.\n"
     1102    "\n";
     1103
     1104
    10441105/**
    10451106 * Main function for tool "vbox_mkdir".
     
    10991160
    11001161            case 'h':
    1101                 RTPrintf("Usage: %s [options] dir1 [dir2...]\n"
    1102                          "\n"
    1103                          "Options:\n"
    1104                          "    -m,--mode=<mode>  The file mode to set (chmod) on the created\n"
    1105                          "                      directories.  Default: a=rwx & umask.\n"
    1106                          "    -p,--parents      Create parent directories as needed, no\n"
    1107                          "                      error if the directory already exists.\n"
    1108                          "    -v,--verbose      Display a message for each created directory.\n"
    1109                          "    -V,--version      Display the version and exit\n"
    1110                          "    -h,--help         Display this help text and exit.\n"
    1111                          , argv[0]);
     1162                VBoxServiceToolboxShowUsageHeader();
     1163                RTPrintf("%s", g_paszMkDirHelp);
    11121164                return RTEXITCODE_SUCCESS;
    11131165
     
    11471199
    11481200
     1201/** @todo Document options! */
     1202static char g_paszStatHelp[] =
     1203    "  VBoxService [--use-toolbox] vbox_stat <general options> [options] <file>...\n\n"
     1204    "Display file or file system status.\n\n"
     1205    "Options:\n\n"
     1206    "  [--file-system|-f]\n"
     1207    "  [--dereference|-L]\n"
     1208    "  [--terse|-t]\n"
     1209    "  [--verbose|-v]\n"
     1210    "\n";
     1211
     1212
    11491213/**
    11501214 * Main function for tool "vbox_stat".
     
    12011265
    12021266            case 'h':
    1203                 VBoxServiceToolboxShowUsage();
     1267                VBoxServiceToolboxShowUsageHeader();
     1268                RTPrintf("%s", g_paszStatHelp);
    12041269                return RTEXITCODE_SUCCESS;
    12051270
     
    13491414        if (!pfnHandler)
    13501415        {
    1351            *prcExit = RTMsgErrorExit(RTEXITCODE_SYNTAX, "Toolbox program '%s' does not exist", pszTool);
     1416           *prcExit = RTEXITCODE_SUCCESS;
     1417           if (!strcmp(pszTool, "-V"))
     1418           {
     1419               VBoxServiceToolboxShowVersion();
     1420               return true;
     1421           }
     1422           if (   (strcmp(pszTool, "help")) && (strcmp(pszTool, "--help"))
     1423               && (strcmp(pszTool, "-h")))
     1424               *prcExit = RTEXITCODE_SYNTAX;
     1425           VBoxServiceToolboxShowUsage();
    13521426           return true;
    13531427        }
Note: See TracChangeset for help on using the changeset viewer.

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