Module org.refcodes.cli
Package org.refcodes.cli
package org.refcodes.cli
This artifact defines some helpful toolkit to parse your command line
arguments (as passed to your
public static void main( String[] args) { ... } method. It lets
you define the exact valid combinations of command line arguments, it parses
them arguments for you and it lets you print the syntax as you
programmatically defined it. Let's get started!
Please refer to the refcodes-cli: Parse your args[] documentation for an up-to-date and detailed description on the usage of this artifact.
-
ClassDescriptionThe
AbstractConditionis an abstract implementation of theConditioninterface providing the boiler plate when implementing theConditioninterface as done by theAbstractCondition's sub-classes.TheAbstractOperandis an abstract implementation of anOperandproviding the boiler plate when implementing theOperandinterface.TheAbstractOptionis an abstract implementation of anOptionproviding the boiler plate when implementing theOptioninterface.TheAllConditionenforces that the encapsulatedConstituentconsumes all arguments passed via invoking itsConstituent.parseArgs(String[], CliContext), else aSuperfluousArgsExceptionis thrown.Thrown in case the command line arguments do not match the required syntax.AnAndConditioncontains (represents) a list ofCondition(Constituent) instances (nested by theAndCondition) of which all are to be parsed successfully as of invoking theConstituent.parseArgs(String[], String[], CliContext)methods.Any of the nestedConditionconditions may match for theAnyConditionto match, e.g. all of the nested conditions are optional.Provides an accessor for a command line arguments (short "args") array.Provides a mutator for a args property.Provides a args property.Enumeration declaring command line argument filter.TheArgsParserprovides means for parsing command line arguments and constructing a command line utility's help output.Provides an accessor for aArgsParserproperty.Provides a builder method for aArgsParserproperty returning the builder for applying multiple build operations.Provides a mutator for aArgsParserproperty.Provides aArgsParserproperty.A straightforward implementation of theArgsParserinterface.ArgsParserMixin<B extends ArgsParserMixin<B>>This mixin provides builder additions (as of the builder pattern for chained configuring method calls) for parsing command line arguments.Provides an accessor for a root condition property.Provides a builder method for a root condition property returning the builder for applying multiple build operations.Provides a mutator for a root condition property.Provides a root condition property.Thrown in case of a command line arguments mismatch regarding provided and expected args.Provides an accessor for a argument Escape-Code property.ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<B extends ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<B>>Provides a builder method for a argument Escape-Code property returning the builder for applying multiple build operations.Provides a mutator for a argument Escape-Code property.Provides a argument Escape-Code property.Provides an accessor for an argument prefix property.ArgumentPrefixAccessor.ArgumentPrefixBuilder<B extends ArgumentPrefixAccessor.ArgumentPrefixBuilder<B>>Provides a builder method for an argument prefix property returning the builder for applying multiple build operations.Provides a mutator for an argument prefix property.Provides an argument prefix property.Provides an accessor for an argument suffix property.ArgumentSuffixAccessor.ArgumentSuffixBuilder<B extends ArgumentSuffixAccessor.ArgumentSuffixBuilder<B>>Provides a builder method for an argument suffix property returning the builder for applying multiple build operations.Provides a mutator for an argument suffix property.Provides an argument suffix property.ArrayOperand<T>Creates an array representation facade for the encapsulatedOperand.ArrayOption<T>Creates an array representation facade for the encapsulatedOption.TheCasesConditionis anXorConditionmaking sure that all possible cases inside theXorConditionmust(!)A predefined cleanFlag: A predefinedFlaggives itsCleanFlag.SHORT_OPTION, itsCleanFlag.LONG_OPTIONas well as itsCleanFlag.ALIASan according semantics regarded by other subsystems.TheCliContextdescribes the context in which anArgsParseris running.Builder to buildSyntaxMetricsAccessor.SyntaxMetricsBuilderinstances.Provides an accessor for aCliContextproperty.Provides a builder method for aCliContextproperty returning the builder for applying multiple build operations.Provides a mutator for aCliContextproperty.Provides aCliContextproperty.Base exception for the console artifact.This abstract exception is the base exception for all command line argument related exceptions.The Class ConsoleCliException.TheCliMetricsdefine the attributes required to parse aConstituenttree's syntax by anArgsParser.The purpose of aCliSchemais automatically generate documentation ofConstituentstructures.This utility class provides method useful for the refcodes-cli artifact and whose implementation has been motivated by the implementation of the refcodes-cli artifact.TheConditioninterface represents a node (and therewith the syntax for the arguments) in the command line arguments syntax tree; simply extending theConstituentinterface and adding the functionality of providing access to the addedOperands (leafs).TheConfigOptionrepresents anOptionholding a value specifying a configuration resource (file).AConstituentdefines the methods at least required when building a command line arguments syntax tree for traversing the syntax tree; either for parsing command line arguments or for constructing the command line arguments syntax.A predefined daemonFlag: A predefinedFlaggives itsDaemonFlag.SHORT_OPTION, itsDaemonFlag.LONG_OPTIONas well as itsDaemonFlag.ALIASan according semantics regarded by other subsystems.A predefined debugFlag: A predefinedFlaggives itsDebugFlag.SHORT_OPTION, itsDebugFlag.LONG_OPTIONas well as itsDebugFlag.ALIASan according semantics regarded by other subsystems.EnumOption<T extends Enum<T>>TheEnumOptionrepresents anOptionof enumeration types.An example usage item describing a usage scenario.TheFlagclass implements theOptioninterface for representing either atrueor afalsestate: When a flag is provided to your command line arguments, then it is considered to betrue, when it is omitted, then it is considered to befalseas ofFlag.isEnabled().A predefined forceFlag: A predefinedFlaggives itsForceFlag.SHORT_OPTION, itsForceFlag.LONG_OPTIONas well as itsForceFlag.ALIASan according semantics regarded by other subsystems.A predefined helpFlag: A predefinedFlaggives itsHelpFlag.SHORT_OPTION, itsHelpFlag.LONG_OPTIONas well as itsHelpFlag.ALIASan according semantics regarded by other subsystems.A predefined initFlag: A predefinedFlaggives itsInitFlag.SHORT_OPTION, itsInitFlag.LONG_OPTIONas well as itsInitFlag.ALIASan according semantics regarded by other subsystems.Provides an accessor for a long option prefix property.LongOptionPrefixAccessor.LongOptionPrefixBuilder<B extends LongOptionPrefixAccessor.LongOptionPrefixBuilder<B>>Provides a builder method for a long option prefix property returning the builder for applying multiple build operations.Provides a mutator for a long option prefix property.Provides a long option prefix property.TheNoneOperandrepresents an empty set of arguments, e.g. no command line argument is being passed.Operand<T>AnOperandrepresents a value parsed from command line arguments.TheOperationis an argument representing a function or a method ("command") and is either provided or not provided as ofOperation.isEnabled().Option<T>AnOptionrepresents a command line option with the according option's value.Provides means to determine context specific information onOptioninstances.Provides an accessor for a option Escape-Code property.OptionEscapeCodeAccessor.OptionEscapeCodeBuilder<B extends OptionEscapeCodeAccessor.OptionEscapeCodeBuilder<B>>Provides a builder method for a option Escape-Code property returning the builder for applying multiple build operations.Provides a mutator for a option Escape-Code property.Provides a option Escape-Code property.AnOrConditionrepresents a list ofCondition(Constituent) instances of which at least one must be parsed successfully when theConstituents'Constituent.parseArgs(String[], String[], CliContext)methods are invoked.Thrown in case the provided command line arguments do not respect the required semantics or cannot be converted to the required type.A predefined "be quiet"Flag: A predefinedFlaggives itsQuietFlag.SHORT_OPTION, itsQuietFlag.LONG_OPTIONas well as itsQuietFlag.ALIASan according semantics regarded by other subsystems.Provides an accessor for a short option prefix property.ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<B extends ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<B>>Provides a builder method for a short option prefix property returning the builder for applying multiple build operations.Provides a mutator for a short option prefix property.Provides a short option prefix property.Thrown in case there were arguments found not being used (superfluous arguments).TheSynopsisableinterface defines those methods required to create a human readable usageStringsimilar to a manpage's synopsis from the implementing instance.TheSyntaxMetricsprovides properties specific to a specific command line syntax notation.Provides an accessor for aSyntaxMetricsproperty.Provides a builder method for aSyntaxMetricsproperty returning the builder for applying multiple build operations.Provides a mutator for aSyntaxMetricsproperty.Provides aSyntaxMetricsproperty.TheSyntaxMetricsImplclass implements theSyntaxMetricsinterface for building customSyntaxMetricsinstances.Builder to buildSyntaxMetricsinstances.TheSyntaxNotationis used by a theConstituent.toSyntax(CliContext)method to determine which notation to be used for the generated syntax.A predefined system informationFlag: A predefinedFlaggives itsSysInfoFlag.SHORT_OPTION, itsSysInfoFlag.LONG_OPTIONas well as itsSysInfoFlag.ALIASan according semantics regarded by other subsystems..Thrown in case command line arguments were not processed (did not match the expected arguments), e.g. the arguments were rejected as them did not work for the according syntax.A predefined verboseFlag: A predefinedFlaggives itsVerboseFlag.SHORT_OPTION, itsVerboseFlag.LONG_OPTIONas well as itsVerboseFlag.ALIASan according semantics regarded by other subsystems.AnXorConditionrepresents a list ofCondition(Constituent) instances of which only one is allowed to be parsed successfully when theConstituent.parseArgs(String[], String[], CliContext)methods are invoked.