Package io.micronaut.core.cli
Interface CommandLine
public interface CommandLine
Represents the parsed command line options.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
CommandLine.Builder<T extends CommandLine.Builder>
A build for constructing a command line parser. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandLine.Builder
build()
Build and parse a new command line.String[]
boolean
optionValue
(String name) The value of an option.static CommandLine
Parse a new command line with the default options.Parses a newCommandLine
instance that combines this instance with the given arguments.
-
Method Details
-
getRemainingArgs
- Returns:
- The remaining arguments after the command name
-
getSystemProperties
Properties getSystemProperties()- Returns:
- The system properties specified
-
getOptions
- Returns:
- The declared option values
-
hasOption
- Parameters:
name
- The name of the option- Returns:
- Whether the given option is specified
-
optionValue
The value of an option.- Parameters:
name
- The option- Returns:
- The value
-
lastOption
- Returns:
- The last specified option
-
getRemainingArgsString
String getRemainingArgsString()- Returns:
- The remaining args as one big string
-
getRemainingArgsWithOptionsString
String getRemainingArgsWithOptionsString()- Returns:
- The remaining args as one big string without undeclared options
-
getUndeclaredOptions
- Returns:
- Any undeclared options
-
parseNew
Parses a newCommandLine
instance that combines this instance with the given arguments.- Parameters:
args
- The arguments- Returns:
- A new
CommandLine
instance
-
getRawArguments
String[] getRawArguments()- Returns:
- The raw unparsed arguments
-
build
Build and parse a new command line.- Returns:
- The builder
-
parse
Parse a new command line with the default options.- Parameters:
args
- The arguments- Returns:
- The command line
-