java.lang.Object
org.refcodes.cli.CliSugar
public class CliSugar extends Object
-
Constructor Summary
Constructors Constructor Description CliSugar() -
Method Summary
Modifier and Type Method Description static Conditionand(Syntaxable... aArgs)static <T> ArrayOperand<T>asArray(Operand<T> aOperand)Creates an array representation facade for the encapsulatedOperand.static <T> ArrayOperand<T>asArray(Operand<T> aOperand, int aLength)Creates an array representation facade for the encapsulatedOperand.static <T> ArrayOperand<T>asArray(Operand<T> aOperand, int aMinLength, int aMaxLength)Creates an array representation facade for the encapsulatedOperand.static <T> ArrayOption<T>asArray(Option<T> aOption)Creates an array representation facade for the encapsulatedOption.static <T> ArrayOption<T>asArray(Option<T> aOption, int aLength)Creates an array representation facade for the encapsulatedOption.static <T> ArrayOption<T>asArray(Option<T> aOption, int aMinLength, int aMaxLength)Creates an array representation facade for the encapsulatedOption.static CharOptioncharOption(String aLongOption, String aAlias, String aDescription)Character option.static CharOptioncharOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Character option.static FlagdebugFlag()Debug flag.static DoubleOptiondoubleOption(String aLongOption, String aAlias, String aDescription)Double option.static DoubleOptiondoubleOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Double option.static <T extends Enum<T>>
EnumOption<T>enumOption(String aLongOption, Class<T> aType, String aAlias, String aDescription)Instantiates a new enum option.static <T extends Enum<T>>
EnumOption<T>enumOption(String aShortOption, String aLongOption, Class<T> aType, String aAlias, String aDescription)Instantiates a new enum option.static FileOptionfileOption(String aLongOption, String aAlias, String aDescription)Creates aFileOptionfor getting aFileinstance from a path.static FileOptionfileOption(String aShortOption, String aLongOption, String aAlias, String aDescription)String option.static Flagflag(String aLongOption, String aAlias, String aDescription)As "switch" is a reserved word in Java, we use "flag" :-(.static Flagflag(String aShortOption, String aLongOption, String aAlias, String aDescription)As "switch" is a reserved word in Java, we use "flag" :-(.static FloatOptionfloatOption(String aLongOption, String aAlias, String aDescription)Float option.static FloatOptionfloatOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Float option.static FlagforcesFlag()Forces flag.static FlagforcesFlag(String aDescription)Forces flag.static FlaghelpFlag()Help flag.static FlaghelpFlag(String aDescription)Help flag.static IntOptionintOption(String aLongOption, String aAlias, String aDescription)Int option.static IntOptionintOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Int option.static LongOptionlongOption(String aLongOption, String aAlias, String aDescription)Long option.static LongOptionlongOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Long option.static Operationoperation(String aOperation, String aDescription)Constructs aOperationwith the given arguments.static Operationoperation(String aOperation, String aAlias, String aDescription)Constructs aOperationwith the given arguments.static Conditionoptional(Syntaxable... aArgs)static Conditionor(Syntaxable... aArgs)static FlagquietFlag()Quiet flag.static FlagquietFlag(String aDescription)Quiet flag.static StringOperandstringOperand(String aIdentifier, String aDescription)String operand.static StringOptionstringOption(String aLongOption, String aAlias, String aDescription)String option.static StringOptionstringOption(String aShortOption, String aLongOption, String aAlias, String aDescription)String option.static FlagsysInfoFlag()Sys info flag.static FlagsysInfoFlag(String aDescription)Sys info flag.static FlagverboseDebug(String aDescription)Debug flag.static FlagverboseFlag()Verbose flag.static FlagverboseFlag(String aDescription)Verbose flag.static Conditionxor(Syntaxable... aArgs)
-
Constructor Details
-
CliSugar
public CliSugar()
-
-
Method Details
-
operation
Constructs aOperationwith the given arguments.- Parameters:
aOperation- The operation to declare.aDescription- A description without any line breaks.- Returns:
- The accordingly created
Operation.
-
operation
Constructs aOperationwith the given arguments.- Parameters:
aOperation- The operation to declare.aAlias- The operation's name to be used when constructing the syntax.aDescription- A description without any line breaks.- Returns:
- The accordingly created
Operation.
-
and
- Parameters:
aArgs- TheSyntaxable(Condition) instances to be nested.- Returns:
- The according AND condition.
- See Also:
AndCondition
-
or
- Parameters:
aArgs- TheSyntaxable(Condition) instances to be nested.- Returns:
- The according OR condition.
- See Also:
OrCondition
-
xor
- Parameters:
aArgs- TheSyntaxable(Condition) instances to be nested.- Returns:
- The according XOR condition.
- See Also:
XorCondition
-
optional
- Parameters:
aArgs- TheSyntaxable(Condition) instances to be nested- Returns:
- the condition
- See Also:
OptionalCondition
-
enumOption
public static <T extends Enum<T>> EnumOption<T> enumOption(String aShortOption, String aLongOption, Class<T> aType, String aAlias, String aDescription)Instantiates a new enum option.- Type Parameters:
T- the generic type- Parameters:
aShortOption- the short optionaLongOption- the long optionaType- the typeaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
EnumOption
-
enumOption
public static <T extends Enum<T>> EnumOption<T> enumOption(String aLongOption, Class<T> aType, String aAlias, String aDescription)Instantiates a new enum option.- Type Parameters:
T- the generic type- Parameters:
aLongOption- the long optionaType- the typeaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
EnumOption
-
flag
As "switch" is a reserved word in Java, we use "flag" :-(.- Parameters:
aLongOption- the long optionaAlias- The alias of the flagaDescription- the description- Returns:
- the flag
- See Also:
Flag
-
flag
public static Flag flag(String aShortOption, String aLongOption, String aAlias, String aDescription)As "switch" is a reserved word in Java, we use "flag" :-(.- Parameters:
aShortOption- the short optionaLongOption- the long optionaAlias- The alias of the flagaDescription- the description- Returns:
- the flag
- See Also:
Flag
-
forcesFlag
Forces flag.- Parameters:
aDescription- the description- Returns:
- the flag
- See Also:
ForceFlag
-
forcesFlag
Forces flag.- Returns:
- the flag
- See Also:
ForceFlag
-
helpFlag
Help flag.- Parameters:
aDescription- the description- Returns:
- the flag
- See Also:
HelpFlag
-
helpFlag
Help flag.- Returns:
- the flag
- See Also:
HelpFlag
-
sysInfoFlag
Sys info flag.- Parameters:
aDescription- the description- Returns:
- the flag
- See Also:
SysInfoFlag
-
sysInfoFlag
Sys info flag.- Returns:
- the flag
- See Also:
SysInfoFlag
-
quietFlag
Quiet flag.- Parameters:
aDescription- the description- Returns:
- the flag
- See Also:
QuietFlag
-
quietFlag
Quiet flag.- Returns:
- the flag
- See Also:
QuietFlag
-
verboseFlag
Verbose flag.- Parameters:
aDescription- the description- Returns:
- the flag
- See Also:
VerboseFlag
-
verboseFlag
Verbose flag.- Returns:
- the flag
- See Also:
VerboseFlag
-
verboseDebug
Debug flag.- Parameters:
aDescription- the description- Returns:
- the flag
- See Also:
DebugFlag
-
debugFlag
Debug flag.- Returns:
- the flag
- See Also:
VerboseFlag
-
intOption
Int option.- Parameters:
aLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
IntOption
-
intOption
public static IntOption intOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Int option.- Parameters:
aShortOption- the short optionaLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
IntOption
-
longOption
Long option.- Parameters:
aLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
LongOption
-
longOption
public static LongOption longOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Long option.- Parameters:
aShortOption- the short optionaLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
LongOption
-
floatOption
Float option.- Parameters:
aLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
LongOption
-
floatOption
public static FloatOption floatOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Float option.- Parameters:
aShortOption- the short optionaLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
LongOption
-
doubleOption
Double option.- Parameters:
aLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
LongOption
-
doubleOption
public static DoubleOption doubleOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Double option.- Parameters:
aShortOption- the short optionaLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
LongOption
-
stringOption
String option.- Parameters:
aLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
StringOption
-
stringOption
public static StringOption stringOption(String aShortOption, String aLongOption, String aAlias, String aDescription)String option.- Parameters:
aShortOption- the short optionaLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
StringOption
-
charOption
Character option.- Parameters:
aLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
StringOption
-
charOption
public static CharOption charOption(String aShortOption, String aLongOption, String aAlias, String aDescription)Character option.- Parameters:
aShortOption- the short optionaLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
StringOption
-
fileOption
Creates aFileOptionfor getting aFileinstance from a path.- Parameters:
aLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
FileOption
-
fileOption
public static FileOption fileOption(String aShortOption, String aLongOption, String aAlias, String aDescription)String option.- Parameters:
aShortOption- the short optionaLongOption- the long optionaAlias- the option arg nameaDescription- the description- Returns:
- the option
- See Also:
FileOption
-
stringOperand
String operand.- Parameters:
aIdentifier- the identifieraDescription- the description- Returns:
- the operand
- See Also:
StringOperand
-
asArray
Creates an array representation facade for the encapsulatedOption. This way anyOptioncan also be used as an arrayOption, e.g. it can be provided multiple times in the command line arguments.- Type Parameters:
T- The type of theOptionfor which to create anArrayOption.- Parameters:
aOption- TheOptionwhich's array counterpart is to be defined.- Returns:
- The according
ArrayOption.
-
asArray
Creates an array representation facade for the encapsulatedOption. This way anyOptioncan also be used as an arrayOption, e.g. it can by provided multiple times in the command line arguments.- Type Parameters:
T- The type of theOptionfor which to create anArrayOption.- Parameters:
aOption- TheOptionwhich's array counterpart is to be defined.aLength- The number of array elements, or -1 if there is no limit.- Returns:
- The according
ArrayOption.
-
asArray
Creates an array representation facade for the encapsulatedOption. This way anyOptioncan also be used as an arrayOption, e.g. it can by provided multiple times in the command line arguments.- Type Parameters:
T- The type of theOptionfor which to create anArrayOption.- Parameters:
aOption- TheOptionwhich's array counterpart is to be defined.aMinLength- The minimum number of array elements, or -1 if there is no limit.aMaxLength- The maximum number of array elements, or -1 if there is no limit.- Returns:
- The according
ArrayOption.
-
asArray
Creates an array representation facade for the encapsulatedOperand. This way anyOperandcan also be used as an arrayOperand, e.g. it can be provided multiple times in the command line arguments.- Type Parameters:
T- The type of theOperandfor which to create anArrayOperand.- Parameters:
aOperand- TheOperandwhich's array counterpart is to be defined.- Returns:
- The according
ArrayOperand.
-
asArray
Creates an array representation facade for the encapsulatedOperand. This way anyOperandcan also be used as an arrayOperand, e.g. it can by provided multiple times in the command line arguments.- Type Parameters:
T- The type of theOperandfor which to create anArrayOperand.- Parameters:
aOperand- TheOperandwhich's array counterpart is to be defined.aLength- The number of array elements, or -1 if there is no limit.- Returns:
- The according
ArrayOperand.
-
asArray
Creates an array representation facade for the encapsulatedOperand. This way anyOperandcan also be used as an arrayOperand, e.g. it can by provided multiple times in the command line arguments.- Type Parameters:
T- The type of theOperandfor which to create anArrayOperand.- Parameters:
aOperand- TheOperandwhich's array counterpart is to be defined.aMinLength- The minimum number of array elements, or -1 if there is no limit.aMaxLength- The maximum number of array elements, or -1 if there is no limit.- Returns:
- The according
ArrayOperand.
-