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
AbstractCondition
is an abstract implementation of theCondition
interface providing the boiler plate when implementing theCondition
interface as done by theAbstractCondition
's sub-classes.TheAbstractOperand
is an abstract implementation of anOperand
providing the boiler plate when implementing theOperand
interface.TheAbstractOption
is an abstract implementation of anOption
providing the boiler plate when implementing theOption
interface.TheAbstractPropertyOption
is an abstract implementation of aPropertyOption
providing the boiler plate when implementing thePropertyOption
interface.TheAllCondition
enforces that the encapsulatedTerm
consumes all arguments passed via invoking itsTerm.parseArgs(String[], CliContext)
, else aSuperfluousArgsException
is thrown.Thrown in case the command line arguments do not match the required syntax.AnAndCondition
contains (represents) a list ofCondition
(Term
) instances (nested by theAndCondition
) of which all are to be parsed successfully as of invoking theTerm.parseArgs(String[], String[], CliContext)
methods.Any of the nestedCondition
conditions may match for theAnyCondition
to 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.A straightforward implementation of theParseArgs
interface.Provides an accessor for aParseArgs
property.Provides a builder method for aParseArgs
property returning the builder for applying multiple build operations.Provides a mutator for aParseArgs
property.Provides aParseArgs
property.ArgsParserBuilder<B extends ArgsParserBuilder<B>>This mixin provides builder additions (as of the builder pattern for chained configuring method calls) for parsing command line arguments.ArgsProcessorBuilder<B extends ArgsProcessorBuilder<B>>TheArgsProcessorBuilder
provides common minimum builder functionality required by to build an argument processing instance.ArgsProvidierBuilder<B extends ArgsProvidierBuilder<B>>TheArgsProvidierBuilder
interface provides builder methods for feeding command line arguments.Provides an accessor for a (root)Term
property.Provides a builder method for a (root)Term
property returning the builder for applying multiple build operations.Provides a mutator for a (root)Term
property.Provides a (root)Term
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
.Provides an accessor for a banner border Escape-Code property.BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeBuilder<B extends BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeBuilder<B>>Provides a builder method for a banner border Escape-Code property returning the builder for applying multiple build operations.Provides a mutator for a banner border Escape-Code property.Provides a banner border Escape-Code property.Provides an accessor for a banner Escape-Code property.BannerEscapeCodeAccessor.BannerEscapeCodeBuilder<B extends BannerEscapeCodeAccessor.BannerEscapeCodeBuilder<B>>Provides a builder method for a banner Escape-Code property returning the builder for applying multiple build operations.Provides a mutator for a banner Escape-Code property.Provides a banner Escape-Code property.Provides an accessor for a bannerFont
property.Provides a builder method for a bannerFont
property returning the builder for applying multiple build operations.Provides a mutator for a bannerFont
property.Provides a bannerFont
property.Provides an accessor for a banner font palette property.BannerFontPaletteAccessor.BannerFontPaletteBuilder<B extends BannerFontPaletteAccessor.BannerFontPaletteBuilder<B>>Provides a builder method for a banner font palette property returning the builder for applying multiple build operations.Provides a mutator for a banner font palette property.Provides a banner font palette property.TheCasesCondition
is anXorCondition
making sure that all possible cases inside theXorCondition
must(!)A predefined cleanFlag
: A predefinedFlag
gives itsCleanFlag.SHORT_OPTION
, itsCleanFlag.LONG_OPTION
as well as itsCleanFlag.ALIAS
an according semantics regarded by other subsystems.TheCliContext
describes the context in which anParseArgs
is running.Builder to buildSyntaxMetricsAccessor.SyntaxMetricsBuilder
instances.Provides an accessor for aCliContext
property.Provides a builder method for aCliContext
property returning the builder for applying multiple build operations.Provides a mutator for aCliContext
property.Provides aCliContext
property.Base exception for the console artifact.This abstract exception is the base exception for all command line argument related exceptions.The Class ConsoleCliException.Provides an accessor for a command Escape-Code property.CommandEscapeCodeAccessor.CommandEscapeCodeBuilder<B extends CommandEscapeCodeAccessor.CommandEscapeCodeBuilder<B>>Provides a builder method for a command Escape-Code property returning the builder for applying multiple build operations.Provides a mutator for a command Escape-Code property.Provides a command Escape-Code property.TheConfigOption
represents anOption
holding a value specifying a configuration resource (file).TheConfigProperty
represents anPropertyOption
holding a value specifying a configuration resource (file).Provides an accessor for a copyright property.Provides a builder method for a copyright property returning the builder for applying multiple build operations.Provides a mutator for a copyright property.Provides a copyright property.A predefined daemonFlag
: A predefinedFlag
gives itsDaemonFlag.SHORT_OPTION
, itsDaemonFlag.LONG_OPTION
as well as itsDaemonFlag.ALIAS
an according semantics regarded by other subsystems.A predefined debugFlag
: A predefinedFlag
gives itsDebugFlag.SHORT_OPTION
, itsDebugFlag.LONG_OPTION
as well as itsDebugFlag.ALIAS
an according semantics regarded by other subsystems.Provides an accessor for a description Escape-Code property.DescriptionEscapeCodeAccessor.DescriptionEscapeCodeBuilder<B extends DescriptionEscapeCodeAccessor.DescriptionEscapeCodeBuilder<B>>Provides a builder method for a description Escape-Code property returning the builder for applying multiple build operations.Provides a mutator for a description Escape-Code property.Provides a description Escape-Code property.EnumOption<T extends Enum<T>>TheEnumOption
represents anOption
of enumeration types.EnumProperty<T extends Enum<T>>TheEnumProperty
represents anPropertyOption
of enumeration types.An example usage item describing a usage scenario.Provides an accessor for anExample
instances property.Provides a builder method for anExample
instances property returning the builder for applying multiple build operations.Provides a mutator for anExample
instances property.Provides anExample
instances property.TheFlag
class implements theOption
interface for representing either atrue
or afalse
state: 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 befalse
as ofFlag.isEnabled()
.A predefined forceFlag
: A predefinedFlag
gives itsForceFlag.SHORT_OPTION
, itsForceFlag.LONG_OPTION
as well as itsForceFlag.ALIAS
an according semantics regarded by other subsystems.A predefined helpFlag
: A predefinedFlag
gives itsHelpFlag.SHORT_OPTION
, itsHelpFlag.LONG_OPTION
as well as itsHelpFlag.ALIAS
an according semantics regarded by other subsystems.A predefined initFlag
: A predefinedFlag
gives itsInitFlag.SHORT_OPTION
, itsInitFlag.LONG_OPTION
as well as itsInitFlag.ALIAS
an according semantics regarded by other subsystems.Provides an accessor for a license property.LicenseAccessor.LicenseBuilder<B extends LicenseAccessor.LicenseBuilder<B>>Provides a builder method for a license property returning the builder for applying multiple build operations.Provides a mutator for a license property.Provides a license property.Provides an accessor for a line separator Escape-Code property.LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeBuilder<B extends LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeBuilder<B>>Provides a builder method for a line separator Escape-Code property returning the builder for applying multiple build operations.Provides a mutator for a line separator Escape-Code property.Provides a line separator Escape-Code property.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.Provides an accessor for a long option prefix property.LongPropertyPrefixAccessor.LongPropertyPrefixBuilder<B extends LongPropertyPrefixAccessor.LongPropertyPrefixBuilder<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.Provides an accessor for a match-count property.Provides a builder method for a match-count property returning the builder for applying multiple build operations.Provides a mutator for a match-count property.Provides a match-count property.TheNoneOperand
represents an empty set of arguments, e.g. no command line argument is being passed.Operand<T>AnOperand
represents a value parsed from command line arguments.TheOperation
is an argument representing a function or a method ("command") and is either provided or not provided as ofOperation.isEnabled()
.Option<T>AnOption
represents a command line option with the according option's value.Provides means to determine context specific information onOption
instances.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.AnOrCondition
represents a list ofCondition
(Term
) instances of which at least one must be parsed successfully when theTerm
s'Term.parseArgs(String[], String[], CliContext)
methods are invoked.TheParseArgs
provides means for parsing command line arguments and constructing a command line utility's help output.Thrown in case the provided command line arguments do not respect the required semantics or cannot be converted to the required type.Provides an accessor for a option Escape-Code property.PropertyEscapeCodeAccessor.PropertyEscapeCodeBuilder<B extends PropertyEscapeCodeAccessor.PropertyEscapeCodeBuilder<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.AnPropertyOption
represents a command line property with the according porperty's key and value.A predefined "be quiet"Flag
: A predefinedFlag
gives itsQuietFlag.SHORT_OPTION
, itsQuietFlag.LONG_OPTION
as well as itsQuietFlag.ALIAS
an 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.Provides an accessor for a short option prefix property.ShortPropertyPrefixAccessor.ShortPropertyPrefixBuilder<B extends ShortPropertyPrefixAccessor.ShortPropertyPrefixBuilder<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).TheSynopsisable
interface defines those methods required to create a human readable usageString
similar to a manpage's synopsis from the implementing instance.TheSyntaxMetrics
provides properties specific to a specific command line syntax notation.Provides an accessor for aSyntaxMetrics
property.Provides a builder method for aSyntaxMetrics
property returning the builder for applying multiple build operations.Provides a mutator for aSyntaxMetrics
property.Provides aSyntaxMetrics
property.TheSyntaxMetricsImpl
class implements theSyntaxMetrics
interface for building customSyntaxMetrics
instances.Builder to buildSyntaxMetrics
instances.TheSyntaxNotation
is used by a theTerm.toSyntax(CliContext)
method to determine which notation to be used for the generated syntax.A predefined system informationFlag
: A predefinedFlag
gives itsSysInfoFlag.SHORT_OPTION
, itsSysInfoFlag.LONG_OPTION
as well as itsSysInfoFlag.ALIAS
an according semantics regarded by other subsystems..ATerm
defines 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.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 predefinedFlag
gives itsVerboseFlag.SHORT_OPTION
, itsVerboseFlag.LONG_OPTION
as well as itsVerboseFlag.ALIAS
an according semantics regarded by other subsystems.AnXorCondition
represents a list ofCondition
(Term
) instances of which only one is allowed to be parsed successfully when theTerm.parseArgs(String[], String[], CliContext)
methods are invoked.