public class CommandLine extends Object
Modifier and Type | Field and Description |
---|---|
static Option<String> |
BIND
Default option for parsing -b
|
static Option<List<URL>> |
CONFIG |
static Option<String> |
CONFIG_HELP |
static Option<Boolean> |
HELP
Default option for parsing -h and --help
|
static Option<List<String>> |
PROFILES |
static Option<URL> |
PROPERTIES_URL
Default option for parsing -P
|
static Option<Properties> |
PROPERTY
Default option for parsing -Dname and -Dname=value
|
static Option<URL> |
SERVER_CONFIG
Default option for parsing -c and --server-config
|
static Option<Boolean> |
VERSION
Default option for parsing -v and --version
|
static Option<String> |
YAML_HELP |
Modifier and Type | Method and Description |
---|---|
void |
apply(Swarm swarm)
Apply properties and configuration from the parsed commandline to a container.
|
void |
applyConfigurations(Swarm swarm)
Apply configuration to the container.
|
void |
applyProperties(Swarm swarm)
Apply properties to the system properties.
|
static Options |
defaultOptions()
Default set of options
|
void |
displayConfigHelp(PrintStream out,
String fraction) |
void |
displayHelp(PrintStream out)
Display help for the options associated with the creation of this command-line.
|
void |
displayVersion(PrintStream out)
Display the version.
|
void |
dumpYaml(PrintStream out,
String fraction) |
List<String> |
extraArguments()
Any un-parsed non-option arguments.
|
String[] |
extraArgumentsArray()
Any un-parsed non-option arguments.
|
<T> T |
get(Option<T> key)
Retrieve a value under a given key.
|
boolean |
hasInvalidArguments()
Determine if any invalid arguments were seen during the parse.
|
List<String> |
invalidArguments()
Any invalid options seen during parsing.
|
static CommandLine |
parse(Options options,
String... args)
Parse an array of arguments using specific options.
|
static CommandLine |
parse(String... args)
Parse an array of arguments using the default options.
|
<T> void |
put(Option<T> key,
T value)
Put a value under a given key.
|
public static final Option<Properties> PROPERTY
public static final Option<URL> SERVER_CONFIG
public static Options defaultOptions()
public <T> void put(Option<T> key, T value)
T
- The type of the value.key
- The key.value
- The value.public <T> T get(Option<T> key)
T
- The type of the value.key
- The key.public void displayHelp(PrintStream out)
out
- The output stream to display help upon.public void displayConfigHelp(PrintStream out, String fraction) throws IOException, ModuleLoadException
IOException
ModuleLoadException
public void dumpYaml(PrintStream out, String fraction) throws IOException, ModuleLoadException
IOException
ModuleLoadException
public void displayVersion(PrintStream out)
out
- The output stream to display help upon.public void applyProperties(Swarm swarm) throws IOException
Applies values stored through the Key.PROPERTIES
,
Key.PROPERTIES_URL
or Key.BIND
options.
IOException
- If a URL is attempted to be read and fails.public void applyConfigurations(Swarm swarm) throws IOException
Applies configuration from Key.SERVER_CONFIG
and Key.STAGE_CONFIG
.
swarm
- Swarm instance to configure.MalformedURLException
- If a URL is attempted to be read and fails.IOException
public void apply(Swarm swarm) throws IOException, ModuleLoadException
swarm
- The Swarm instance to apply configuration to.IOException
- If an error occurs resolving any URL.ModuleLoadException
public List<String> extraArguments()
public String[] extraArgumentsArray()
public List<String> invalidArguments()
public boolean hasInvalidArguments()
true
if invalidArguments()
is not empty, otherwise false
.public static CommandLine parse(String... args) throws Exception
args
- The args to parse.CommandLine
.Exception
public static CommandLine parse(Options options, String... args) throws Exception
options
- The options to use.args
- The args to parse.CommandLine
.Exception
Copyright © 2018 JBoss by Red Hat. All rights reserved.