- All Superinterfaces:
ArgsParserMixin<ArgsParser>,ArgsSyntaxAccessor,ArgumentEscapeCodeAccessor,ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<ArgsParser>,ArgumentEscapeCodeAccessor.ArgumentEscapeCodeMutator,ArgumentEscapeCodeAccessor.ArgumentEscapeCodeProperty,CliMetrics,org.refcodes.mixin.DescriptionAccessor,org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<ArgsParser>,org.refcodes.mixin.DescriptionAccessor.DescriptionMutator,org.refcodes.mixin.DescriptionAccessor.DescriptionProperty,org.refcodes.mixin.EscapeCodesStatusAccessor,org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<ArgsParser>,org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusMutator,org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusProperty,LongOptionPrefixAccessor,LongOptionPrefixAccessor.LongOptionPrefixBuilder<ArgsParser>,LongOptionPrefixAccessor.LongOptionPrefixMutator,LongOptionPrefixAccessor.LongOptionPrefixProperty,org.refcodes.mixin.NameAccessor,org.refcodes.mixin.NameAccessor.NameBuilder<ArgsParser>,org.refcodes.mixin.NameAccessor.NameMutator,org.refcodes.mixin.NameAccessor.NameProperty,Optionable,OptionEscapeCodeAccessor,OptionEscapeCodeAccessor.OptionEscapeCodeBuilder<ArgsParser>,OptionEscapeCodeAccessor.OptionEscapeCodeMutator,OptionEscapeCodeAccessor.OptionEscapeCodeProperty,org.refcodes.mixin.Resetable,org.refcodes.mixin.ResetEscapeCodeAccessor,org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeBuilder<ArgsParser>,org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeMutator,org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeProperty,ShortOptionPrefixAccessor,ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<ArgsParser>,ShortOptionPrefixAccessor.ShortOptionPrefixMutator,ShortOptionPrefixAccessor.ShortOptionPrefixProperty,SyntaxMetricsAccessor,SyntaxMetricsAccessor.SyntaxMetricsBuilder<ArgsParser>,SyntaxMetricsAccessor.SyntaxMetricsMutator,SyntaxMetricsAccessor.SyntaxMetricsProperty,org.refcodes.textual.TextBoxGridAccessor,org.refcodes.textual.TextBoxGridAccessor.TextBoxGridBuilder<ArgsParser>,org.refcodes.textual.TextBoxGridAccessor.TextBoxGridMutator,org.refcodes.textual.TextBoxGridAccessor.TextBoxGridProperty,org.refcodes.mixin.TitleAccessor,org.refcodes.mixin.TitleAccessor.TitleBuilder<ArgsParser>,org.refcodes.mixin.TitleAccessor.TitleMutator,org.refcodes.mixin.TitleAccessor.TitleProperty
- All Known Implementing Classes:
ArgsParserImpl
public interface ArgsParser
extends Optionable, ArgsParserMixin<ArgsParser>, CliMetrics, org.refcodes.mixin.TitleAccessor.TitleProperty, org.refcodes.mixin.TitleAccessor.TitleBuilder<ArgsParser>, org.refcodes.mixin.NameAccessor.NameProperty, org.refcodes.mixin.NameAccessor.NameBuilder<ArgsParser>, org.refcodes.mixin.DescriptionAccessor.DescriptionProperty, org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<ArgsParser>, org.refcodes.mixin.Resetable, ArgsSyntaxAccessor, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusProperty, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<ArgsParser>, org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeProperty, org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeBuilder<ArgsParser>, OptionEscapeCodeAccessor.OptionEscapeCodeProperty, OptionEscapeCodeAccessor.OptionEscapeCodeBuilder<ArgsParser>, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeProperty, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<ArgsParser>, SyntaxMetricsAccessor.SyntaxMetricsProperty, SyntaxMetricsAccessor.SyntaxMetricsBuilder<ArgsParser>, ShortOptionPrefixAccessor.ShortOptionPrefixProperty, ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<ArgsParser>, LongOptionPrefixAccessor.LongOptionPrefixProperty, LongOptionPrefixAccessor.LongOptionPrefixBuilder<ArgsParser>, org.refcodes.textual.TextBoxGridAccessor.TextBoxGridProperty, org.refcodes.textual.TextBoxGridAccessor.TextBoxGridBuilder<ArgsParser>
The
ArgsParser provides means for parsing command line arguments and
constructing a command line utility's help output.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.cli.ArgsSyntaxAccessor
ArgsSyntaxAccessor.ArgsSyntaxBuilder<B extends ArgsSyntaxAccessor.ArgsSyntaxBuilder<B>>, ArgsSyntaxAccessor.ArgsSyntaxMutator, ArgsSyntaxAccessor.ArgsSyntaxPropertyNested classes/interfaces inherited from interface org.refcodes.cli.ArgumentEscapeCodeAccessor
ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<B extends ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<B>>, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeMutator, ArgumentEscapeCodeAccessor.ArgumentEscapeCodePropertyNested classes/interfaces inherited from interface org.refcodes.mixin.DescriptionAccessor
org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B extends org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B>>, org.refcodes.mixin.DescriptionAccessor.DescriptionMutator, org.refcodes.mixin.DescriptionAccessor.DescriptionPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.EscapeCodesStatusAccessor
org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<B extends org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<B>>, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusMutator, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusPropertyNested classes/interfaces inherited from interface org.refcodes.cli.LongOptionPrefixAccessor
LongOptionPrefixAccessor.LongOptionPrefixBuilder<B extends LongOptionPrefixAccessor.LongOptionPrefixBuilder<B>>, LongOptionPrefixAccessor.LongOptionPrefixMutator, LongOptionPrefixAccessor.LongOptionPrefixPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.NameAccessor
org.refcodes.mixin.NameAccessor.NameBuilder<B extends org.refcodes.mixin.NameAccessor.NameBuilder<B>>, org.refcodes.mixin.NameAccessor.NameMutator, org.refcodes.mixin.NameAccessor.NamePropertyNested classes/interfaces inherited from interface org.refcodes.cli.OptionEscapeCodeAccessor
OptionEscapeCodeAccessor.OptionEscapeCodeBuilder<B extends OptionEscapeCodeAccessor.OptionEscapeCodeBuilder<B>>, OptionEscapeCodeAccessor.OptionEscapeCodeMutator, OptionEscapeCodeAccessor.OptionEscapeCodePropertyNested classes/interfaces inherited from interface org.refcodes.mixin.ResetEscapeCodeAccessor
org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeBuilder<B extends org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeBuilder<B>>, org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeMutator, org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodePropertyNested classes/interfaces inherited from interface org.refcodes.cli.ShortOptionPrefixAccessor
ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<B extends ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<B>>, ShortOptionPrefixAccessor.ShortOptionPrefixMutator, ShortOptionPrefixAccessor.ShortOptionPrefixPropertyNested classes/interfaces inherited from interface org.refcodes.cli.SyntaxMetricsAccessor
SyntaxMetricsAccessor.SyntaxMetricsBuilder<B extends SyntaxMetricsAccessor.SyntaxMetricsBuilder<B>>, SyntaxMetricsAccessor.SyntaxMetricsMutator, SyntaxMetricsAccessor.SyntaxMetricsPropertyNested classes/interfaces inherited from interface org.refcodes.textual.TextBoxGridAccessor
org.refcodes.textual.TextBoxGridAccessor.TextBoxGridBuilder<B extends org.refcodes.textual.TextBoxGridAccessor.TextBoxGridBuilder<?>>, org.refcodes.textual.TextBoxGridAccessor.TextBoxGridMutator, org.refcodes.textual.TextBoxGridAccessor.TextBoxGridPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.TitleAccessor
org.refcodes.mixin.TitleAccessor.TitleBuilder<B extends org.refcodes.mixin.TitleAccessor.TitleBuilder<B>>, org.refcodes.mixin.TitleAccessor.TitleMutator, org.refcodes.mixin.TitleAccessor.TitleProperty -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddExample(String aDescription, Operand<?>... aOperands) Adds a usage example by providing a description of the example and the command line arguments required by the example.voidaddExample(Example aExample) Adds a usage example by providing a description of the example and the command line arguments required by the example.voidPrints the given line to standard error with regards to the console width as specified by thewithConsoleWidth(int)method.Evaluates the provided command line arguments and determines the according values by evaluating the rootCondition.Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedPattern.evalArgs(String[] aArgs, ArgsFilter aArgsFilter) Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedArgsFilter.Same asevalArgs(String[])with the difference that the elements representing the arguments are passed as a list instead of an array.Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedPattern.evalArgs(List<String> aArgs, ArgsFilter aArgsFilter) Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedArgsFilter.The root condition is the starting point node of aConstituenthierarchy to be traversed when determining the syntax for command line arguments or when evaluating the command line arguments.Retrieves the parameter Escape-Code from the parameter Escape-Code property.Retrieves the banner's border Escape-Code from the banner border Escape-Code property.Retrieves the banner's content Escape-Code from the banner Escape-Code property.Retrieves the command name's (CLI executable) Escape-Code from the command name Escape-Code property.Retrieves the copyright.Retrieves the description.Retrieves the parameter's description Escape-Code from the parameter's description Escape-Code property.Retrieves theExampleinstances as added usingaddExample(String, Operand...).Retrieves the license.Retrieves the line separator Escape-Code from the line separator Escape-Code property.Retrieves the option Escape-Code from the option Escape-Code property.charGets the character to be used when printing a separator line with theprintSeparatorLn()method.voidPrints the banner; the banner most probably is an ASCII_HEADER_ASCII_BODY art text block which's look depends strongly on the taste of the author implementing this interface.default voidPrints the help as ofprintHelp()without the banner.voidPrints the copyright note as specified by thewithCopyrightNote(String)method; with regards to the console width as specified by thewithConsoleWidth(int)method.voidPrints the description as set by thewithDescription(String)method with regards to the console width as specified by thewithConsoleWidth(int)method.voidPrints example usages as as added by theaddExample(String, Operand...)method with regards to the console width as specified by thewithConsoleWidth(int)method.voidPrints the header, which might be a simplified banner: Can be used when overriding methods such asprintHelp()orprintBanner().default voidPrints the help to the standard output specified by thewithStandardOut(PrintStream)method.voidPrints the license note as specified by thewithLicenseNote(String)method; with regards to the console width as specified by thewithConsoleWidth(int)method.voidprintLn()Prints an empty line / a line break.voidPrints the given line to standard out with regards to the console width as specified by thewithConsoleWidth(int)method.voidPrints theOptions (short- and the long-options), theFlages and theOperandand their description with regards to the console width as specified by thewithConsoleWidth(int)method.voidPrints a separator line using the separator character as specified by thewithSeparatorLnChar(char)method; with regards to the console width as specified by thewithConsoleWidth(int)method.voidPrints the syntax as retrieved by the rootConditionelement as ofSynopsisable.toSynopsis(SyntaxNotation)with regards to theSyntaxNotationset by thewithSyntaxMetrics(SyntaxMetrics)method.voidsetArgumentEscapeCode(String aParamEscCode) Sets the parameter Escape-Code for the parameter Escape-Code property.voidsetBannerBorderEscapeCode(String aBannerBorderEscCode) Sets the banner's border Escape-Code for the banner border Escape-Code property.voidsetBannerEscapeCode(String aBannerEscCode) Sets the banner's content Escape-Code for the banner Escape-Code property.voidsetBannerFont(org.refcodes.textual.Font aBannerFont) Sets the banner font.voidsetBannerFontPalette(char[] aColorPalette) Sets the banner font palette.voidsetCommandEscapeCode(String aCommandEscCode) Sets the command name's (CLI executable) Escape-Code for the command name Escape-Code property.voidsetConsoleWidth(int aConsoleWidth) Set the console with.voidsetCopyrightNote(String aCopyrightNote) Set the copyright note used by theprintHelp()method when writing out the copyright claim and make other adjustments with the result (with regards to the Builder-Pattern).voidsetDescriptionEscapeCode(String aDescriptionEscCode) Sets the description Escape-Code for the description Escape-Code property.voidsetErrorOut(PrintStream aErrorOut) Set the error outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).voidsetLicenseNote(String aLicenseNote) Set the license note used by theprintHelp()method when writing out the licensing conditions.voidsetLineBreak(String aLineBreak) Set the console's line break.voidsetLineSeparatorEscapeCode(String aLineSeparatorEscCode) Sets the line separator Escape-Code for the line separator Escape-Code property.voidsetMaxConsoleWidth(int aMaxConsoleWidth) Set the maximum console width to use in case the console width is greater than the maximum you want.voidsetOptionEscapeCode(String aOptEscCode) Sets the option Escape-Code for the option Escape-Code property.voidsetSeparatorLnChar(char aSeparatorLnChar) Set the character to be used when printing a separator line with theprintSeparatorLn()method.voidsetStandardOut(PrintStream aStandardOut) Set the standard outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).voidsetSyntaxMetrics(SyntaxMetrics aSyntaxMetrics) Set theSyntaxNotation.default String[]Retrieves an array of the context specific options being configured for the givenOptioninstance, being the long option (when set) and the short option (when set), by prepending the according runtime specific short option and long option prefix (if applicable).default ArgsParserwithArgumentEscapeCode(String aParamEscCode) Sets the parameter Escape-Code for the parameter Escape-Code property.default ArgsParserwithBannerBorderEscapeCode(String aBannerBorderEscCode) Sets the banner's border Escape-Code for the banner border Escape-Code property.default ArgsParserwithBannerEscapeCode(String aBannerEscCode) Sets the banner's content Escape-Code for the banner Escape-Code property.default ArgsParserwithBannerFont(org.refcodes.textual.Font aBannerFont) With banner font.default ArgsParserwithBannerFontPalette(char[] aColorPalette) With banner font palette.default ArgsParserwithCommandEscapeCode(String aCommandEscCode) Sets the command name's (CLI executable) Escape-Code for the command name Escape-Code property.default ArgsParserwithConsoleWidth(int aConsoleWidth) Set the console with.default ArgsParserwithCopyrightNote(String aCopyrightNote) Set the copyright note used by theprintHelp()method when writing out the copyright claim and make other adjustments with the result (with regards to the Builder-Pattern).default ArgsParserwithDescription(String aDescription) With description.default ArgsParserwithDescriptionEscapeCode(String aDescriptionEscCode) Sets the description Escape-Code for the description Escape-Code property.default ArgsParserwithErrorOut(PrintStream aErrorOut) Set the error outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).default ArgsParserwithEscapeCodesEnabled(boolean isEscCodeEnabled) default ArgsParserwithEvalArgs(String[] aArgs) Same asevalArgs(String[])with the difference that this class's instance being invoked is returned as of the builder pattern.default ArgsParserwithEvalArgs(List<String> aArgs) Same asevalArgs(List)with the difference that this class's instance being invoked is returned as of the builder pattern.default ArgsParserwithExample(String aDescription, Operand<?>... aOperands) Adds a usage example by providing a description of the example and the command line arguments required by the example.default ArgsParserwithExample(Example aExample) Adds a usage example.default ArgsParserwithExamples(Collection<Example> aExamples) Adds all the bunch ofExampleelements provided.default ArgsParserwithExamples(Example[] aExamples) Adds all the bunch ofExampleelements provided.default ArgsParserwithLicenseNote(String aLicenseNote) Set the license note used by theprintHelp()method when writing out the licensing conditions and make other adjustments with the result (with regards to the Builder-Pattern).default ArgsParserwithLineBreak(String aLineBreak) Set the console's line break.default ArgsParserwithLineSeparatorEscapeCode(String aLineSeparatorEscCode) Sets the line separator Escape-Code for the line separator Escape-Code property.default ArgsParserwithLongOptionPrefix(String aLongOptionPrefix) Sets the long option prefix for the long option prefix property.default ArgsParserwithMaxConsoleWidth(int aMaxConsoleWidth) Set the maximum console width to use in case the console width is greater than the maximum you want.default ArgsParserWith name.default ArgsParserwithOptionEscapeCode(String aOptEscCode) Sets the option Escape-Code for the option Escape-Code property.default ArgsParserwithResetEscapeCode(String aResetEscCode) default ArgsParserwithSeparatorLnChar(char aSeparatorLnChar) Set the character to be used when printing a separator line with theprintSeparatorLn()method.default ArgsParserwithShortOptionPrefix(Character aShortOptionPrefix) Sets the short option prefix for the short option prefix property.default ArgsParserwithStandardOut(PrintStream aStandardOut) Set the standard outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).default ArgsParserwithSyntaxMetrics(SyntaxMetrics aSyntaxMetrics) Set theSyntaxNotationand make other adjustments with the result (with regards to the Builder-Pattern).default ArgsParserwithTextBoxGrid(org.refcodes.textual.TextBoxGrid aTextBoxGrid) default ArgsParserWith title.Methods inherited from interface org.refcodes.cli.ArgsParserMixin
withEvalArgs, withEvalArgs, withEvalArgs, withEvalArgsMethods inherited from interface org.refcodes.cli.ArgumentEscapeCodeAccessor.ArgumentEscapeCodeProperty
letArgumentEscapeCodeMethods inherited from interface org.refcodes.mixin.DescriptionAccessor.DescriptionMutator
setDescriptionMethods inherited from interface org.refcodes.mixin.DescriptionAccessor.DescriptionProperty
letDescriptionMethods inherited from interface org.refcodes.mixin.EscapeCodesStatusAccessor
isEscapeCodesEnabledMethods inherited from interface org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusMutator
setEscapeCodesEnabledMethods inherited from interface org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusProperty
letEscapeCodesEnabledMethods inherited from interface org.refcodes.cli.LongOptionPrefixAccessor
getLongOptionPrefixMethods inherited from interface org.refcodes.cli.LongOptionPrefixAccessor.LongOptionPrefixMutator
setLongOptionPrefixMethods inherited from interface org.refcodes.cli.LongOptionPrefixAccessor.LongOptionPrefixProperty
letLongOptionPrefixMethods inherited from interface org.refcodes.mixin.NameAccessor
getNameMethods inherited from interface org.refcodes.mixin.NameAccessor.NameMutator
setNameMethods inherited from interface org.refcodes.mixin.NameAccessor.NameProperty
letNameMethods inherited from interface org.refcodes.cli.OptionEscapeCodeAccessor.OptionEscapeCodeProperty
letOptionEscapeCodeMethods inherited from interface org.refcodes.mixin.Resetable
resetMethods inherited from interface org.refcodes.mixin.ResetEscapeCodeAccessor
getResetEscapeCodeMethods inherited from interface org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeMutator
setResetEscapeCodeMethods inherited from interface org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeProperty
letResetEscapeCodeMethods inherited from interface org.refcodes.cli.ShortOptionPrefixAccessor
getShortOptionPrefixMethods inherited from interface org.refcodes.cli.ShortOptionPrefixAccessor.ShortOptionPrefixMutator
setShortOptionPrefixMethods inherited from interface org.refcodes.cli.ShortOptionPrefixAccessor.ShortOptionPrefixProperty
letShortOptionPrefixMethods inherited from interface org.refcodes.cli.SyntaxMetricsAccessor
getSyntaxMetricsMethods inherited from interface org.refcodes.cli.SyntaxMetricsAccessor.SyntaxMetricsProperty
letSyntaxMetricsMethods inherited from interface org.refcodes.textual.TextBoxGridAccessor
getTextBoxGridMethods inherited from interface org.refcodes.textual.TextBoxGridAccessor.TextBoxGridMutator
setTextBoxGridMethods inherited from interface org.refcodes.textual.TextBoxGridAccessor.TextBoxGridProperty
letTextBoxGridMethods inherited from interface org.refcodes.mixin.TitleAccessor
getTitleMethods inherited from interface org.refcodes.mixin.TitleAccessor.TitleMutator
setTitleMethods inherited from interface org.refcodes.mixin.TitleAccessor.TitleProperty
letTitle
-
Method Details
-
addExample
Adds a usage example by providing a description of the example and the command line arguments required by the example.- Parameters:
aExample- The description as well as the command line arguments used by the example.
-
addExample
Adds a usage example by providing a description of the example and the command line arguments required by the example.- Parameters:
aDescription- The description of the example.aOperands- The command line arguments used by the example.
-
errorLn
Prints the given line to standard error with regards to the console width as specified by thewithConsoleWidth(int)method.- Parameters:
aLine- The line to be printed.
-
evalArgs
Same asevalArgs(String[])with the difference that the elements representing the arguments are passed as a list instead of an array.- Parameters:
aArgs- The command line arguments to be evaluated.- Returns:
- The list of evaluated command line arguments being instances of
the
Operandinterfaces or its sub-types. - Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
evalArgs
default List<? extends Operand<?>> evalArgs(List<String> aArgs, ArgsFilter aArgsFilter) throws ArgsSyntaxException Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedArgsFilter.- Parameters:
aArgs- The command line arguments to be evaluated.aArgsFilter- TheArgsFilterused to filter (exclude) any "unwanted" or otherwise evaluated arguments.- Returns:
- This instance as of the builder pattern to chain further method calls.
- Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
evalArgs
default List<? extends Operand<?>> evalArgs(List<String> aArgs, Pattern aFilterExp) throws ArgsSyntaxException Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedPattern.- Parameters:
aArgs- The command line arguments to be evaluated.aFilterExp- ThePatternused to filter (exclude) any "unwanted" or otherwise evaluated arguments.- Returns:
- This instance as of the builder pattern to chain further method calls.
- Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
evalArgs
Evaluates the provided command line arguments and determines the according values by evaluating the rootCondition. In case of parsing failure, an according exception is thrown. ATTENTION: This method tests(!) for superfluous command line arguments being passed; e.g. command line arguments not being evaluated by any of theConstituentinstance being traversed starting at the rootConditionwill be reported. Business logic therefore should invoke this root node'sevalArgs(String[])method instead of aCondition'sConstituent.parseArgs(String[], String[], CliContext)method; as ignoring superfluous command line arguments will cause unexpected behavior from the point of view of the invoker.- Parameters:
aArgs- The command line arguments to be evaluated.- Returns:
- The list of evaluated command line arguments being instances of
the
Operandinterfaces or its sub-types. - Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
evalArgs
default List<? extends Operand<?>> evalArgs(String[] aArgs, ArgsFilter aArgsFilter) throws ArgsSyntaxException Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedArgsFilter.- Parameters:
aArgs- The command line arguments to be evaluated.aArgsFilter- TheArgsFilterused to filter (exclude) any "unwanted" or otherwise evaluated arguments.- Returns:
- This instance as of the builder pattern to chain further method calls.
- Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
evalArgs
default List<? extends Operand<?>> evalArgs(String[] aArgs, Pattern aFilterExp) throws ArgsSyntaxException Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedPattern.- Parameters:
aArgs- The command line arguments to be evaluated.aFilterExp- ThePatternused to filter (exclude) any "unwanted" or otherwise evaluated arguments.- Returns:
- This instance as of the builder pattern to chain further method calls.
- Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
getArgsSyntax
Constituent getArgsSyntax()The root condition is the starting point node of aConstituenthierarchy to be traversed when determining the syntax for command line arguments or when evaluating the command line arguments. Retrieves the root condition from the root condition property.- Specified by:
getArgsSyntaxin interfaceArgsSyntaxAccessor- Returns:
- The root
Conditionin which's syntax this parser is based.
-
getBannerBorderEscapeCode
String getBannerBorderEscapeCode()Retrieves the banner's border Escape-Code from the banner border Escape-Code property.- Returns:
- The banner border Escape-Code stored by the banner border Escape-Code property.
-
getBannerEscapeCode
String getBannerEscapeCode()Retrieves the banner's content Escape-Code from the banner Escape-Code property.- Returns:
- The banner Escape-Code stored by the banner Escape-Code property.
-
getCommandEscapeCode
String getCommandEscapeCode()Retrieves the command name's (CLI executable) Escape-Code from the command name Escape-Code property.- Returns:
- The command name's Escape-Code stored by the command name Escape-Code property.
-
getCopyrightNote
String getCopyrightNote()Retrieves the copyright.- Returns:
- The copyright note.
-
getDescription
String getDescription()Retrieves the description.- Specified by:
getDescriptionin interfaceorg.refcodes.mixin.DescriptionAccessor- Returns:
- The description.
-
getDescriptionEscapeCode
String getDescriptionEscapeCode()Retrieves the parameter's description Escape-Code from the parameter's description Escape-Code property.- Returns:
- The description Escape-Code stored by the description Escape-Code property.
-
getExamples
Retrieves theExampleinstances as added usingaddExample(String, Operand...).- Returns:
- The according
Exampleelements.
-
getLicenseNote
String getLicenseNote()Retrieves the license.- Returns:
- The license note.
-
getLineSeparatorEscapeCode
String getLineSeparatorEscapeCode()Retrieves the line separator Escape-Code from the line separator Escape-Code property.- Returns:
- The line separator Escape-Code stored by the line separator Escape-Code property.
-
getOptionEscapeCode
String getOptionEscapeCode()Retrieves the option Escape-Code from the option Escape-Code property.- Specified by:
getOptionEscapeCodein interfaceOptionEscapeCodeAccessor- Returns:
- The option Escape-Code stored by the option Escape-Code property.
-
getArgumentEscapeCode
String getArgumentEscapeCode()Retrieves the parameter Escape-Code from the parameter Escape-Code property.- Specified by:
getArgumentEscapeCodein interfaceArgumentEscapeCodeAccessor- Returns:
- The parameter Escape-Code stored by the parameter Escape-Code property.
-
getSeparatorLnChar
char getSeparatorLnChar()Gets the character to be used when printing a separator line with theprintSeparatorLn()method.- Returns:
- aSeparatorChar The character used by the
printSeparatorLn()method when printing out the line of characters..
-
printBanner
void printBanner()Prints the banner; the banner most probably is an ASCII_HEADER_ASCII_BODY art text block which's look depends strongly on the taste of the author implementing this interface. -
printBody
default void printBody()Prints the help as ofprintHelp()without the banner. -
printCopyrightNote
void printCopyrightNote()Prints the copyright note as specified by thewithCopyrightNote(String)method; with regards to the console width as specified by thewithConsoleWidth(int)method. -
printDescription
void printDescription()Prints the description as set by thewithDescription(String)method with regards to the console width as specified by thewithConsoleWidth(int)method. -
printExamples
void printExamples()Prints example usages as as added by theaddExample(String, Operand...)method with regards to the console width as specified by thewithConsoleWidth(int)method. -
printHeader
void printHeader()Prints the header, which might be a simplified banner: Can be used when overriding methods such asprintHelp()orprintBanner(). -
printHelp
default void printHelp()Prints the help to the standard output specified by thewithStandardOut(PrintStream)method. This method can make use of the more atomic methodsprintBanner(),printSynopsis(),printDescription(),printOptions()orprintSeparatorLn()to print a help text which's look depends strongly on the taste of the author implementing this interface. In case you dislike the implementing author's taste, feel free to overwrite this method and compose your own help text from the building blocks such asprintBanner(),printSynopsis(),printDescription(),printOptions()orprintSeparatorLn() -
printLicenseNote
void printLicenseNote()Prints the license note as specified by thewithLicenseNote(String)method; with regards to the console width as specified by thewithConsoleWidth(int)method. -
printLn
void printLn()Prints an empty line / a line break. -
printLn
Prints the given line to standard out with regards to the console width as specified by thewithConsoleWidth(int)method.- Parameters:
aLine- The line to be printed.
-
printOptions
void printOptions()Prints theOptions (short- and the long-options), theFlages and theOperandand their description with regards to the console width as specified by thewithConsoleWidth(int)method. -
printSeparatorLn
void printSeparatorLn()Prints a separator line using the separator character as specified by thewithSeparatorLnChar(char)method; with regards to the console width as specified by thewithConsoleWidth(int)method. -
printSynopsis
void printSynopsis()Prints the syntax as retrieved by the rootConditionelement as ofSynopsisable.toSynopsis(SyntaxNotation)with regards to theSyntaxNotationset by thewithSyntaxMetrics(SyntaxMetrics)method. -
setBannerBorderEscapeCode
Sets the banner's border Escape-Code for the banner border Escape-Code property.- Parameters:
aBannerBorderEscCode- The banner border Escape-Code to be stored by the banner border Escape-Code property.
-
setBannerEscapeCode
Sets the banner's content Escape-Code for the banner Escape-Code property.- Parameters:
aBannerEscCode- The banner Escape-Code to be stored by the banner Escape-Code property.
-
setBannerFont
void setBannerFont(org.refcodes.textual.Font aBannerFont) Sets the banner font.- Parameters:
aBannerFont- the new banner font
-
setBannerFontPalette
void setBannerFontPalette(char[] aColorPalette) Sets the banner font palette.- Parameters:
aColorPalette- the new banner font palette
-
setCommandEscapeCode
Sets the command name's (CLI executable) Escape-Code for the command name Escape-Code property.- Parameters:
aCommandEscCode- The command name's Escape-Code to stored by the command name Escape-Code property.
-
setConsoleWidth
void setConsoleWidth(int aConsoleWidth) Set the console with. A setting of "-1" makes the instance use theSystemUtility.getTerminalWidth()value, i.e. the console width is set automatically to be the width of your terminal.- Parameters:
aConsoleWidth- The width to set or -1 to let the parser automatically determine the console width.
-
setCopyrightNote
Set the copyright note used by theprintHelp()method when writing out the copyright claim and make other adjustments with the result (with regards to the Builder-Pattern).- Parameters:
aCopyrightNote- The license note printed out by theprintHelp()method.
-
setDescriptionEscapeCode
Sets the description Escape-Code for the description Escape-Code property.- Parameters:
aDescriptionEscCode- The description Escape-Code to be stored by the description Escape-Code property.
-
setErrorOut
Set the error outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).- Parameters:
aErrorOut- The error outPrintStreamto set.
-
setLicenseNote
Set the license note used by theprintHelp()method when writing out the licensing conditions.- Parameters:
aLicenseNote- The license note printed out by theprintHelp()method.
-
setLineBreak
Set the console's line break. A setting of null makes the instance use theSystemUtility.getLineBreak()value.- Parameters:
aLineBreak- the new line break
-
setLineSeparatorEscapeCode
Sets the line separator Escape-Code for the line separator Escape-Code property.- Parameters:
aLineSeparatorEscCode- The line separator Escape-Code to be stored by the line separator Escape-Code property.
-
setMaxConsoleWidth
void setMaxConsoleWidth(int aMaxConsoleWidth) Set the maximum console width to use in case the console width is greater than the maximum you want. This is most useful when the console width is determined automatically to be the width of your terminal.- Parameters:
aMaxConsoleWidth- the new max console width
-
setOptionEscapeCode
Sets the option Escape-Code for the option Escape-Code property.- Specified by:
setOptionEscapeCodein interfaceOptionEscapeCodeAccessor.OptionEscapeCodeMutator- Parameters:
aOptEscCode- The option Escape-Code to be stored by the option Escape-Code property.
-
setArgumentEscapeCode
Sets the parameter Escape-Code for the parameter Escape-Code property.- Specified by:
setArgumentEscapeCodein interfaceArgumentEscapeCodeAccessor.ArgumentEscapeCodeMutator- Parameters:
aParamEscCode- The parameter Escape-Code to be stored by the parameter Escape-Code property.
-
setSeparatorLnChar
void setSeparatorLnChar(char aSeparatorLnChar) Set the character to be used when printing a separator line with theprintSeparatorLn()method.- Parameters:
aSeparatorLnChar- The character used by theprintSeparatorLn()method when printing out the line of characters..
-
setStandardOut
Set the standard outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).- Parameters:
aStandardOut- The standard outPrintStreamto set.
-
setSyntaxMetrics
Set theSyntaxNotation.- Specified by:
setSyntaxMetricsin interfaceSyntaxMetricsAccessor.SyntaxMetricsMutator- Parameters:
aSyntaxMetrics- TheSyntaxNotationto set.
-
toOptions
Retrieves an array of the context specific options being configured for the givenOptioninstance, being the long option (when set) and the short option (when set), by prepending the according runtime specific short option and long option prefix (if applicable).- Specified by:
toOptionsin interfaceOptionable- Parameters:
aOption- TheOptioninstance for which to get the configured short and long options.- Returns:
- The array of options being the long option (if not null) and the short option (if not null) with the according context specific prefixes.
-
withBannerBorderEscapeCode
Sets the banner's border Escape-Code for the banner border Escape-Code property.- Parameters:
aBannerBorderEscCode- The banner border Escape-Code to be stored by the banner border Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withBannerEscapeCode
Sets the banner's content Escape-Code for the banner Escape-Code property.- Parameters:
aBannerEscCode- The banner Escape-Code to be stored by the banner Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withBannerFont
With banner font.- Parameters:
aBannerFont- the banner font- Returns:
- the args parser
-
withBannerFontPalette
With banner font palette.- Parameters:
aColorPalette- the color palette- Returns:
- the args parser
-
withCommandEscapeCode
Sets the command name's (CLI executable) Escape-Code for the command name Escape-Code property.- Parameters:
aCommandEscCode- The command name's Escape-Code to stored by the command name Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withConsoleWidth
Set the console with. A setting of "-1" makes the instance use theSystemUtility.getTerminalWidth()value.- Parameters:
aConsoleWidth- The width to set.- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withCopyrightNote
Set the copyright note used by theprintHelp()method when writing out the copyright claim and make other adjustments with the result (with regards to the Builder-Pattern).- Parameters:
aCopyrightNote- The license note printed out by theprintHelp()method.- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withDescription
With description.- Specified by:
withDescriptionin interfaceorg.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<ArgsParser>- Parameters:
aDescription- the description- Returns:
- the args parser
-
withDescriptionEscapeCode
Sets the description Escape-Code for the description Escape-Code property.- Parameters:
aDescriptionEscCode- The parameter's description Escape-Code to be stored by the parameter's description Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withErrorOut
Set the error outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).- Parameters:
aErrorOut- The error outPrintStreamto set.- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withEscapeCodesEnabled
- Specified by:
withEscapeCodesEnabledin interfaceorg.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<ArgsParser>
-
withEvalArgs
Same asevalArgs(List)with the difference that this class's instance being invoked is returned as of the builder pattern.- Specified by:
withEvalArgsin interfaceArgsParserMixin<ArgsParser>- Parameters:
aArgs- The command line arguments to be evaluated.- Returns:
- This invoked instance as of the builder pattern to chain method calls.
- Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
withEvalArgs
Same asevalArgs(String[])with the difference that this class's instance being invoked is returned as of the builder pattern.- Specified by:
withEvalArgsin interfaceArgsParserMixin<ArgsParser>- Parameters:
aArgs- The command line arguments to be evaluated.- Returns:
- This invoked instance as of the builder pattern to chain method calls.
- Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
withExample
Adds a usage example.- Parameters:
aExample- TheExampleto add.- Returns:
- This instance as of the builder pattern.
-
withExample
Adds a usage example by providing a description of the example and the command line arguments required by the example.- Parameters:
aDescription- The description of the example.aOperands- The command line arguments used by the example.- Returns:
- This instance as of the builder pattern.
-
withExamples
Adds all the bunch ofExampleelements provided.- Parameters:
aExamples- The example usages to be added.- Returns:
- This instance as of the builder pattern.
-
withExamples
Adds all the bunch ofExampleelements provided.- Parameters:
aExamples- The example usages to be added.- Returns:
- This instance as of the builder pattern.
-
withLicenseNote
Set the license note used by theprintHelp()method when writing out the licensing conditions and make other adjustments with the result (with regards to the Builder-Pattern).- Parameters:
aLicenseNote- The license note printed out by theprintHelp()method.- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withLineBreak
Set the console's line break. A setting of null makes the instance use theSystemUtility.getLineBreak()value.- Parameters:
aLineBreak- the line break- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withLineSeparatorEscapeCode
Sets the line separator Escape-Code for the line separator Escape-Code property.- Parameters:
aLineSeparatorEscCode- The line separator Escape-Code to be stored by the line separator Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withLongOptionPrefix
Sets the long option prefix for the long option prefix property.- Specified by:
withLongOptionPrefixin interfaceLongOptionPrefixAccessor.LongOptionPrefixBuilder<ArgsParser>- Parameters:
aLongOptionPrefix- The long option prefix to be stored by the long option prefix property.- Returns:
- The builder for applying multiple build operations.
-
withMaxConsoleWidth
Set the maximum console width to use in case the console width is greater than the maximum you want. This is most useful when the console width is determined automatically to be the width of your terminal.- Parameters:
aMaxConsoleWidth- the max console width- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withName
With name.- Specified by:
withNamein interfaceorg.refcodes.mixin.NameAccessor.NameBuilder<ArgsParser>- Parameters:
aName- the name- Returns:
- the args parser
-
withOptionEscapeCode
Sets the option Escape-Code for the option Escape-Code property.- Specified by:
withOptionEscapeCodein interfaceOptionEscapeCodeAccessor.OptionEscapeCodeBuilder<ArgsParser>- Parameters:
aOptEscCode- The option Escape-Code to be stored by the option Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withArgumentEscapeCode
Sets the parameter Escape-Code for the parameter Escape-Code property.- Specified by:
withArgumentEscapeCodein interfaceArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<ArgsParser>- Parameters:
aParamEscCode- The parameter Escape-Code to be stored by the parameter Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withResetEscapeCode
- Specified by:
withResetEscapeCodein interfaceorg.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeBuilder<ArgsParser>
-
withSeparatorLnChar
Set the character to be used when printing a separator line with theprintSeparatorLn()method.- Parameters:
aSeparatorLnChar- The character used by theprintSeparatorLn()method when printing out the line of characters..- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withShortOptionPrefix
Sets the short option prefix for the short option prefix property.- Specified by:
withShortOptionPrefixin interfaceShortOptionPrefixAccessor.ShortOptionPrefixBuilder<ArgsParser>- Parameters:
aShortOptionPrefix- The short option prefix to be stored by the short option prefix property.- Returns:
- The builder for applying multiple build operations.
-
withStandardOut
Set the standard outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).- Parameters:
aStandardOut- The standard outPrintStreamto set.- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withSyntaxMetrics
Set theSyntaxNotationand make other adjustments with the result (with regards to the Builder-Pattern).- Specified by:
withSyntaxMetricsin interfaceSyntaxMetricsAccessor.SyntaxMetricsBuilder<ArgsParser>- Parameters:
aSyntaxMetrics- TheSyntaxNotationto set.- Returns:
- This
ArgsParserinstance with regard to the builder pattern.
-
withTextBoxGrid
- Specified by:
withTextBoxGridin interfaceorg.refcodes.textual.TextBoxGridAccessor.TextBoxGridBuilder<ArgsParser>
-
withTitle
With title.- Specified by:
withTitlein interfaceorg.refcodes.mixin.TitleAccessor.TitleBuilder<ArgsParser>- Parameters:
aTitle- the title- Returns:
- the args parser
-