Commit 52e2a3db75983ab34bd938fd402fdac3623d7ac6
1 parent
b935fcd1
Fixed error, but still have positional problem
Showing
1 changed file
with
4 additions
and
5 deletions
CLI.hpp
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | namespace { | 17 | namespace { |
| 18 | 18 | ||
| 19 | void logit(std::string output) { | 19 | void logit(std::string output) { |
| 20 | - //std::cout << "std::cout << "\033[1;31m" << output << "\033[0m" << std::endl;33[1;31m" << output << "std::cout << "\033[1;31m" << output << "\033[0m" << std::endl;33[0m" << std::endl; | 20 | + std::cout << "std::cout << "\033[1;31m" << output << "\033[0m" << std::endl;33[1;31m" << output << "std::cout << "\033[1;31m" << output << "\033[0m" << std::endl;33[0m" << std::endl; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | template <typename T> | 23 | template <typename T> |
| @@ -478,20 +478,19 @@ public: | @@ -478,20 +478,19 @@ public: | ||
| 478 | /// Parses the command line - throws errors | 478 | /// Parses the command line - throws errors |
| 479 | void parse(int argc, char **argv) { | 479 | void parse(int argc, char **argv) { |
| 480 | std::vector<std::string> args; | 480 | std::vector<std::string> args; |
| 481 | - for(int i=1; i<argc; i++) | ||
| 482 | - args.emplace_back(argv[i]); | 481 | + for(int i=argc-1; i>0; i--) |
| 482 | + args.push_back(argv[i]); | ||
| 483 | parse(args); | 483 | parse(args); |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | void parse(std::vector<std::string> args) { | 486 | void parse(std::vector<std::string> args) { |
| 487 | parsed = true; | 487 | parsed = true; |
| 488 | - std::reverse(args.begin(), args.end()); | ||
| 489 | 488 | ||
| 490 | bool positional_only = false; | 489 | bool positional_only = false; |
| 491 | 490 | ||
| 492 | while(args.size()>0) { | 491 | while(args.size()>0) { |
| 493 | 492 | ||
| 494 | - logit(join(args)); | 493 | + logit("Parse: ["+join(args)+"]"); |
| 495 | 494 | ||
| 496 | Classifer classifer = positional_only ? Classifer::NONE : _recognize(args.back()); | 495 | Classifer classifer = positional_only ? Classifer::NONE : _recognize(args.back()); |
| 497 | switch(classifer) { | 496 | switch(classifer) { |