added possibility to use multiple patterns from command-line
[meviz.git] / src / main / java / eu / svjatoslav / meviz / texttruncate / CommandlineHandler.java
index 005a828..cad7c22 100755 (executable)
@@ -1,7 +1,7 @@
 /*
  * Meviz - Various tools collection to work with multimedia.
  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU General Public License
  * as published by the Free Software Foundation.
@@ -14,7 +14,7 @@ import java.io.File;
 import eu.svjatoslav.commons.commandline.parameterparser.Parser;
 import eu.svjatoslav.commons.commandline.parameterparser.parameter.DirectoryParameter;
 import eu.svjatoslav.commons.commandline.parameterparser.parameter.NullParameter;
-import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameter;
+import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameters;
 
 public class CommandlineHandler {
 
@@ -23,7 +23,7 @@ public class CommandlineHandler {
        NullParameter recursiveParameter = parser.createNullParameter(
                        "Enable recursive mode.").addAliases("-r", "--recursive");
 
-       StringParameter inputPatternParameter = parser.createStringParameter(
+       StringParameters inputPatternParameter = parser.createStringParameters(
                        "File input pattern.").addAliases("-i", "--input-pattern");
 
        DirectoryParameter workingDirectoryParameter = parser
@@ -41,14 +41,12 @@ public class CommandlineHandler {
                        options.recursive = true;
 
                if (workingDirectoryParameter.isParameterSpecified())
-                       options.targetDirectory = workingDirectoryParameter
-                                       .getArgumentsAsFiles().get(0);
+                       options.targetDirectory = workingDirectoryParameter.getValue();
                else
                        options.targetDirectory = new File(System.getProperty("user.dir"));
 
                if (inputPatternParameter.isParameterSpecified())
-                       options.inputPatterns.addAll(inputPatternParameter
-                                       .getArgumentsAsStrings());
+                       options.inputPatterns.addAll(inputPatternParameter.getValue());
 
                return options;
        }