Add Possibility to set MultiValue Parameters.
[command.git] / include / argument.h
index dfaea65cea9b4ba6d5d54dd39c000ee79b8ad19e..a32cf82064893f9f78677aea1a9e3c4bb3d4a3f7 100644 (file)
@@ -14,9 +14,9 @@ namespace command {
      * Arguments are non-named parameters of program.
      *
      * Example:
-     *  ./myprog ARGUMENT
-     *  ./myprog /path/to/file
-     *  ./myprog "some argument"
+     *  ./myprog ARGUMENT
+     *  ./myprog /path/to/file
+     *  ./myprog "some argument"
      */
     template<typename ParameterType>
     class Argument : public Parameter, public Callable<ParameterType> {
@@ -41,10 +41,11 @@ namespace command {
         virtual ~Argument() { }
 
         /**
-         *
+         * \inheritdoc
          */
         virtual void handle() {
             this->call(value);
+            this->used = true;
         }
 
         /**
@@ -64,16 +65,13 @@ namespace command {
          *  against next value.
          */
         virtual bool understand(const std::string & argv) {
-            if (!isUsed()) {
-                std::stringstream ss;
+            std::stringstream ss;
 
-                ss << argv;
-                ss >> value;
+            ss << argv;
+            ss >> value;
 
-                if (!ss.fail()) {
-                    this->used = true;
-                    return true;
-                }
+            if (!ss.fail()) {
+                return true;
             }
 
             return false;