Package ortus.boxlang.runtime.config
Record Class CLIOptions
java.lang.Object
java.lang.Record
ortus.boxlang.runtime.config.CLIOptions
- Record Components:
templatePath
- The path to the template to execute. Can be a class or template. Mutally exclusive with codedebug
- Whether or not to run in debug mode. It can be `null` if not specifiedcode
- The source code to execute, if anyconfigFile
- The path to the config file to useprintAST
- Whether or not to print the AST of the source codetranspile
- Whether or not to transpile the source code to JavaruntimeHome
- The path to the runtime homeshowVersion
- Whether or not to show the version of the runtimecliArgs
- The arguments to pass to the template or classcliArgsRaw
- The raw arguments passed to the CLItargetModule
- The module to executeactionCommand
- The action command to execute
public record CLIOptions(String templatePath, Boolean debug, String code, String configFile, Boolean printAST, Boolean transpile, String runtimeHome, Boolean showVersion, List<String> cliArgs, String[] cliArgsRaw, String targetModule, String actionCommand)
extends Record
Command-line options for the BoxLang runtime.
-
Constructor Summary
ConstructorsConstructorDescriptionCLIOptions
(String templatePath, Boolean debug, String code, String configFile, Boolean printAST, Boolean transpile, String runtimeHome, Boolean showVersion, List<String> cliArgs, String[] cliArgsRaw, String targetModule, String actionCommand) Creates an instance of aCLIOptions
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theactionCommand
record component.cliArgs()
Returns the value of thecliArgs
record component.String[]
Returns the value of thecliArgsRaw
record component.code()
Returns the value of thecode
record component.Returns the value of theconfigFile
record component.debug()
Returns the value of thedebug
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Wether or not this is an action command: Ex:boxlang compile
boolean
Verifies if debug mode was enabledQuick parser for options on cli arguments for BoxLangprintAST()
Returns the value of theprintAST
record component.Returns the value of theruntimeHome
record component.Returns the value of theshowVersion
record component.Returns the value of thetargetModule
record component.Returns the value of thetemplatePath
record component.final String
toString()
Returns a string representation of this record class.toStruct()
Get the state representation of this recordReturns the value of thetranspile
record component.
-
Constructor Details
-
CLIOptions
public CLIOptions(String templatePath, Boolean debug, String code, String configFile, Boolean printAST, Boolean transpile, String runtimeHome, Boolean showVersion, List<String> cliArgs, String[] cliArgsRaw, String targetModule, String actionCommand) Creates an instance of aCLIOptions
record class.- Parameters:
templatePath
- the value for thetemplatePath
record componentdebug
- the value for thedebug
record componentcode
- the value for thecode
record componentconfigFile
- the value for theconfigFile
record componentprintAST
- the value for theprintAST
record componenttranspile
- the value for thetranspile
record componentruntimeHome
- the value for theruntimeHome
record componentshowVersion
- the value for theshowVersion
record componentcliArgs
- the value for thecliArgs
record componentcliArgsRaw
- the value for thecliArgsRaw
record componenttargetModule
- the value for thetargetModule
record componentactionCommand
- the value for theactionCommand
record component
-
-
Method Details
-
isActionCommand
Wether or not this is an action command: Ex:boxlang compile
- Returns:
- True if it is an action command, false otherwise
-
isDebugMode
public boolean isDebugMode()Verifies if debug mode was enabled- Returns:
- True if debug mode is enabled, false otherwise
-
parseArguments
Quick parser for options on cli arguments for BoxLangThis method will parse the cli arguments and return a struct of the following:
options
- A struct of the optionspositionals
- An array of the positional arguments
The options can be provided in the following formats:
--option
- A boolean option--option=value
- An option with a value--option="value"
- An option with a quoted value--option='value'
- An option with a quoted value-o=value
- A shorthand option with a value-o
- A shorthand boolean option--!option
- A negation option
For example, the following cli arguments:
--debug --!verbose --bundles=Spec -o='/path/to/file' -v my/path/template
Will be parsed into the following struct:
{ "options" : { "debug": true, "verbose": false, "bundles": "Spec", "o": "/path/to/file", "v": true }, "positionals": [ "my/path/template" ]
Some Ground Rules
- Options are prefixed with --
- Shorthand options are prefixed with -
- Options can be negated with --! or --no-
- Options can have values separated by =
- Values can be quoted with single or double quotes
- Repeated options will override the previous value
- Returns:
- A struct of the options and positional arguments
-
toStruct
Get the state representation of this record- Returns:
- The state representation of this record as a struct
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
templatePath
Returns the value of thetemplatePath
record component.- Returns:
- the value of the
templatePath
record component
-
debug
Returns the value of thedebug
record component.- Returns:
- the value of the
debug
record component
-
code
Returns the value of thecode
record component.- Returns:
- the value of the
code
record component
-
configFile
Returns the value of theconfigFile
record component.- Returns:
- the value of the
configFile
record component
-
printAST
Returns the value of theprintAST
record component.- Returns:
- the value of the
printAST
record component
-
transpile
Returns the value of thetranspile
record component.- Returns:
- the value of the
transpile
record component
-
runtimeHome
Returns the value of theruntimeHome
record component.- Returns:
- the value of the
runtimeHome
record component
-
showVersion
Returns the value of theshowVersion
record component.- Returns:
- the value of the
showVersion
record component
-
cliArgs
Returns the value of thecliArgs
record component.- Returns:
- the value of the
cliArgs
record component
-
cliArgsRaw
Returns the value of thecliArgsRaw
record component.- Returns:
- the value of the
cliArgsRaw
record component
-
targetModule
Returns the value of thetargetModule
record component.- Returns:
- the value of the
targetModule
record component
-
actionCommand
Returns the value of theactionCommand
record component.- Returns:
- the value of the
actionCommand
record component
-