浏览代码

Merge pull request #3449 from afishbeck/ecl_roxie_help7917

HPCC-7917 Add CLI support for a --help option

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 年之前
父节点
当前提交
23d940b8b7
共有 4 个文件被更改,包括 11 次插入2 次删除
  1. 5 0
      ecl/eclcmd/eclcmd_common.cpp
  2. 4 0
      ecl/eclcmd/eclcmd_common.hpp
  3. 1 1
      ecl/eclcmd/eclcmd_shell.cpp
  4. 1 1
      ecl/eclcmd/roxie/ecl-roxie.cpp

+ 5 - 0
ecl/eclcmd/eclcmd_common.cpp

@@ -279,6 +279,11 @@ StringBuffer &EclObjectParameter::getDescription(StringBuffer &s)
 eclCmdOptionMatchIndicator EclCmdCommon::matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
 eclCmdOptionMatchIndicator EclCmdCommon::matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
 {
 {
     bool boolValue;
     bool boolValue;
+    if (iter.matchFlag(boolValue, ECLOPT_HELP))
+    {
+        usage();
+        return EclCmdOptionCompletion;
+    }
     if (iter.matchFlag(boolValue, ECLOPT_VERSION))
     if (iter.matchFlag(boolValue, ECLOPT_VERSION))
     {
     {
         fprintf(stdout, "%s\n", BUILD_TAG);
         fprintf(stdout, "%s\n", BUILD_TAG);

+ 4 - 0
ecl/eclcmd/eclcmd_common.hpp

@@ -32,6 +32,9 @@ interface IEclCommand : extends IInterface
 
 
 typedef IEclCommand *(*EclCommandFactory)(const char *cmdname);
 typedef IEclCommand *(*EclCommandFactory)(const char *cmdname);
 
 
+#define ECLOPT_HELP "--help"
+#define ECLARG_HELP "help"
+
 #define ECLOPT_SERVER "--server"
 #define ECLOPT_SERVER "--server"
 #define ECLOPT_SERVER_S "-s"
 #define ECLOPT_SERVER_S "-s"
 #define ECLOPT_SERVER_INI "eclWatchIP"
 #define ECLOPT_SERVER_INI "eclWatchIP"
@@ -182,6 +185,7 @@ public:
     virtual void usage()
     virtual void usage()
     {
     {
         fprintf(stdout,
         fprintf(stdout,
+            "   --help                 display usage information for the given command\n"
             "   -v, --verbose          output additional tracing information\n"
             "   -v, --verbose          output additional tracing information\n"
             "   -s, --server=<ip>      ip of server running ecl services (eclwatch)\n"
             "   -s, --server=<ip>      ip of server running ecl services (eclwatch)\n"
             "   --port=<port>          ecl services port\n"
             "   --port=<port>          ecl services port\n"

+ 1 - 1
ecl/eclcmd/eclcmd_shell.cpp

@@ -156,7 +156,7 @@ bool EclCMDShell::parseCommandLineOptions(ArgvIterator &iter)
     for (; !iter.done(); iter.next())
     for (; !iter.done(); iter.next())
     {
     {
         const char * arg = iter.query();
         const char * arg = iter.query();
-        if (iter.matchFlag(optHelp, "help"))
+        if (iter.matchFlag(optHelp, ECLARG_HELP) || iter.matchFlag(optHelp, ECLOPT_HELP)) //users expect --help to work too
             continue;
             continue;
         if (*arg!='-')
         if (*arg!='-')
         {
         {

+ 1 - 1
ecl/eclcmd/roxie/ecl-roxie.cpp

@@ -216,7 +216,7 @@ public:
         if (attach)
         if (attach)
             fputs("\nUsage:\n"
             fputs("\nUsage:\n"
                 "\n"
                 "\n"
-                "The 'roxie attach' command (re)attaches a roxie process cluster to its"
+                "The 'roxie attach' command (re)attaches a roxie process cluster to its\n"
                 "DALI allowing changes to the environment or contents of its assigned\n"
                 "DALI allowing changes to the environment or contents of its assigned\n"
                 "querysets to take effect.\n"
                 "querysets to take effect.\n"
                 "\n"
                 "\n"