From af9b74ff48dfe5eacd3d38a7c6317890691ac1a0 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 28 Aug 2017 18:27:38 +0100 Subject: [PATCH] cmdline.h: don't complain about unrecognised short options in the 'rest' --- renderdoccmd/3rdparty/cmdline/cmdline.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/renderdoccmd/3rdparty/cmdline/cmdline.h b/renderdoccmd/3rdparty/cmdline/cmdline.h index be35c6042..a555f5c35 100644 --- a/renderdoccmd/3rdparty/cmdline/cmdline.h +++ b/renderdoccmd/3rdparty/cmdline/cmdline.h @@ -443,7 +443,13 @@ public: else{ std::string name(argv[i]+2); if (options.count(name)==0){ - errors.push_back("undefined option: --"+name); + if (stop){ + found_others=true; + others.push_back(argv[i]); + } + else{ + errors.push_back("undefined option: --"+name); + } continue; } if (options[name]->has_value()){ @@ -467,7 +473,13 @@ public: for (int j=2; argv[i][j]; j++){ last=argv[i][j]; if (lookup.count(argv[i][j-1])==0){ - errors.push_back(std::string("undefined short option: -")+argv[i][j-1]); + if (stop){ + found_others=true; + others.push_back(argv[i]); + } + else{ + errors.push_back(std::string("undefined short option: -")+argv[i][j-1]); + } continue; } if (lookup[argv[i][j-1]]==""){ @@ -478,7 +490,13 @@ public: } if (lookup.count(last)==0){ - errors.push_back(std::string("undefined short option: -")+last); + if (stop){ + found_others=true; + others.push_back(argv[i]); + } + else{ + errors.push_back(std::string("undefined short option: -")+last); + } continue; } if (lookup[last]==""){