Class CliArgsParser
java.lang.Object
org.refcodes.cli.CliArgsParser
- All Implemented Interfaces:
ArgsParser, ArgsParserBuilder<ArgsParser>, ArgsProcessorBuilder<ArgsParser>, ArgsSyntaxAccessor, ArgsSyntaxAccessor.ArgsSyntaxBuilder<ArgsParser>, ArgsSyntaxAccessor.ArgsSyntaxMutator, ArgsSyntaxAccessor.ArgsSyntaxProperty, ArgumentEscapeCodeAccessor, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<ArgsParser>, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeMutator, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeProperty, BannerBorderEscapeCodeAccessor, BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeBuilder<ArgsParser>, BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeMutator, BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeProperty, BannerEscapeCodeAccessor, BannerEscapeCodeAccessor.BannerEscapeCodeBuilder<ArgsParser>, BannerEscapeCodeAccessor.BannerEscapeCodeMutator, BannerEscapeCodeAccessor.BannerEscapeCodeProperty, BannerFontAccessor, BannerFontAccessor.BannerFontBuilder<ArgsParser>, BannerFontAccessor.BannerFontMutator, BannerFontAccessor.BannerFontProperty, BannerFontPaletteAccessor, BannerFontPaletteAccessor.BannerFontPaletteBuilder<ArgsParser>, BannerFontPaletteAccessor.BannerFontPaletteMutator, BannerFontPaletteAccessor.BannerFontPaletteProperty, CliMetrics, CommandEscapeCodeAccessor, CommandEscapeCodeAccessor.CommandEscapeCodeBuilder<ArgsParser>, CommandEscapeCodeAccessor.CommandEscapeCodeMutator, CommandEscapeCodeAccessor.CommandEscapeCodeProperty, CopyrightAccessor, CopyrightAccessor.CopyrightBuilder<ArgsParser>, CopyrightAccessor.CopyrightMutator, CopyrightAccessor.CopyrightProperty, DescriptionEscapeCodeAccessor, DescriptionEscapeCodeAccessor.DescriptionEscapeCodeBuilder<ArgsParser>, DescriptionEscapeCodeAccessor.DescriptionEscapeCodeMutator, DescriptionEscapeCodeAccessor.DescriptionEscapeCodeProperty, ExamplesAccessor, ExamplesAccessor.ExamplesBuilder<ArgsParser>, ExamplesAccessor.ExamplesMutator, ExamplesAccessor.ExamplesProperty, KeywordEscapeCodeAccessor, KeywordEscapeCodeAccessor.KeywordEscapeCodeBuilder<ArgsParser>, KeywordEscapeCodeAccessor.KeywordEscapeCodeMutator, KeywordEscapeCodeAccessor.KeywordEscapeCodeProperty, LicenseAccessor, LicenseAccessor.LicenseBuilder<ArgsParser>, LicenseAccessor.LicenseMutator, LicenseAccessor.LicenseProperty, LineSeparatorEscapeCodeAccessor, LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeBuilder<ArgsParser>, LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeMutator, LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeProperty, LongOptionPrefixAccessor, LongOptionPrefixAccessor.LongOptionPrefixBuilder<ArgsParser>, LongOptionPrefixAccessor.LongOptionPrefixMutator, LongOptionPrefixAccessor.LongOptionPrefixProperty, Optionable, ShortOptionPrefixAccessor, ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<ArgsParser>, ShortOptionPrefixAccessor.ShortOptionPrefixMutator, ShortOptionPrefixAccessor.ShortOptionPrefixProperty, SyntaxMetricsAccessor, SyntaxMetricsAccessor.SyntaxMetricsBuilder<ArgsParser>, SyntaxMetricsAccessor.SyntaxMetricsMutator, SyntaxMetricsAccessor.SyntaxMetricsProperty, ConsoleWidthAccessor, ConsoleWidthAccessor.ConsoleWidthBuilder<ArgsParser>, ConsoleWidthAccessor.ConsoleWidthMutator, ConsoleWidthAccessor.ConsoleWidthProperty, DescriptionAccessor, DescriptionAccessor.DescriptionBuilder<ArgsParser>, DescriptionAccessor.DescriptionMutator, DescriptionAccessor.DescriptionProperty, EscapeCodesStatusAccessor, EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<ArgsParser>, EscapeCodesStatusAccessor.EscapeCodeStatusMutator, EscapeCodesStatusAccessor.EscapeCodeStatusProperty, LineBreakAccessor, LineBreakAccessor.LineBreakBuilder<ArgsParser>, LineBreakAccessor.LineBreakMutator, LineBreakAccessor.LineBreakProperty, MaxConsoleWidthAccessor, MaxConsoleWidthAccessor.MaxConsoleWidthBuilder<ArgsParser>, MaxConsoleWidthAccessor.MaxConsoleWidthMutator, MaxConsoleWidthAccessor.MaxConsoleWidthProperty, NameAccessor, NameAccessor.NameBuilder<ArgsParser>, NameAccessor.NameMutator, NameAccessor.NameProperty, Resetable, ResetEscapeCodeAccessor, ResetEscapeCodeAccessor.ResetEscapeCodeBuilder<ArgsParser>, ResetEscapeCodeAccessor.ResetEscapeCodeMutator, ResetEscapeCodeAccessor.ResetEscapeCodeProperty, TitleAccessor, TitleAccessor.TitleBuilder<ArgsParser>, TitleAccessor.TitleMutator, TitleAccessor.TitleProperty, Diagnosable, Schemable<DiagnosticOptions>, TextBoxGridAccessor, TextBoxGridAccessor.TextBoxGridBuilder<ArgsParser>, TextBoxGridAccessor.TextBoxGridMutator, TextBoxGridAccessor.TextBoxGridProperty
A straightforward implementation of the
ArgsParser interface. The
constructor only provides means to set the required attributes as the
attributes to be adjusted optionally are already sufficiently preconfigured.
For adjusting them, a flavor of the Builder-Pattern is provided with which
you can easily chain the configuration of this instance; as them methods
return the instance of this class being configured. This helps to prevent the
telescoping constructor anti-pattern.
The SyntaxNotation is pre-set with the SyntaxNotation.LOGICAL
notation.
The console width id preconfigured with the console's width as determined by
the SystemUtility.getTerminalWidth().
The standard out PrintStream is preconfigured with the
System.out PrintStream.
The newline characters to be used for line breaks is "\r\n" on Windows
machines and "\"n" on all other machines as of the
SystemUtility.getLineBreak().
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ArgsSyntaxAccessor
ArgsSyntaxAccessor.ArgsSyntaxBuilder<B>, ArgsSyntaxAccessor.ArgsSyntaxMutator, ArgsSyntaxAccessor.ArgsSyntaxPropertyNested classes/interfaces inherited from interface ArgumentEscapeCodeAccessor
ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<B>, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeMutator, ArgumentEscapeCodeAccessor.ArgumentEscapeCodePropertyNested classes/interfaces inherited from interface BannerBorderEscapeCodeAccessor
BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeBuilder<B>, BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeMutator, BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodePropertyNested classes/interfaces inherited from interface BannerEscapeCodeAccessor
BannerEscapeCodeAccessor.BannerEscapeCodeBuilder<B>, BannerEscapeCodeAccessor.BannerEscapeCodeMutator, BannerEscapeCodeAccessor.BannerEscapeCodePropertyNested classes/interfaces inherited from interface BannerFontAccessor
BannerFontAccessor.BannerFontBuilder<B>, BannerFontAccessor.BannerFontMutator, BannerFontAccessor.BannerFontPropertyNested classes/interfaces inherited from interface BannerFontPaletteAccessor
BannerFontPaletteAccessor.BannerFontPaletteBuilder<B>, BannerFontPaletteAccessor.BannerFontPaletteMutator, BannerFontPaletteAccessor.BannerFontPalettePropertyNested classes/interfaces inherited from interface CommandEscapeCodeAccessor
CommandEscapeCodeAccessor.CommandEscapeCodeBuilder<B>, CommandEscapeCodeAccessor.CommandEscapeCodeMutator, CommandEscapeCodeAccessor.CommandEscapeCodePropertyNested classes/interfaces inherited from interface ConsoleWidthAccessor
ConsoleWidthAccessor.ConsoleWidthBuilder<B>, ConsoleWidthAccessor.ConsoleWidthMutator, ConsoleWidthAccessor.ConsoleWidthPropertyNested classes/interfaces inherited from interface CopyrightAccessor
CopyrightAccessor.CopyrightBuilder<B>, CopyrightAccessor.CopyrightMutator, CopyrightAccessor.CopyrightPropertyNested classes/interfaces inherited from interface DescriptionAccessor
DescriptionAccessor.DescriptionBuilder<B>, DescriptionAccessor.DescriptionMutator, DescriptionAccessor.DescriptionPropertyNested classes/interfaces inherited from interface DescriptionEscapeCodeAccessor
DescriptionEscapeCodeAccessor.DescriptionEscapeCodeBuilder<B>, DescriptionEscapeCodeAccessor.DescriptionEscapeCodeMutator, DescriptionEscapeCodeAccessor.DescriptionEscapeCodePropertyNested classes/interfaces inherited from interface EscapeCodesStatusAccessor
EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<B>, EscapeCodesStatusAccessor.EscapeCodeStatusMutator, EscapeCodesStatusAccessor.EscapeCodeStatusPropertyNested classes/interfaces inherited from interface ExamplesAccessor
ExamplesAccessor.ExamplesBuilder<B>, ExamplesAccessor.ExamplesMutator, ExamplesAccessor.ExamplesPropertyNested classes/interfaces inherited from interface KeywordEscapeCodeAccessor
KeywordEscapeCodeAccessor.KeywordEscapeCodeBuilder<B>, KeywordEscapeCodeAccessor.KeywordEscapeCodeMutator, KeywordEscapeCodeAccessor.KeywordEscapeCodePropertyNested classes/interfaces inherited from interface LicenseAccessor
LicenseAccessor.LicenseBuilder<B>, LicenseAccessor.LicenseMutator, LicenseAccessor.LicensePropertyNested classes/interfaces inherited from interface LineBreakAccessor
LineBreakAccessor.LineBreakBuilder<B>, LineBreakAccessor.LineBreakMutator, LineBreakAccessor.LineBreakPropertyNested classes/interfaces inherited from interface LineSeparatorEscapeCodeAccessor
LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeBuilder<B>, LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeMutator, LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodePropertyNested classes/interfaces inherited from interface LongOptionPrefixAccessor
LongOptionPrefixAccessor.LongOptionPrefixBuilder<B>, LongOptionPrefixAccessor.LongOptionPrefixMutator, LongOptionPrefixAccessor.LongOptionPrefixPropertyNested classes/interfaces inherited from interface MaxConsoleWidthAccessor
MaxConsoleWidthAccessor.MaxConsoleWidthBuilder<B>, MaxConsoleWidthAccessor.MaxConsoleWidthMutator, MaxConsoleWidthAccessor.MaxConsoleWidthPropertyNested classes/interfaces inherited from interface NameAccessor
NameAccessor.NameBuilder<B>, NameAccessor.NameMutator, NameAccessor.NamePropertyNested classes/interfaces inherited from interface ResetEscapeCodeAccessor
ResetEscapeCodeAccessor.ResetEscapeCodeBuilder<B>, ResetEscapeCodeAccessor.ResetEscapeCodeMutator, ResetEscapeCodeAccessor.ResetEscapeCodePropertyNested classes/interfaces inherited from interface ShortOptionPrefixAccessor
ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<B>, ShortOptionPrefixAccessor.ShortOptionPrefixMutator, ShortOptionPrefixAccessor.ShortOptionPrefixPropertyNested classes/interfaces inherited from interface SyntaxMetricsAccessor
SyntaxMetricsAccessor.SyntaxMetricsBuilder<B>, SyntaxMetricsAccessor.SyntaxMetricsMutator, SyntaxMetricsAccessor.SyntaxMetricsPropertyNested classes/interfaces inherited from interface TextBoxGridAccessor
TextBoxGridAccessor.TextBoxGridBuilder<B>, TextBoxGridAccessor.TextBoxGridMutator, TextBoxGridAccessor.TextBoxGridPropertyNested classes/interfaces inherited from interface TitleAccessor
TitleAccessor.TitleBuilder<B>, TitleAccessor.TitleMutator, TitleAccessor.TitleProperty -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs theArgsParserinstance without any restrictions to the parsed arguments.CliArgsParser(CliContext aCliCtx) Constructs theArgsParserinstance without any restrictions to the parsed arguments.CliArgsParser(Term aArgsSyntax) Constructs theArgsParserinstance with the given rootConditionand the defaultSyntaxNotation.LOGICAL.CliArgsParser(Term aArgsSyntax, CliContext aCliCtx) Constructs theArgsParserinstance with the given rootConditionand the defaultSyntaxNotation.LOGICAL. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExample(Example aExampleUsage) Adds an 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 theArgsParser.withConsoleWidth(int)method.Operand<?>[]Evaluates the provided command line arguments and determines the according values by evaluating the rootCondition.Retrieves the argument Escape-Code from the argument Escape-Code property.Retrieves the banner border Escape-Code from the banner border Escape-Code property.Retrieves the banner Escape-Code from the banner Escape-Code property.char[]Retrieves the banner font palette from the banner font palette property.Retrieves the command Escape-Code from the command Escape-Code property.intRetrieves the copyright from the copyright property.protected charThe delimiter to be used for colliding command line args when creating non colliding arg's aliases (keys for key/value-pairs).Retrieves the description Escape-Code from the description Escape-Code property.Example[]Retrieves the keyword (e.g. short- and long-options) Escape-Code from the option Escape-Code property.Retrieves the license from the license property.Retrieves the line separator Escape-Code from the line separator Escape-Code property.Retrieves the long option prefix from the long option prefix property.intgetName()charGets the character to be used when printing a separator line with theArgsParser.printSeparatorLn()method.Retrieves the short option prefix from the short option prefix property.Retrieves theSyntaxMetricsfrom theSyntaxMetricsproperty.getTitle()booleanvoidPrints 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.voidPrints the copyright note as specified by theArgsParser.withCopyright(String)method; with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.voidPrints the description as set by theArgsParser.withDescription(String)method with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.voidPrints example usages as as added by theArgsParser.addExample(String, Operand...)method with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.voidPrints the header, which might be a simplified banner: Can be used when overriding methods such asArgsParser.printHelp()orArgsParser.printBanner().voidPrints the license note as specified by theArgsParser.withLicense(String)method; with regards to the console width as specified by theArgsParser.withConsoleWidth(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 theArgsParser.withConsoleWidth(int)method.voidPrints theOptions (short- and the long-options), theFlages and theOperandand their description with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.voidPrints a separator line using the separator character as specified by theArgsParser.withSeparatorLnChar(char)method; with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.voidPrints the syntax as retrieved by the rootConditionelement as ofSynopsisable.toSynopsis(SyntaxNotation)with regards to theSyntaxNotationset by theArgsParser.withSyntaxMetrics(SyntaxMetrics)method.voidreset()voidsetArgsSyntax(Term aArgsSyntax) voidsetArgumentEscapeCode(String aParamEscapeCode) Sets the argument Escape-Code for the argument Escape-Code property.voidsetBannerBorderEscapeCode(String aBannerBorderEscapeCode) Sets the banner border Escape-Code for the banner border Escape-Code property.voidsetBannerEscapeCode(String aBannerEscapeCode) Sets the banner Escape-Code for the banner Escape-Code property.voidsetBannerFont(Font aBannerFont) voidsetBannerFontPalette(char[] aColorPalette) Sets the banner font palette for the banner font palette property.voidsetBannerFontPalette(AsciiColorPalette aBannerFontPalette) Sets the banner font palette for the banner font palette property.voidsetCommandEscapeCode(String aCommandEscapeCode) Sets the command Escape-Code for the command Escape-Code property.voidsetConsoleWidth(int aConsoleWidth) voidsetCopyright(String aCopyrightNote) Sets the copyright for the copyright property.voidsetDescription(String aDescription) voidsetDescriptionEscapeCode(String aDescriptionEscapeCode) 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).voidsetEscapeCodesEnabled(boolean isEscapeCodesEnabled) voidsetExamples(Example[] aExamples) voidsetKeywordEscapeCode(String aOptEscapeCode) Sets the keyword (e.g. short- and long-options) Escape-Code for the option Escape-Code property.voidsetLicense(String aLicenseNote) Sets the license for the license property.voidsetLineBreak(String aLineBreak) voidsetLineSeparatorEscapeCode(String aLineSeparatorEscapeCode) Sets the line separator Escape-Code for the line separator Escape-Code property.voidsetLongOptionPrefix(String aLongOptionPrefix) Sets the long option prefix for the long option prefix property.voidsetMaxConsoleWidth(int aMaxConsoleWidth) voidvoidsetResetEscapeCode(String aResetEscapeCode) voidsetSeparatorLnChar(char aSeparatorLnChar) Set the character to be used when printing a separator line with theArgsParser.printSeparatorLn()method.voidsetShortOptionPrefix(Character aShortOptionPrefix) Sets the short option prefix for the short option prefix property.voidsetStandardOut(PrintStream aStandardOut) Set the standard outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).voidsetSyntaxMetrics(SyntaxMetrics aSyntaxMetrics) Sets theSyntaxMetricsfor theSyntaxMetricsproperty.voidsetTextBoxGrid(TextBoxGrid aTextBoxGrid) voidwithAddExample(String aDescription, Operand<?>... aOperands) Builder method adding an application'sExampleelement.withAddExample(Example aExamples) Builder method adding an application'sExampleelement.withArgsSyntax(Term aArgsSyntax) withArgumentEscapeCode(String aParamEscCode) Sets the argument Escape-Code for the argument Escape-Code property.withBannerBorderEscapeCode(String aBannerBorderEscCode) Sets the banner border Escape-Code for the banner border Escape-Code property.withBannerEscapeCode(String aBannerEscCode) Sets the banner Escape-Code for the banner Escape-Code property.withBannerFont(Font aBannerFont) withBannerFontPalette(char[] aColorPalette) Sets the banner font palette for the banner font palette property.withBannerFontPalette(AsciiColorPalette aBannerFontPalette) Sets the banner font palette for the banner font palette property.withCommandEscapeCode(String aCommandEscCode) Sets the command Escape-Code for the command Escape-Code property.withConsoleWidth(int aConsoleWidth) withCopyright(String aCopyright) Sets the copyright for the copyright property.withDescription(String aDescription) withDescriptionEscapeCode(String aDescriptionEscCode) Sets the description Escape-Code for the description Escape-Code property.withErrorOut(PrintStream aErrorOut) Set the error outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).withEscapeCodesEnabled(boolean aIsEscCodeEnabled) withEvalArgs(String[] aArgs) Evaluates the provided command line arguments.withEvalArgs(String[] aArgs, Pattern aFilterExp) Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedPattern.withEvalArgs(String[] aArgs, ArgsFilter aArgsFilter) Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedArgsFilter.withEvalArgs(List<String> aArgs) Evaluates the provided command line arguments .withEvalArgs(List<String> aArgs, Pattern aFilterExp) Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedPattern.withEvalArgs(List<String> aArgs, ArgsFilter aArgsFilter) Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedArgsFilter.withExamples(Collection<Example> aExamples) Builder method providing the application'sExampleelements.withExamples(Example[] aExamples) withKeywordEscapeCode(String aOptEscCode) Sets the keyword (e.g. short- and long-options) Escape-Code for the keyword Escape-Code property.withLicense(String aLicense) Sets the license for the license property.withLineBreak(String aLineBreak) withLineSeparatorEscapeCode(String aLineSeparatorEscCode) Sets the line separator Escape-Code for the line separator Escape-Code property.withLongOptionPrefix(String aLongOptionPrefix) Sets the long option prefix for the long option prefix property.withMaxConsoleWidth(int aMaxConsoleWidth) withResetEscapeCode(String aResetEscCode) withSeparatorLnChar(char aSeparatorLnChar) Builder method adding an separator line char.withShortOptionPrefix(Character aShortOptionPrefix) Sets the short option prefix for the short option prefix property.withStandardOut(PrintStream aStandardOut) Set the standard outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).withSyntaxMetrics(SyntaxMetrics aSyntaxMetrics) Sets theSyntaxMetricsfor theSyntaxMetricsproperty.withSyntaxMetrics(SyntaxNotation aSyntaxNotation) Sets theSyntaxNotationfor theSyntaxNotationproperty.withTextBoxGrid(TextBoxGrid aTextBoxGrid) withTextBoxGrid(TextBoxStyle aTextBoxStyle) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ArgsParser
addExample, evalArgs, evalArgs, evalArgs, evalArgs, evalArgs, printBody, printHelp, toOptions, toSchemaMethods inherited from interface ArgsSyntaxAccessor.ArgsSyntaxProperty
letArgsSyntaxMethods inherited from interface ArgumentEscapeCodeAccessor.ArgumentEscapeCodeProperty
letArgumentEscapeCodeMethods inherited from interface BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeProperty
letBannerBorderEscapeCodeMethods inherited from interface BannerEscapeCodeAccessor.BannerEscapeCodeProperty
letBannerEscapeCodeMethods inherited from interface BannerFontAccessor.BannerFontProperty
letBannerFontMethods inherited from interface BannerFontPaletteAccessor.BannerFontPaletteProperty
letBannerFontPaletteMethods inherited from interface CommandEscapeCodeAccessor.CommandEscapeCodeProperty
letCommandEscapeCodeMethods inherited from interface ConsoleWidthAccessor.ConsoleWidthProperty
letConsoleWidthMethods inherited from interface CopyrightAccessor.CopyrightProperty
letCopyrightMethods inherited from interface DescriptionAccessor.DescriptionProperty
letDescriptionMethods inherited from interface DescriptionEscapeCodeAccessor.DescriptionEscapeCodeProperty
letDescriptionEscapeCodeMethods inherited from interface EscapeCodesStatusAccessor.EscapeCodeStatusProperty
letEscapeCodesEnabledMethods inherited from interface ExamplesAccessor.ExamplesMutator
setExamplesMethods inherited from interface ExamplesAccessor.ExamplesProperty
letExamplesMethods inherited from interface KeywordEscapeCodeAccessor.KeywordEscapeCodeProperty
letKeywordEscapeCodeMethods inherited from interface LicenseAccessor.LicenseProperty
letLicenseMethods inherited from interface LineBreakAccessor.LineBreakProperty
letLineBreakMethods inherited from interface LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeProperty
letLineSeparatorEscapeCodeMethods inherited from interface LongOptionPrefixAccessor.LongOptionPrefixProperty
letLongOptionPrefixMethods inherited from interface MaxConsoleWidthAccessor.MaxConsoleWidthProperty
letMaxConsoleWidthMethods inherited from interface NameAccessor.NameProperty
letNameMethods inherited from interface ResetEscapeCodeAccessor.ResetEscapeCodeProperty
letResetEscapeCodeMethods inherited from interface ShortOptionPrefixAccessor.ShortOptionPrefixProperty
letShortOptionPrefixMethods inherited from interface SyntaxMetricsAccessor.SyntaxMetricsMutator
setSyntaxMetricsMethods inherited from interface SyntaxMetricsAccessor.SyntaxMetricsProperty
letSyntaxMetrics, letSyntaxMetricsMethods inherited from interface TextBoxGridAccessor.TextBoxGridMutator
setTextBoxGridMethods inherited from interface TextBoxGridAccessor.TextBoxGridProperty
letTextBoxGrid, letTextBoxGridMethods inherited from interface TitleAccessor.TitleProperty
letTitle
-
Field Details
-
_errStream
-
_stdStream
-
-
Constructor Details
-
CliArgsParser
public CliArgsParser()Constructs theArgsParserinstance without any restrictions to the parsed arguments. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured. -
CliArgsParser
Constructs theArgsParserinstance without any restrictions to the parsed arguments. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured.- Parameters:
aCliCtx- TheCliContextto be used for initializing.
-
CliArgsParser
Constructs theArgsParserinstance with the given rootConditionand the defaultSyntaxNotation.LOGICAL. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured.- Parameters:
aArgsSyntax- The args syntax rootTermnode being the node from which parsing the command line arguments starts.
-
CliArgsParser
Constructs theArgsParserinstance with the given rootConditionand the defaultSyntaxNotation.LOGICAL. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured.- Parameters:
aArgsSyntax- The args syntax rootTermnode being the node from which parsing the command line arguments starts.aCliCtx- TheCliContextto be used for initializing.
-
-
Method Details
-
addExample
Adds an usage example by providing a description of the example and the command line arguments required by the example.- Specified by:
addExamplein interfaceArgsParser- Parameters:
aExampleUsage- The description as well as 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 theArgsParser.withConsoleWidth(int)method.- Specified by:
errorLnin interfaceArgsParser- Parameters:
aLine- The line to be printed.
-
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 theTerminstance being traversed starting at the rootConditionwill be reported. Business logic therefore should invoke this root node'sArgsParser.evalArgs(String[])method instead of aCondition'sTerm.parseArgs(String[], String[], CliContext)method; as ignoring superfluous command line arguments will aCause unexpected behavior from the point of view of the invoker.- Specified by:
evalArgsin interfaceArgsParser- 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. In case anOperandimplements theApprovableinterface or inherits from theAbstractOperandtype, then theOperandis also approved by invokingApprovable.approve()orAbstractOperand.approve()(which may trigger a registered lambda expression). - Throws:
ArgsSyntaxException- thrown in case of a command line arguments mismatch regarding provided and expected args.
-
getArgsSyntax
- Specified by:
getArgsSyntaxin interfaceArgsParser- Specified by:
getArgsSyntaxin interfaceArgsSyntaxAccessor- Returns:
- The (root)
Termstored by the (root)Termproperty.
-
getArgumentEscapeCode
Retrieves the argument Escape-Code from the argument Escape-Code property.- Specified by:
getArgumentEscapeCodein interfaceArgsParser- Specified by:
getArgumentEscapeCodein interfaceArgumentEscapeCodeAccessor- Returns:
- The argument Escape-Code stored by the argument Escape-Code property.
-
getBannerBorderEscapeCode
Retrieves the banner border Escape-Code from the banner border Escape-Code property.- Specified by:
getBannerBorderEscapeCodein interfaceArgsParser- Specified by:
getBannerBorderEscapeCodein interfaceBannerBorderEscapeCodeAccessor- Returns:
- The banner border Escape-Code stored by the banner border Escape-Code property.
-
getBannerEscapeCode
Retrieves the banner Escape-Code from the banner Escape-Code property.- Specified by:
getBannerEscapeCodein interfaceArgsParser- Specified by:
getBannerEscapeCodein interfaceBannerEscapeCodeAccessor- Returns:
- The banner Escape-Code stored by the banner Escape-Code property.
-
getBannerFont
- Specified by:
getBannerFontin interfaceBannerFontAccessor- Returns:
- The banner
Fontstored by the bannerFontproperty.
-
getBannerFontPalette
public char[] getBannerFontPalette()Retrieves the banner font palette from the banner font palette property.- Specified by:
getBannerFontPalettein interfaceBannerFontPaletteAccessor- Returns:
- The banner font palette stored by the banner font palette property.
-
getCommandEscapeCode
Retrieves the command Escape-Code from the command Escape-Code property.- Specified by:
getCommandEscapeCodein interfaceArgsParser- Specified by:
getCommandEscapeCodein interfaceCommandEscapeCodeAccessor- Returns:
- The command Escape-Code stored by the command Escape-Code property.
-
getConsoleWidth
public int getConsoleWidth()- Specified by:
getConsoleWidthin interfaceConsoleWidthAccessor
-
getCopyright
Retrieves the copyright from the copyright property.- Specified by:
getCopyrightin interfaceArgsParser- Specified by:
getCopyrightin interfaceCopyrightAccessor- Returns:
- The copyright stored by the copyright property.
-
getDescription
- Specified by:
getDescriptionin interfaceArgsParser- Specified by:
getDescriptionin interfaceDescriptionAccessor
-
getDescriptionEscapeCode
Retrieves the description Escape-Code from the description Escape-Code property.- Specified by:
getDescriptionEscapeCodein interfaceArgsParser- Specified by:
getDescriptionEscapeCodein interfaceDescriptionEscapeCodeAccessor- Returns:
- The description Escape-Code stored by the description Escape-Code property.
-
getExamples
- Specified by:
getExamplesin interfaceArgsParser- Specified by:
getExamplesin interfaceExamplesAccessor- Returns:
- The
Exampleinstances stored by theExampleinstances property.
-
getLicense
Retrieves the license from the license property.- Specified by:
getLicensein interfaceArgsParser- Specified by:
getLicensein interfaceLicenseAccessor- Returns:
- The license stored by the license property.
-
getLineBreak
- Specified by:
getLineBreakin interfaceLineBreakAccessor
-
getLineSeparatorEscapeCode
Retrieves the line separator Escape-Code from the line separator Escape-Code property.- Specified by:
getLineSeparatorEscapeCodein interfaceArgsParser- Specified by:
getLineSeparatorEscapeCodein interfaceLineSeparatorEscapeCodeAccessor- Returns:
- The line separator Escape-Code stored by the line separator Escape-Code property.
-
getLongOptionPrefix
Retrieves the long option prefix from the long option prefix property.- Specified by:
getLongOptionPrefixin interfaceLongOptionPrefixAccessor- Returns:
- The long option prefix stored by the long option prefix property.
-
getMaxConsoleWidth
public int getMaxConsoleWidth()- Specified by:
getMaxConsoleWidthin interfaceMaxConsoleWidthAccessor
-
getName
- Specified by:
getNamein interfaceNameAccessor
-
getKeywordEscapeCode
Retrieves the keyword (e.g. short- and long-options) Escape-Code from the option Escape-Code property.- Specified by:
getKeywordEscapeCodein interfaceArgsParser- Specified by:
getKeywordEscapeCodein interfaceKeywordEscapeCodeAccessor- Returns:
- The keyword (e.g. short- and long-options) Escape-Code stored by the option Escape-Code property.
-
getResetEscapeCode
- Specified by:
getResetEscapeCodein interfaceResetEscapeCodeAccessor
-
getSeparatorLnChar
public char getSeparatorLnChar()Gets the character to be used when printing a separator line with theArgsParser.printSeparatorLn()method.- Specified by:
getSeparatorLnCharin interfaceArgsParser- Returns:
- aSeparatorChar The character used by the
ArgsParser.printSeparatorLn()method when printing out the line of characters..
-
getShortOptionPrefix
Retrieves the short option prefix from the short option prefix property.- Specified by:
getShortOptionPrefixin interfaceShortOptionPrefixAccessor- Returns:
- The short option prefix stored by the short option prefix property.
-
getSyntaxMetrics
Retrieves theSyntaxMetricsfrom theSyntaxMetricsproperty.- Specified by:
getSyntaxMetricsin interfaceSyntaxMetricsAccessor- Returns:
- The
SyntaxMetricsstored by the decorator (enabled) tags property.
-
getTextBoxGrid
- Specified by:
getTextBoxGridin interfaceTextBoxGridAccessor
-
getTitle
- Specified by:
getTitlein interfaceTitleAccessor
-
isEscapeCodesEnabled
public boolean isEscapeCodesEnabled()- Specified by:
isEscapeCodesEnabledin interfaceEscapeCodesStatusAccessor
-
printBanner
public 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.- Specified by:
printBannerin interfaceArgsParser
-
printCopyright
public void printCopyright()Prints the copyright note as specified by theArgsParser.withCopyright(String)method; with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.- Specified by:
printCopyrightin interfaceArgsParser
-
printDescription
public void printDescription()Prints the description as set by theArgsParser.withDescription(String)method with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.- Specified by:
printDescriptionin interfaceArgsParser
-
printExamples
public void printExamples()Prints example usages as as added by theArgsParser.addExample(String, Operand...)method with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.- Specified by:
printExamplesin interfaceArgsParser
-
printHeader
public void printHeader()Prints the header, which might be a simplified banner: Can be used when overriding methods such asArgsParser.printHelp()orArgsParser.printBanner().- Specified by:
printHeaderin interfaceArgsParser
-
printLicense
public void printLicense()Prints the license note as specified by theArgsParser.withLicense(String)method; with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.- Specified by:
printLicensein interfaceArgsParser
-
printLn
public void printLn()Prints an empty line / a line break.- Specified by:
printLnin interfaceArgsParser
-
printLn
Prints the given line to standard out with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.- Specified by:
printLnin interfaceArgsParser- Parameters:
aLine- The line to be printed.
-
printOptions
public void printOptions()Prints theOptions (short- and the long-options), theFlages and theOperandand their description with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.- Specified by:
printOptionsin interfaceArgsParser
-
printSeparatorLn
public void printSeparatorLn()Prints a separator line using the separator character as specified by theArgsParser.withSeparatorLnChar(char)method; with regards to the console width as specified by theArgsParser.withConsoleWidth(int)method.- Specified by:
printSeparatorLnin interfaceArgsParser
-
printSynopsis
public void printSynopsis()Prints the syntax as retrieved by the rootConditionelement as ofSynopsisable.toSynopsis(SyntaxNotation)with regards to theSyntaxNotationset by theArgsParser.withSyntaxMetrics(SyntaxMetrics)method.- Specified by:
printSynopsisin interfaceArgsParser
-
reset
-
setArgsSyntax
- Specified by:
setArgsSyntaxin interfaceArgsSyntaxAccessor.ArgsSyntaxMutator- Parameters:
aArgsSyntax- The (root)Termto be stored by the (root)Termproperty.
-
setArgumentEscapeCode
Sets the argument Escape-Code for the argument Escape-Code property.- Specified by:
setArgumentEscapeCodein interfaceArgumentEscapeCodeAccessor.ArgumentEscapeCodeMutator- Parameters:
aParamEscapeCode- The argument Escape-Code to be stored by the argument Escape-Code property.
-
setBannerBorderEscapeCode
Sets the banner border Escape-Code for the banner border Escape-Code property.- Specified by:
setBannerBorderEscapeCodein interfaceBannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeMutator- Parameters:
aBannerBorderEscapeCode- The banner border Escape-Code to be stored by the banner border Escape-Code property.
-
setBannerEscapeCode
Sets the banner Escape-Code for the banner Escape-Code property.- Specified by:
setBannerEscapeCodein interfaceBannerEscapeCodeAccessor.BannerEscapeCodeMutator- Parameters:
aBannerEscapeCode- The banner Escape-Code to be stored by the banner Escape-Code property.
-
setBannerFont
- Specified by:
setBannerFontin interfaceBannerFontAccessor.BannerFontMutator- Parameters:
aBannerFont- The bannerFontto be stored by the bannerFontproperty.
-
setBannerFontPalette
Sets the banner font palette for the banner font palette property.- Specified by:
setBannerFontPalettein interfaceBannerFontPaletteAccessor.BannerFontPaletteMutator- Parameters:
aBannerFontPalette- The banner font palette to be stored by the banner palette property.
-
setBannerFontPalette
public void setBannerFontPalette(char[] aColorPalette) Sets the banner font palette for the banner font palette property.- Specified by:
setBannerFontPalettein interfaceBannerFontPaletteAccessor.BannerFontPaletteMutator- Parameters:
aColorPalette- The banner font palette to be stored by the banner palette property.
-
setCommandEscapeCode
Sets the command Escape-Code for the command Escape-Code property.- Specified by:
setCommandEscapeCodein interfaceCommandEscapeCodeAccessor.CommandEscapeCodeMutator- Parameters:
aCommandEscapeCode- The command Escape-Code to be stored by the command Escape-Code property.
-
setConsoleWidth
public void setConsoleWidth(int aConsoleWidth) - Specified by:
setConsoleWidthin interfaceConsoleWidthAccessor.ConsoleWidthMutator
-
setCopyright
Sets the copyright for the copyright property.- Specified by:
setCopyrightin interfaceCopyrightAccessor.CopyrightMutator- Parameters:
aCopyrightNote- The copyright to be stored by the console width property.
-
setDescription
- Specified by:
setDescriptionin interfaceDescriptionAccessor.DescriptionMutator
-
setDescriptionEscapeCode
Sets the description Escape-Code for the description Escape-Code property.- Specified by:
setDescriptionEscapeCodein interfaceDescriptionEscapeCodeAccessor.DescriptionEscapeCodeMutator- Parameters:
aDescriptionEscapeCode- 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).- Specified by:
setErrorOutin interfaceArgsParser- Parameters:
aErrorOut- The error outPrintStreamto set.
-
setEscapeCodesEnabled
public void setEscapeCodesEnabled(boolean isEscapeCodesEnabled) - Specified by:
setEscapeCodesEnabledin interfaceEscapeCodesStatusAccessor.EscapeCodeStatusMutator
-
setExamples
- Specified by:
setExamplesin interfaceExamplesAccessor.ExamplesMutator- Parameters:
aExamples- TheExampleinstances to be stored.
-
setLicense
Sets the license for the license property.- Specified by:
setLicensein interfaceLicenseAccessor.LicenseMutator- Parameters:
aLicenseNote- The license to be stored by the console width property.
-
setLineBreak
- Specified by:
setLineBreakin interfaceLineBreakAccessor.LineBreakMutator
-
setLineSeparatorEscapeCode
Sets the line separator Escape-Code for the line separator Escape-Code property.- Specified by:
setLineSeparatorEscapeCodein interfaceArgsParser- Specified by:
setLineSeparatorEscapeCodein interfaceLineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeMutator- Parameters:
aLineSeparatorEscapeCode- The line separator Escape-Code to be stored by the line separator Escape-Code property.
-
setLongOptionPrefix
Sets the long option prefix for the long option prefix property.- Specified by:
setLongOptionPrefixin interfaceLongOptionPrefixAccessor.LongOptionPrefixMutator- Parameters:
aLongOptionPrefix- The long option prefix to be stored by the long option prefix property.
-
setMaxConsoleWidth
public void setMaxConsoleWidth(int aMaxConsoleWidth) - Specified by:
setMaxConsoleWidthin interfaceMaxConsoleWidthAccessor.MaxConsoleWidthMutator
-
setName
- Specified by:
setNamein interfaceNameAccessor.NameMutator
-
setKeywordEscapeCode
Sets the keyword (e.g. short- and long-options) Escape-Code for the option Escape-Code property.- Specified by:
setKeywordEscapeCodein interfaceKeywordEscapeCodeAccessor.KeywordEscapeCodeMutator- Parameters:
aOptEscapeCode- The keyword (e.g. short- and long-options) Escape-Code to be stored by the option Escape-Code property.
-
setResetEscapeCode
- Specified by:
setResetEscapeCodein interfaceResetEscapeCodeAccessor.ResetEscapeCodeMutator
-
setSeparatorLnChar
public void setSeparatorLnChar(char aSeparatorLnChar) Set the character to be used when printing a separator line with theArgsParser.printSeparatorLn()method.- Specified by:
setSeparatorLnCharin interfaceArgsParser- Parameters:
aSeparatorLnChar- The character used by theArgsParser.printSeparatorLn()method when printing out the line of characters..
-
setShortOptionPrefix
Sets the short option prefix for the short option prefix property.- Specified by:
setShortOptionPrefixin interfaceShortOptionPrefixAccessor.ShortOptionPrefixMutator- Parameters:
aShortOptionPrefix- The short option prefix to be stored by the short option prefix property.
-
setStandardOut
Set the standard outPrintStreamand make other adjustments with the result (with regards to the Builder-Pattern).- Specified by:
setStandardOutin interfaceArgsParser- Parameters:
aStandardOut- The standard outPrintStreamto set.
-
setSyntaxMetrics
Sets theSyntaxMetricsfor theSyntaxMetricsproperty.- Specified by:
setSyntaxMetricsin interfaceArgsParser- Specified by:
setSyntaxMetricsin interfaceSyntaxMetricsAccessor.SyntaxMetricsMutator- Parameters:
aSyntaxMetrics- TheSyntaxMetricsto be stored by theSyntaxMetricsproperty.
-
setTextBoxGrid
- Specified by:
setTextBoxGridin interfaceTextBoxGridAccessor.TextBoxGridMutator
-
setTitle
- Specified by:
setTitlein interfaceTitleAccessor.TitleMutator
-
withAddExample
Builder method adding an application'sExampleelement.- Specified by:
withAddExamplein interfaceArgsParser- Specified by:
withAddExamplein interfaceArgsProcessorBuilder<ArgsParser>- Parameters:
aExamples- The application'sExampleelement to be added.- Returns:
- This builder as of the builder pattern.
-
withAddExample
Builder method adding an application'sExampleelement.- Specified by:
withAddExamplein interfaceArgsParser- Specified by:
withAddExamplein interfaceArgsProcessorBuilder<ArgsParser>- Parameters:
aDescription- The example's description.aOperands- The command line arguments required by the example.- Returns:
- This builder as of the builder pattern.
-
withArgsSyntax
- Specified by:
withArgsSyntaxin interfaceArgsSyntaxAccessor.ArgsSyntaxBuilder<ArgsParser>- Parameters:
aArgsSyntax- The (root)Termto be stored by the (root)Termproperty.- Returns:
- The builder for applying multiple build operations.
-
withArgumentEscapeCode
Sets the argument Escape-Code for the argument Escape-Code property.- Specified by:
withArgumentEscapeCodein interfaceArgsParser- Specified by:
withArgumentEscapeCodein interfaceArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<ArgsParser>- Parameters:
aParamEscCode- The argument Escape-Code to be stored by the argument Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withBannerBorderEscapeCode
Sets the banner border Escape-Code for the banner border Escape-Code property.- Specified by:
withBannerBorderEscapeCodein interfaceArgsParser- Specified by:
withBannerBorderEscapeCodein interfaceBannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeBuilder<ArgsParser>- 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 Escape-Code for the banner Escape-Code property.- Specified by:
withBannerEscapeCodein interfaceArgsParser- Specified by:
withBannerEscapeCodein interfaceBannerEscapeCodeAccessor.BannerEscapeCodeBuilder<ArgsParser>- Parameters:
aBannerEscCode- The banner Escape-Code to be stored by the banner Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withBannerFont
- Specified by:
withBannerFontin interfaceArgsParser- Specified by:
withBannerFontin interfaceBannerFontAccessor.BannerFontBuilder<ArgsParser>- Parameters:
aBannerFont- The bannerFontto be stored by the bannerFontproperty.- Returns:
- The builder for applying multiple build operations.
-
withBannerFontPalette
Sets the banner font palette for the banner font palette property.- Specified by:
withBannerFontPalettein interfaceBannerFontPaletteAccessor.BannerFontPaletteBuilder<ArgsParser>- Parameters:
aBannerFontPalette- The banner font palette to be stored by the banner palette property.- Returns:
- The builder for applying multiple build operations.
-
withBannerFontPalette
Sets the banner font palette for the banner font palette property.- Specified by:
withBannerFontPalettein interfaceArgsParser- Specified by:
withBannerFontPalettein interfaceBannerFontPaletteAccessor.BannerFontPaletteBuilder<ArgsParser>- Parameters:
aColorPalette- The banner font palette to be stored by the banner palette property.- Returns:
- The builder for applying multiple build operations.
-
withCommandEscapeCode
Sets the command Escape-Code for the command Escape-Code property.- Specified by:
withCommandEscapeCodein interfaceArgsParser- Specified by:
withCommandEscapeCodein interfaceCommandEscapeCodeAccessor.CommandEscapeCodeBuilder<ArgsParser>- Parameters:
aCommandEscCode- The command Escape-Code to be stored by the command Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withConsoleWidth
- Specified by:
withConsoleWidthin interfaceArgsParser- Specified by:
withConsoleWidthin interfaceConsoleWidthAccessor.ConsoleWidthBuilder<ArgsParser>
-
withCopyright
Sets the copyright for the copyright property.- Specified by:
withCopyrightin interfaceArgsParser- Specified by:
withCopyrightin interfaceCopyrightAccessor.CopyrightBuilder<ArgsParser>- Parameters:
aCopyright- The copyright to be stored by the console width property.- Returns:
- The builder for applying multiple build operations.
-
withDescription
- Specified by:
withDescriptionin interfaceArgsParser- Specified by:
withDescriptionin interfaceDescriptionAccessor.DescriptionBuilder<ArgsParser>
-
withDescriptionEscapeCode
Sets the description Escape-Code for the description Escape-Code property.- Specified by:
withDescriptionEscapeCodein interfaceArgsParser- Specified by:
withDescriptionEscapeCodein interfaceDescriptionEscapeCodeAccessor.DescriptionEscapeCodeBuilder<ArgsParser>- Parameters:
aDescriptionEscCode- The description Escape-Code to be stored by the 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).- Specified by:
withErrorOutin interfaceArgsParser- Specified by:
withErrorOutin interfaceArgsProcessorBuilder<ArgsParser>- Parameters:
aErrorOut- The error outPrintStreamto set.- Returns:
- This instance with regard to the builder pattern.
-
withEscapeCodesEnabled
- Specified by:
withEscapeCodesEnabledin interfaceArgsParser- Specified by:
withEscapeCodesEnabledin interfaceEscapeCodesStatusAccessor.EscapeCodeStatusBuilder<ArgsParser>
-
withEvalArgs
Evaluates the provided command line arguments .- Specified by:
withEvalArgsin interfaceArgsParser- Specified by:
withEvalArgsin interfaceArgsParserBuilder<ArgsParser>- Parameters:
aArgs- The command line arguments to be evaluated.- 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.
-
withEvalArgs
public CliArgsParser withEvalArgs(List<String> aArgs, ArgsFilter aArgsFilter) throws ArgsSyntaxException Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedArgsFilter.- Specified by:
withEvalArgsin interfaceArgsParserBuilder<ArgsParser>- 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.
-
withEvalArgs
public CliArgsParser withEvalArgs(List<String> aArgs, Pattern aFilterExp) throws ArgsSyntaxException Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedPattern.- Specified by:
withEvalArgsin interfaceArgsParserBuilder<ArgsParser>- 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.
-
withEvalArgs
Evaluates the provided command line arguments.- Specified by:
withEvalArgsin interfaceArgsParser- Specified by:
withEvalArgsin interfaceArgsParserBuilder<ArgsParser>- Parameters:
aArgs- The command line arguments to be evaluated.- 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.
-
withEvalArgs
public CliArgsParser withEvalArgs(String[] aArgs, ArgsFilter aArgsFilter) throws ArgsSyntaxException Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedArgsFilter.- Specified by:
withEvalArgsin interfaceArgsParserBuilder<ArgsParser>- 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.
-
withEvalArgs
Evaluates the provided command line arguments, filtering (excluding) the arguments matching the providedPattern.- Specified by:
withEvalArgsin interfaceArgsParserBuilder<ArgsParser>- 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.
-
withExamples
Builder method providing the application'sExampleelements.- Specified by:
withExamplesin interfaceArgsParser- Specified by:
withExamplesin interfaceExamplesAccessor.ExamplesBuilder<ArgsParser>- Parameters:
aExamples- The application'sExampleelements to use.- Returns:
- This builder as of the builder pattern.
-
withExamples
- Specified by:
withExamplesin interfaceArgsParser- Specified by:
withExamplesin interfaceExamplesAccessor.ExamplesBuilder<ArgsParser>- Parameters:
aExamples- TheExampleinstances to be stored.- Returns:
- The builder for applying multiple build operations.
-
withLicense
Sets the license for the license property.- Specified by:
withLicensein interfaceArgsParser- Specified by:
withLicensein interfaceLicenseAccessor.LicenseBuilder<ArgsParser>- Parameters:
aLicense- The license to be stored by the console width property.- Returns:
- The builder for applying multiple build operations.
-
withLineBreak
- Specified by:
withLineBreakin interfaceArgsParser- Specified by:
withLineBreakin interfaceLineBreakAccessor.LineBreakBuilder<ArgsParser>
-
withLineSeparatorEscapeCode
Sets the line separator Escape-Code for the line separator Escape-Code property.- Specified by:
withLineSeparatorEscapeCodein interfaceArgsParser- Specified by:
withLineSeparatorEscapeCodein interfaceLineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeBuilder<ArgsParser>- 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 interfaceArgsParser- 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
- Specified by:
withMaxConsoleWidthin interfaceArgsParser- Specified by:
withMaxConsoleWidthin interfaceMaxConsoleWidthAccessor.MaxConsoleWidthBuilder<ArgsParser>
-
withName
- Specified by:
withNamein interfaceArgsParser- Specified by:
withNamein interfaceNameAccessor.NameBuilder<ArgsParser>
-
withKeywordEscapeCode
Sets the keyword (e.g. short- and long-options) Escape-Code for the keyword Escape-Code property.- Specified by:
withKeywordEscapeCodein interfaceArgsParser- Specified by:
withKeywordEscapeCodein interfaceKeywordEscapeCodeAccessor.KeywordEscapeCodeBuilder<ArgsParser>- Parameters:
aOptEscCode- The keyword (e.g. short- and long-options) Escape-Code to be stored by the option Escape-Code property.- Returns:
- The builder for applying multiple build operations.
-
withResetEscapeCode
- Specified by:
withResetEscapeCodein interfaceArgsParser- Specified by:
withResetEscapeCodein interfaceResetEscapeCodeAccessor.ResetEscapeCodeBuilder<ArgsParser>
-
withSeparatorLnChar
Builder method adding an separator line char.- Specified by:
withSeparatorLnCharin interfaceArgsParser- Specified by:
withSeparatorLnCharin interfaceArgsProcessorBuilder<ArgsParser>- Parameters:
aSeparatorLnChar- THe according separator line char to use.- Returns:
- This builder as of the builder pattern.
-
withShortOptionPrefix
Sets the short option prefix for the short option prefix property.- Specified by:
withShortOptionPrefixin interfaceArgsParser- 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).- Specified by:
withStandardOutin interfaceArgsParser- Specified by:
withStandardOutin interfaceArgsProcessorBuilder<ArgsParser>- Parameters:
aStandardOut- The standard outPrintStreamto set.- Returns:
- This instance with regard to the builder pattern.
-
withSyntaxMetrics
Sets theSyntaxMetricsfor theSyntaxMetricsproperty.- Specified by:
withSyntaxMetricsin interfaceArgsParser- Specified by:
withSyntaxMetricsin interfaceSyntaxMetricsAccessor.SyntaxMetricsBuilder<ArgsParser>- Parameters:
aSyntaxMetrics- TheSyntaxMetricsto be stored by theSyntaxMetricsproperty.- Returns:
- The builder for applying multiple build operations.
-
withSyntaxMetrics
Sets theSyntaxNotationfor theSyntaxNotationproperty.- Specified by:
withSyntaxMetricsin interfaceSyntaxMetricsAccessor.SyntaxMetricsBuilder<ArgsParser>- Parameters:
aSyntaxNotation- TheSyntaxNotationto be stored by theSyntaxNotationproperty.- Returns:
- The builder for applying multiple build operations.
-
withTextBoxGrid
- Specified by:
withTextBoxGridin interfaceArgsParser- Specified by:
withTextBoxGridin interfaceTextBoxGridAccessor.TextBoxGridBuilder<ArgsParser>
-
withTextBoxGrid
- Specified by:
withTextBoxGridin interfaceArgsParser- Specified by:
withTextBoxGridin interfaceTextBoxGridAccessor.TextBoxGridBuilder<ArgsParser>
-
withTitle
- Specified by:
withTitlein interfaceArgsParser- Specified by:
withTitlein interfaceTitleAccessor.TitleBuilder<ArgsParser>
-
getDelimiter
protected char getDelimiter()The delimiter to be used for colliding command line args when creating non colliding arg's aliases (keys for key/value-pairs). Used when parsing args without any syntax definition.- Returns:
- The according delimiter for solving colliding command line args.
-