diff --git a/src/occa/internal/utils/cli.cpp b/src/occa/internal/utils/cli.cpp index dd332ba67..83e52b339 100644 --- a/src/occa/internal/utils/cli.cpp +++ b/src/occa/internal/utils/cli.cpp @@ -405,6 +405,7 @@ namespace occa { } occa::json parser::parseArgs(const strVector &args_, + const std::vector *commands, const bool supressErrors) { strVector args = splitShortOptionArgs(args_); const int argc = (int) args.size(); @@ -445,7 +446,14 @@ namespace occa { // No option if (!opt) { - checkOptions = (arg == "=="); + if (commands != nullptr) { + for (auto cmd : *commands) { + if (arg == cmd.name) { + checkOptions = 0; + break; + } + } + } jArguments += arg; continue; } @@ -779,7 +787,7 @@ namespace occa { const bool hasCommands = commands.size(); - json parsedArgs = parseArgs(shellArgs, supressErrors); + json parsedArgs = parseArgs(shellArgs, commands, supressErrors); lastCommandArgs = parsedArgs; json &jArguments = parsedArgs["arguments"]; diff --git a/src/occa/internal/utils/cli.hpp b/src/occa/internal/utils/cli.hpp index 0ead626ad..e9c15edca 100644 --- a/src/occa/internal/utils/cli.hpp +++ b/src/occa/internal/utils/cli.hpp @@ -120,6 +120,8 @@ namespace occa { }; //================================== + class command; + //---[ Parser ]--------------------- class parser : public printable { public: @@ -157,6 +159,7 @@ namespace occa { occa::json parseArgs(const int argc, const char **argv); occa::json parseArgs(const strVector &args_, + const std::vector *commands = nullptr, const bool supressErrors = false); bool hasCustomHelpOption();