diff --git a/src/main/java/net/knarcraft/ffmpegconverter/parser/ConverterArgument.java b/src/main/java/net/knarcraft/ffmpegconverter/parser/ConverterArgument.java index 81d2c70..b1be41d 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/parser/ConverterArgument.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/parser/ConverterArgument.java @@ -1,20 +1,60 @@ package net.knarcraft.ffmpegconverter.parser; /** - * A class representing an argument + * A class representing a command argument */ public class ConverterArgument { + private final String name; + private final char shorthand; private final boolean valueRequired; private final ConverterArgumentValue valueType; - public ConverterArgument(String name, boolean valueRequired, ConverterArgumentValue valueType) { + /** + * Instantiates a converter argument + * @param name
The name of the argument which users has to type.
+ * @param shorthandA single character value for using the command.
+ * @param valueRequiredWhether the argument must be followed by a valid value.
+ * @param valueTypeThe type of value the argument requires.
+ */ + public ConverterArgument(String name, char shorthand, boolean valueRequired, ConverterArgumentValue valueType) { this.name = name; + this.shorthand = shorthand; this.valueRequired = valueRequired; this.valueType = valueType; } - private boolean testArgumentValue(String value) { + /** + * Gets the argument name + * @returnThe argument name.
+ */ + public String getName() { + return name; + } + + /** + * Gets the argument shorthand + * @returnThe argument shorthand
+ */ + public char getShorthand() { + return shorthand; + } + + /** + * Gets whether the argument requires a value + * @returnWhether the argument requires a value.
+ */ + public boolean isValueRequired() { + return valueRequired; + } + + /** + * Tests whether the given value is valid for this converter argument + * + * @param valueThe value to test.
+ * @returnTrue if the argument is valid. False otherwise.
+ */ + public boolean testArgumentValue(String value) { if (value.length() == 0) { return !valueRequired; } @@ -26,9 +66,9 @@ public class ConverterArgument { String lower = value.toLowerCase(); return lower.equals("true") || lower.equals("false"); case COMMA_SEPARATED_LIST: - return !value.contains(" "); - case SINGLE_VALUE: - return !value.contains(" "); + return true; + case STRING: + return true; case INT: int ignored = Integer.parseInt(value); return true;