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 aCLIOptionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theactionCommandrecord component.cliArgs()Returns the value of thecliArgsrecord component.String[]Returns the value of thecliArgsRawrecord component.code()Returns the value of thecoderecord component.Returns the value of theconfigFilerecord component.debug()Returns the value of thedebugrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Wether or not this is an action command: Ex:boxlang compilebooleanVerifies if debug mode was enabledQuick parser for options on cli arguments for BoxLangprintAST()Returns the value of theprintASTrecord component.Returns the value of theruntimeHomerecord component.Returns the value of theshowVersionrecord component.Returns the value of thetargetModulerecord component.Returns the value of thetemplatePathrecord component.final StringtoString()Returns a string representation of this record class.toStruct()Get the state representation of this recordReturns the value of thetranspilerecord 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 aCLIOptionsrecord class.- Parameters:
templatePath- the value for thetemplatePathrecord componentdebug- the value for thedebugrecord componentcode- the value for thecoderecord componentconfigFile- the value for theconfigFilerecord componentprintAST- the value for theprintASTrecord componenttranspile- the value for thetranspilerecord componentruntimeHome- the value for theruntimeHomerecord componentshowVersion- the value for theshowVersionrecord componentcliArgs- the value for thecliArgsrecord componentcliArgsRaw- the value for thecliArgsRawrecord componenttargetModule- the value for thetargetModulerecord componentactionCommand- the value for theactionCommandrecord 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 thetemplatePathrecord component.- Returns:
- the value of the
templatePathrecord component
-
debug
Returns the value of thedebugrecord component.- Returns:
- the value of the
debugrecord component
-
code
Returns the value of thecoderecord component.- Returns:
- the value of the
coderecord component
-
configFile
Returns the value of theconfigFilerecord component.- Returns:
- the value of the
configFilerecord component
-
printAST
Returns the value of theprintASTrecord component.- Returns:
- the value of the
printASTrecord component
-
transpile
Returns the value of thetranspilerecord component.- Returns:
- the value of the
transpilerecord component
-
runtimeHome
Returns the value of theruntimeHomerecord component.- Returns:
- the value of the
runtimeHomerecord component
-
showVersion
Returns the value of theshowVersionrecord component.- Returns:
- the value of the
showVersionrecord component
-
cliArgs
Returns the value of thecliArgsrecord component.- Returns:
- the value of the
cliArgsrecord component
-
cliArgsRaw
Returns the value of thecliArgsRawrecord component.- Returns:
- the value of the
cliArgsRawrecord component
-
targetModule
Returns the value of thetargetModulerecord component.- Returns:
- the value of the
targetModulerecord component
-
actionCommand
Returns the value of theactionCommandrecord component.- Returns:
- the value of the
actionCommandrecord component
-