-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.svjatoslav</groupId>
<artifactId>svjatoslavcommons</artifactId>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh</artifactId>
- <version>2.4</version>
+ <artifactId>wagon-ssh-external</artifactId>
+ <version>2.6</version>
</extension>
</extensions>
</build>
<snapshotRepository>
<id>svjatoslav.eu</id>
<name>svjatoslav.eu</name>
- <url>scp://svjatoslav.eu/var/www/svjatoslav.eu/maven</url>
+ <url>scpexe://svjatoslav.eu/var/www/svjatoslav.eu/maven</url>
</snapshotRepository>
<repository>
<id>svjatoslav.eu</id>
<name>svjatoslav.eu</name>
- <url>scp://svjatoslav.eu/var/www/svjatoslav.eu/maven</url>
+ <url>scpexe://svjatoslav.eu/var/www/svjatoslav.eu/maven</url>
</repository>
</distributionManagement>
import java.util.ArrayList;
-import eu.svjatoslav.commons.commandline.parameterparser.parameter.DirectoryParameter;
-import eu.svjatoslav.commons.commandline.parameterparser.parameter.FileParameter;
-import eu.svjatoslav.commons.commandline.parameterparser.parameter.IntegerParameter;
-import eu.svjatoslav.commons.commandline.parameterparser.parameter.NullParameter;
-import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameter;
-import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameters;
-
/**
* <pre>
* Single commandline parameter can have any amount of arguments.
private final ArrayList<Parameter> parameters = new ArrayList<Parameter>();
- public void addParameter(final Parameter parameter) {
- parameters.add(parameter);
- }
-
- public DirectoryParameter createDirectoryParameter(final String description) {
- final DirectoryParameter parameter = new DirectoryParameter(description);
- parameters.add(parameter);
- return parameter;
- }
-
- public FileParameter createFileParameter(final String description) {
- final FileParameter parameter = new FileParameter(description);
- parameters.add(parameter);
- return parameter;
- }
-
- public IntegerParameter createIntegerParameter(final String description) {
- final IntegerParameter parameter = new IntegerParameter(description);
- parameters.add(parameter);
- return parameter;
- }
-
- public NullParameter createNullParameter(final String description) {
- final NullParameter parameter = new NullParameter(description);
+ public <E extends Parameter> E add(final E parameter) {
parameters.add(parameter);
return parameter;
}
- public StringParameter createStringParameter(final String description) {
- final StringParameter parameter = new StringParameter(description);
- parameters.add(parameter);
- return parameter;
- }
-
- public StringParameters createStringParameters(final String description) {
- final StringParameters stingParameters = new StringParameters(
- description);
- parameters.add(stingParameters);
- return stingParameters;
- }
-
/**
* Return parameter by given alias or <code>null</code> if no parameter
* exists for given alias.
*/
- public Parameter getParameterByAlias(final String alias) {
+ public Parameter findParameterByAlias(final String alias) {
for (final Parameter parameter : parameters)
if (parameter.matchesAlias(alias))
for (final String argument : args) {
- final Parameter parameterForAlias = getParameterByAlias(argument);
+ final Parameter parameterForAlias = findParameterByAlias(argument);
if (parameterForAlias == null) {
if (currentParameter == null) {
System.out.println("Unknown commandline parameter: "
// define allowed parameters
final StringParameter helpParameter = parser
- .createStringParameter("Show help screen")
+ .add(new StringParameter("Show help screen"))
.addAliases("--help", "-h").setMandatory();
- final StringParameter compileParameter = parser.createStringParameter(
- "Compile code").addAliases("--compile", "-c");
+ final StringParameter compileParameter = parser.add(
+ new StringParameter("Compile code")).addAliases("--compile",
+ "-c");
// check help generation
parser.showHelp();