瀏覽代碼

Merge pull request #9735 from afishbeck/eclcmdHelpHelp

HPCC-16921 Fix ecl-run --help displaying twice

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 年之前
父節點
當前提交
e4096a7d17

+ 12 - 10
ecl/ecl-bundle/ecl-bundle.cpp

@@ -987,7 +987,7 @@ public:
       : EclCmdCommon(false), bundleCompulsory(_bundleCompulsory)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         for (; !iter.done(); iter.next())
         {
@@ -999,14 +999,15 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
-            if (matchCommandLineOption(iter, true) != EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -1167,7 +1168,7 @@ protected:
 class EclCmdBundleBaseWithVersion : public EclCmdBundleBase
 {
 public:
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         for (; !iter.done(); iter.next())
         {
@@ -1179,14 +1180,15 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
-            if (matchCommandLineOption(iter, true) != EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual eclCmdOptionMatchIndicator matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
     {

+ 76 - 65
ecl/ecl-package/ecl-package.cpp

@@ -52,10 +52,10 @@ public:
     EclCmdPackageActivate() : optGlobalScope(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -69,16 +69,17 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
             if (iter.matchFlag(optGlobalScope, ECLOPT_GLOBAL_SCOPE))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -140,10 +141,10 @@ public:
     EclCmdPackageDeActivate() : optGlobalScope(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -157,16 +158,17 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
             if (iter.matchFlag(optGlobalScope, ECLOPT_GLOBAL_SCOPE))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -227,7 +229,7 @@ public:
     EclCmdPackageList()
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         for (; !iter.done(); iter.next())
         {
@@ -239,14 +241,15 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -312,10 +315,10 @@ public:
     EclCmdPackageInfo()
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -327,14 +330,15 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -378,10 +382,10 @@ public:
     EclCmdPackageDelete()
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -395,16 +399,17 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
             if (iter.matchFlag(optGlobalScope, ECLOPT_GLOBAL_SCOPE))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -475,10 +480,10 @@ public:
         optUpdateSuperfiles(false), optUpdateCloneFrom(false), optDontAppendCluster(false), optReplacePackagemap(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -492,7 +497,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -520,10 +525,11 @@ public:
                 continue;
             if (iter.matchFlag(optPreloadAll, ECLOPT_PRELOAD_ALL_PACKAGES))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -647,10 +653,10 @@ public:
     EclCmdPackageValidate() : optValidateActive(false), optCheckDFS(false), optGlobalScope(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -664,7 +670,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -682,10 +688,11 @@ public:
                 optQueryIds.appendList(queryIds.get(), ",");
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -877,10 +884,10 @@ public:
     EclCmdPackageQueryFiles() : optGlobalScope(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -894,7 +901,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -902,10 +909,11 @@ public:
                 continue;
             if (iter.matchFlag(optGlobalScope, ECLOPT_GLOBAL_SCOPE))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -1003,10 +1011,10 @@ public:
     EclCmdPackageAddPart() : optDeletePrevious(false), optGlobalScope(false), optAllowForeign(false), optPreloadAll(false), optUpdateSuperfiles(false), optUpdateCloneFrom(false), optDontAppendCluster(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -1022,7 +1030,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -1046,10 +1054,11 @@ public:
                 continue;
             if (iter.matchFlag(optDontAppendCluster, ECLOPT_DONT_APPEND_CLUSTER))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -1166,10 +1175,10 @@ public:
     EclCmdPackageRemovePart()
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -1185,16 +1194,17 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
             if (iter.matchFlag(optGlobalScope, ECLOPT_GLOBAL_SCOPE))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -1265,10 +1275,10 @@ public:
     EclCmdPackageGetPart()
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -1284,16 +1294,17 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
             if (iter.matchFlag(optGlobalScope, ECLOPT_GLOBAL_SCOPE))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {

+ 6 - 5
ecl/eclcmd/eclcmd_common.cpp

@@ -761,15 +761,16 @@ bool EclCmdWithQueryTarget::finalizeOptions(IProperties *globals)
     return EclCmdCommon::finalizeOptions(globals);
 }
 
-bool EclCmdWithQueryTarget::parseCommandLineOptions(ArgvIterator &iter)
+eclCmdOptionMatchIndicator EclCmdWithQueryTarget::parseCommandLineOptions(ArgvIterator &iter)
 {
     if (iter.done())
-        return false;
+        return EclCmdOptionNoMatch;
 
     for (; !iter.done(); iter.next())
     {
-        if (EclCmdWithQueryTarget::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-            return false;
+        eclCmdOptionMatchIndicator ind = EclCmdWithQueryTarget::matchCommandLineOption(iter, true);
+        if (ind != EclCmdOptionMatch)
+            return ind;
     }
-    return true;
+    return EclCmdOptionMatch;
 }

+ 9 - 9
ecl/eclcmd/eclcmd_common.hpp

@@ -23,9 +23,16 @@
 
 //=========================================================================================
 
+enum eclCmdOptionMatchIndicator
+{
+    EclCmdOptionNoMatch=0,
+    EclCmdOptionMatch=1,
+    EclCmdOptionCompletion=2
+};
+
 interface IEclCommand : extends IInterface
 {
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)=0;
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)=0;
     virtual bool finalizeOptions(IProperties *globals)=0;
     virtual int processCMD()=0;
     virtual void usage()=0;
@@ -214,13 +221,6 @@ public:
     unsigned accept;
 };
 
-enum eclCmdOptionMatchIndicator
-{
-    EclCmdOptionNoMatch=0,
-    EclCmdOptionMatch=1,
-    EclCmdOptionCompletion=2
-};
-
 class EclCmdCommon : implements IEclCommand, public CInterface
 {
 public:
@@ -329,7 +329,7 @@ public:
     }
     virtual eclCmdOptionMatchIndicator matchCommandLineOption(ArgvIterator &iter, bool finalAttempt=false);
     virtual bool finalizeOptions(IProperties *globals);
-    virtual bool parseCommandLineOptions(ArgvIterator &iter);
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter);
 
     virtual void usage()
     {

+ 49 - 41
ecl/eclcmd/eclcmd_core.cpp

@@ -234,20 +234,22 @@ public:
     {
         optObj.accept = eclObjWuid | eclObjArchive | eclObjSharedObject;
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
             const char *arg = iter.query();
             if (iter.matchOption(optName, ECLOPT_NAME)||iter.matchOption(optName, ECLOPT_NAME_S))
                 continue;
-            if (EclCmdWithEclTarget::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdWithEclTarget::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
+
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -302,10 +304,10 @@ public:
         optTimeLimit = (unsigned) -1;
         optWarnTimeLimit = (unsigned) -1;
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -359,10 +361,11 @@ public:
                 continue;
             if (iter.matchFlag(optDontAppendCluster, ECLOPT_DONT_APPEND_CLUSTER))
                 continue;
-            if (EclCmdWithEclTarget::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdWithEclTarget::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -551,10 +554,10 @@ public:
     {
         optObj.accept = eclObjWuid | eclObjArchive | eclObjSharedObject | eclObjWuid | eclObjQuery;
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -576,10 +579,11 @@ public:
                 continue;
             if (iter.matchOption(optExceptionSeverity, ECLOPT_EXCEPTION_LEVEL))
                 continue;
-            if (EclCmdWithEclTarget::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdWithEclTarget::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -1109,11 +1113,11 @@ public:
     {
         optObj.accept = eclObjWuid;
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
-        bool retVal = false;
+        eclCmdOptionMatchIndicator retVal = EclCmdOptionNoMatch;
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -1121,17 +1125,18 @@ public:
             if (iter.matchOption(optName, ECLOPT_WUID)||iter.matchOption(optName, ECLOPT_WUID_S))
             {
                 optObj.type = eclObjWuid;
-                retVal = true;
+                retVal = EclCmdOptionMatch;
                 continue;
             }
             if (iter.matchOption(optName, ECLOPT_NAME)||iter.matchOption(optName, ECLOPT_NAME_S))
             {
                 optObj.type = eclObjQuery;
-                retVal = true;
+                retVal = EclCmdOptionMatch;
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true) != EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
         return retVal;
     }
@@ -1238,11 +1243,11 @@ public:
     {
         optObj.accept = eclObjWuid;
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
-        bool retVal = false;
+        eclCmdOptionMatchIndicator retVal = EclCmdOptionNoMatch;
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -1250,15 +1255,16 @@ public:
             if (iter.matchOption(optName, ECLOPT_WUID)||iter.matchOption(optName, ECLOPT_WUID_S))
             {
                 optObj.type = eclObjWuid;
-                retVal = true;
+                retVal = EclCmdOptionMatch;
                 continue;
             }
             if (iter.matchOption(optListLimit, ECLOPT_RESULT_LIMIT))
             {
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true) != EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
         return retVal;
     }
@@ -1321,26 +1327,27 @@ public:
     {
 
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
-        bool retVal = false;
+        eclCmdOptionMatchIndicator retVal = EclCmdOptionNoMatch;
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
             const char *arg = iter.query();
             if (iter.matchOption(optName, ECLOPT_NAME)||iter.matchOption(optName, ECLOPT_NAME_S))
             {
-                retVal = true;
+                retVal = EclCmdOptionMatch;
                 continue;
             }
             if (iter.matchOption(optListLimit, ECLOPT_RESULT_LIMIT))
             {
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true) != EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
         return retVal;
     }
@@ -1404,11 +1411,11 @@ public:
     {
         optObj.accept = eclObjWuid;
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
-        bool retVal = false;
+        eclCmdOptionMatchIndicator retVal = EclCmdOptionNoMatch;
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -1416,21 +1423,22 @@ public:
             if (iter.matchOption(optName, ECLOPT_WUID)||iter.matchOption(optName, ECLOPT_WUID_S))
             {
                 optObj.type = eclObjWuid;
-                retVal = true;
+                retVal = EclCmdOptionMatch;
                 continue;
             }
             if (iter.matchOption(optName, ECLOPT_NAME)||iter.matchOption(optName, ECLOPT_NAME_S))
             {
                 optObj.type = eclObjQuery;
-                retVal = true;
+                retVal = EclCmdOptionMatch;
                 continue;
             }
             if (iter.matchOption(optListLimit, ECLOPT_RESULT_LIMIT))
             {
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true) != EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
         return retVal;
     }

+ 4 - 2
ecl/eclcmd/eclcmd_shell.cpp

@@ -96,9 +96,11 @@ int EclCMDShell::processCMD(ArgvIterator &iter)
         c->usage();
         return 0;
     }
-    if (!c->parseCommandLineOptions(iter))
+    switch (c->parseCommandLineOptions(iter))
     {
-        c->usage();
+    case EclCmdOptionNoMatch:
+        c->usage(); //fall through
+    case EclCmdOptionCompletion:
         return 0;
     }
     if (!c->finalizeOptions(globals))

+ 35 - 30
ecl/eclcmd/queries/ecl-queries.cpp

@@ -92,10 +92,10 @@ public:
     EclCmdQueriesList() : flags(0), optInactive(false), optCheckAllNodes(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -134,15 +134,16 @@ public:
                         break;
                     default:
                         fprintf(stderr, "Unrecognized --show flag = %c\n", *ch);
-                        return false;
+                        return EclCmdOptionNoMatch;
                     }
                 }
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -309,10 +310,10 @@ public:
     EclCmdQueryFiles()
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -326,14 +327,15 @@ public:
                 else
                 {
                     fprintf(stderr, "\n%s option not recognized\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -410,10 +412,10 @@ public:
         optTimeLimit = (unsigned) -1;
         optWarnTimeLimit = (unsigned) -1;
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -427,7 +429,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -475,10 +477,11 @@ public:
                 continue;
             if (iter.matchOption(optName, ECLOPT_NAME)||iter.matchOption(optName, ECLOPT_NAME_S))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -615,10 +618,10 @@ public:
         optUpdateSuperfiles(false), optUpdateCloneFrom(false), optDontAppendCluster(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -632,7 +635,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -656,10 +659,11 @@ public:
                 continue;
             if (iter.matchFlag(optDontAppendCluster, ECLOPT_DONT_APPEND_CLUSTER))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -768,10 +772,10 @@ public:
         optTimeLimit = (unsigned) -1;
         optWarnTimeLimit = (unsigned) -1;
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         if (iter.done())
-            return false;
+            return EclCmdOptionNoMatch;
 
         for (; !iter.done(); iter.next())
         {
@@ -785,7 +789,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -803,10 +807,11 @@ public:
                 continue;
             if (iter.matchOption(optComment, ECLOPT_COMMENT))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {

+ 18 - 15
ecl/eclcmd/roxie/ecl-roxie.cpp

@@ -148,7 +148,7 @@ public:
     EclCmdRoxieAttach(bool _attach) : optMsToWait(10000), attach(_attach)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         for (; !iter.done(); iter.next())
         {
@@ -160,16 +160,17 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
             if (iter.matchOption(optMsToWait, ECLOPT_WAIT))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -253,7 +254,7 @@ public:
     EclCmdRoxieCheckOrReload(bool _reload) : optMsToWait(10000), reload(_reload), optRetry(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         for (; !iter.done(); iter.next())
         {
@@ -265,7 +266,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -273,10 +274,11 @@ public:
                 continue;
             if (reload && iter.matchFlag(optRetry, ECLOPT_RETRY))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {
@@ -372,7 +374,7 @@ public:
     EclCmdRoxieUnusedFiles() : optCheckPackageMaps(false), optDeleteFiles(false), optDeleteSubFiles(false), optDeleteRecursive(false)
     {
     }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
+    virtual eclCmdOptionMatchIndicator parseCommandLineOptions(ArgvIterator &iter)
     {
         for (; !iter.done(); iter.next())
         {
@@ -384,7 +386,7 @@ public:
                 else
                 {
                     fprintf(stderr, "\nunrecognized argument %s\n", arg);
-                    return false;
+                    return EclCmdOptionNoMatch;
                 }
                 continue;
             }
@@ -396,10 +398,11 @@ public:
                 continue;
             if (iter.matchFlag(optDeleteFiles, ECLOPT_DELETE_FILES))
                 continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
+            eclCmdOptionMatchIndicator ind = EclCmdCommon::matchCommandLineOption(iter, true);
+            if (ind != EclCmdOptionMatch)
+                return ind;
         }
-        return true;
+        return EclCmdOptionMatch;
     }
     virtual bool finalizeOptions(IProperties *globals)
     {