The name of the application that is to be configured via flags
If true, GlobalFlags will be included during flag parsing. If false, only flags defined in the application itself will be consulted.
Add a flag.
Add a flag. The canonical way to do so is via Flags#apply
, but this
method is left public for any rare edge cases where it is necessary.
A concrete Flag to add
Add a named flag with a help message.
Add a named flag with a help message.
The name of the flag.
The help string of the flag.
Add a named flag with a default value and a help message.
Add a named flag with a default value and a help message.
The name of the flag.
A default value, as a thunk.
The help string of the flag.
A Java-friendly method for adding named flags.
A Java-friendly method for adding named flags.
The name of the flag.
A default value.
The help string of the flag.
A Java-friendly way to create mandatory flags
A Java-friendly way to create mandatory flags
the name passed on the command-line
the help text explaining the purpose of the flag
a string describing the type of the flag, i.e.: Integer
Formats all values of all flags known to this instance into a format suitable for logging.
Formats all values of all flags known to this instance into a format suitable for logging.
See getAll
above.
See getAll
above.
All of the flag values in alphabetical order, grouped into (set, unset).
Creates a string containing all values of all flags known to this instance into a format suitable for logging.
Creates a string containing all values of all flags known to this instance into a format suitable for logging.
See getAll
above.
Set getAll
above
A string suitable for logging.
Get all of the flags known to this Flags instance.
Get all of the flags known to this Flags instance.
If true, all registered
GlobalFlags will be included
in output. Defaults to the includeGlobal
settings of this instance.
The java.lang.ClassLoader used to fetch GlobalFlags, if necessary. Defaults to this instance's classloader.
All of the flags known to this this Flags instance.
Parse an array of flag strings.
Parse an array of flag strings.
The array of strings to parse.
If true, undefined flags (i.e. those that are
not defined in the application via a flag.apply
invocation) are allowed.
If false, undefined flags will result in a FlagParseException being thrown.
A com.twitter.app.Flags.FlagParseResult representing the
result of parsing args
.
Parse an array of flag strings or exit the application (with exit code 1) upon failure to do so.
Parse an array of flag strings or exit the application (with exit code 1) upon failure to do so.
The array of strings to parse.
If true, undefined flags (i.e. those that are not defined
in the application via a flag.apply
invocation) are allowed. If false,
undefined flags will result in a FlagParseException being thrown.
Set the flags' command usage; this is a message printed before the flag definitions in the usage string.
Parse an array of flag strings.
Parse an array of flag strings.
The array of strings to parse.
If true, undefined flags (i.e. those that are not defined
in the application via a flag.apply
invocation) are allowed. If false,
undefined flags will result in a FlagParseException being thrown.
(Since version 6.17.1) Prefer result-value based Flags.parseArgs
method
FlagParseException
if an error occurs during flag-parsing.
This method has been deprecated in favor of Flags.parseArgs
,
which indicates success or failure by returning
com.twitter.app.Flags.FlagParseResult rather than relying on thrown
exceptions.
A simple flags implementation. We support only two formats:
for flags with optional values (e.g. booleans): -flag, -flag=value for flags with required values: -flag[= ]value
That's it. These can be parsed without ambiguity.
There is no support for mandatory arguments: That is not what flags are for.
Flags.apply
adds a new flag to the flag set, so it is idiomatic to assign instances ofFlags
to a singularflag
val:Global flags, detached from a particular
Flags
instance but accessible to all, are defined by com.twitter.app.GlobalFlag.