X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fmeviz%2Ftexttruncate%2FCommandlineHandler.java;h=303c607543b9ca15f9b451e0d128e2ff4403f669;hb=6cda75011fa4346a3cc2c7c7790eb1f1b12cd3fe;hp=005a828994fb35f769226f8917b42081eb73f63d;hpb=c921086faa9d28c7e5c8d3d7a382a2c00901fb18;p=meviz.git diff --git a/src/main/java/eu/svjatoslav/meviz/texttruncate/CommandlineHandler.java b/src/main/java/eu/svjatoslav/meviz/texttruncate/CommandlineHandler.java index 005a828..303c607 100755 --- a/src/main/java/eu/svjatoslav/meviz/texttruncate/CommandlineHandler.java +++ b/src/main/java/eu/svjatoslav/meviz/texttruncate/CommandlineHandler.java @@ -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,21 +14,23 @@ 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 { Parser parser = new Parser(); - NullParameter recursiveParameter = parser.createNullParameter( - "Enable recursive mode.").addAliases("-r", "--recursive"); + NullParameter recursiveParameter = parser.add( + new NullParameter("Enable recursive mode.")).addAliases("-r", + "--recursive"); - StringParameter inputPatternParameter = parser.createStringParameter( - "File input pattern.").addAliases("-i", "--input-pattern"); + StringParameters inputPatternParameter = parser.add( + new StringParameters("File input pattern.")).addAliases("-i", + "--input-pattern"); - DirectoryParameter workingDirectoryParameter = parser - .createDirectoryParameter("Working directory.").addAliases("-w", - "--working-directory"); + DirectoryParameter workingDirectoryParameter = parser.add( + new DirectoryParameter("Working directory.")).addAliases("-w", + "--working-directory"); public TextTruncatingOptions parseCommandlineArguments(final String[] args) { @@ -41,14 +43,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; }