Permalink
Browse files
#21 Move method to gather tags to CLI
- Loading branch information...
Showing
with
18 additions
and
6 deletions.
-
+14
−0
src/CLI.cpp
-
+1
−0
src/CLI.h
-
+3
−6
src/commands/CmdTag.cpp
|
@@ -539,3 +539,17 @@ std::set<int> CLI::getIds() const |
|
|
|
} |
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
|
std::vector<std::string> CLI::getTags () const |
|
|
|
{ |
|
|
|
std::vector <std::string> tags; |
|
|
|
|
|
|
|
for (auto& arg : _args) |
|
|
|
{ |
|
|
|
if (arg.hasTag ("TAG")) |
|
|
|
tags.push_back (arg.attribute ("raw")); |
|
|
|
} |
|
|
|
|
|
|
|
return tags; |
|
|
|
} |
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
@@ -66,6 +66,7 @@ class CLI |
|
|
|
std::string getBinary () const; |
|
|
|
std::string getCommand () const; |
|
|
|
std::set <int> getIds () const; |
|
|
|
std::vector<std::string> getTags () const; |
|
|
|
std::string dump (const std::string& title = "CLI Parser") const; |
|
|
|
|
|
|
|
private: |
|
|
|
@@ -41,15 +41,12 @@ int CmdTag ( |
|
|
|
std::set <int> ids = cli.getIds (); |
|
|
|
|
|
|
|
if (ids.empty ()) |
|
|
|
throw std::string ("IDs must be specified. See 'timew help tag'."); |
|
|
|
|
|
|
|
std::vector <std::string> tags; |
|
|
|
for (auto& arg : cli._args) |
|
|
|
{ |
|
|
|
if (arg.hasTag ("TAG")) |
|
|
|
tags.push_back (arg.attribute ("raw")); |
|
|
|
throw std::string ("IDs must be specified. See 'timew help tag'."); |
|
|
|
} |
|
|
|
|
|
|
|
std::vector<std::string> tags = cli.getTags (); |
|
|
|
|
|
|
|
// Load the data. |
|
|
|
// Note: There is no filter. |
|
|
|
Interval filter; |
|
|
0 comments on commit
db13bd4