public class AppConfig extends JSAP
--config-file
option.
Through the --config-file
option, Appconfig
will append the contents of the configuration file to the given arguments.
A configuration file is essentially a text file with the command line arguments. These arguments can be separated across multiple lines and there can be comments (lines prefixed with the #
character).
An example configuration file:
# set the lambdas
--lambda 5,6,7
# verbose settings
--verbose
JSAP}
BIGDECIMAL_PARSER, BIGINTEGER_PARSER, BOOLEAN_PARSER, BYTE_PARSER, CHARACTER_PARSER, CLASS_PARSER, COLOR_PARSER, DEFAULT_LISTSEPARATOR, DEFAULT_PARAM_HELP_SEPARATOR, DEFAULT_SCREENWIDTH, DOUBLE_PARSER, FLOAT_PARSER, GREEDY, INETADDRESS_PARSER, INTEGER_PARSER, INTSIZE_PARSER, LIST, LONG_PARSER, LONGSIZE_PARSER, MULTIPLEDECLARATIONS, NO_DEFAULT, NO_HELP, NO_LONGFLAG, NO_MULTIPLEDECLARATIONS, NO_SHORTFLAG, NOT_GREEDY, NOT_LIST, NOT_REQUIRED, PACKAGE_PARSER, REQUIRED, SHORT_PARSER, STRING_PARSER, URL_PARSER
Constructor and Description |
---|
AppConfig(java.lang.String name,
java.lang.String description)
Creates a new application configuration whose name is
name and a short description about the application. |
AppConfig(java.lang.String name,
java.lang.String description,
boolean enableConfigFile)
Creates a new application configuration whose name is
name and a short description about the application. |
AppConfig(java.lang.String name,
java.lang.String description,
boolean enableConfigFile,
boolean addHelpArgument)
Creates a new application configuration whose name is
name and a short description about the application. |
Modifier and Type | Method and Description |
---|---|
void |
displayHelp(JSAPResult result)
Displays errors that occurred during parsing of command line argument.
|
void |
displayUsage()
Displays usage information for this application.
|
JSAPResult |
parse(java.lang.String cmdLine)
Overloads
JSAP.parse(String) by providing help messages, and more importantly, checking and loading configuration settings from file automatically. |
finalize, getByID, getByLongFlag, getByShortFlag, getByShortFlag, getDefaults, getHelp, getHelp, getHelp, getIDMap, getUnflaggedOptionsIterator, getUsage, parse, registerDefaultSource, registerParameter, setHelp, setUsage, toString, unregisterDefaultSource, unregisterParameter
public AppConfig(java.lang.String name, java.lang.String description)
name
and a short description about the application.
The -h/--help
option is enabled and --config-file
is disabled by default.
name
- name of applicationdescription
- short description of app.public AppConfig(java.lang.String name, java.lang.String description, boolean enableConfigFile)
name
and a short description about the application.
The -h/--help
option is enabled by default.
name
- name of applicationdescription
- short description of app.enableConfigFile
- enable the use of a --config-file
option where default settings are loaded frompublic AppConfig(java.lang.String name, java.lang.String description, boolean enableConfigFile, boolean addHelpArgument)
name
and a short description about the application.name
- name of applicationdescription
- short description of app.enableConfigFile
- enable the use of a -c/--config-file option where default settings are loaded fromaddHelpArgument
- enable the use of a -h/--help flagpublic JSAPResult parse(java.lang.String cmdLine)
JSAP.parse(String)
by providing help messages, and more importantly, checking and loading configuration settings from file automatically.public void displayHelp(JSAPResult result)
result
- display error messages from this JSAPResult
object.public void displayUsage()