diff --git a/src/CLI.cpp b/src/CLI.cpp index f81f91ea..6a536c74 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -260,6 +260,16 @@ bool CLI::canonicalize ( return false; } +//////////////////////////////////////////////////////////////////////////////// +std::string CLI::getCommand () const +{ + for (const auto& a : _args) + if (a.hasTag ("CMD")) + return a.attribute ("canonical"); + + return ""; +} + //////////////////////////////////////////////////////////////////////////////// const std::string CLI::dump (const std::string& title) const { diff --git a/src/CLI.h b/src/CLI.h index 80cfed57..bff6a89a 100644 --- a/src/CLI.h +++ b/src/CLI.h @@ -60,6 +60,7 @@ public: void add (const std::string&); void analyze (); bool canonicalize (std::string&, const std::string&, const std::string&) const; + std::string getCommand () const; const std::string dump (const std::string& title = "CLI Parser") const; private: