lucee.Component
commandbox.system.BaseCommand
Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I am the base command implementation. An abstract class if you will.
| Property Summary | ||||
|---|---|---|---|---|
| type | property | default | serializable | required |
any
|
CR
|
true
|
false
|
|
any
|
SystemSettings
|
true
|
false
|
|
any
|
exitCode
|
true
|
false
|
|
any
|
fileSystemUtil
|
true
|
false
|
|
any
|
formatterUtil
|
true
|
false
|
|
any
|
job
|
true
|
false
|
|
any
|
logger
|
true
|
false
|
|
any
|
parser
|
true
|
false
|
|
any
|
print
|
true
|
false
|
|
any
|
shell
|
true
|
false
|
|
any
|
wirebox
|
true
|
false
|
|
| Constructor Summary | |
|---|---|
|
init()
Constructor. |
|
| Method Summary | |
|---|---|
string
|
ask([any message], [string mask=''], [string defaultResponse=''], [any keepHistory='false'], [any highlight='true'], [any complete='false'])
ask the user a question and wait for response. |
any
|
checkInterrupted([any thisThread='[runtime expression]'])
Call this method periodically in a long-running task to check and see. |
any
|
classLoad([any paths])
|
any
|
command(any name)
Run another command by DSL. |
any
|
confirm(any message)
Ask the user a question looking for a yes/no response. |
any
|
error(any message, [any detail=''], [any clearPrintBuffer='false'], [any exitCode='1'])
Use if if your command wants to give controlled feedback to the user without raising. |
string
|
getCR()
|
any
|
getCWD()
|
any
|
getCurrentThread()
Get the current thread object. |
any
|
getEnv(string key, [any defaultValue])
Retrieve an env value by name. |
any
|
getExitCode()
|
string
|
getFileSystemUtil()
|
string
|
getFormatterUtil()
|
any
|
getInstance([any name], [any dsl], [any initArguments='[runtime expression]'], [any targetObject=''])
|
string
|
getJob()
|
string
|
getLogger()
|
string
|
getParser()
|
string
|
getPrint()
|
any
|
getPrinter()
|
any
|
getResult()
|
string
|
getShell()
|
any
|
getSystemProperty(string key, [any defaultValue])
Retrieve a Java System property by name. |
any
|
getSystemSetting(string key, [any defaultValue])
Retrieve a Java System property or env value by name. |
string
|
getSystemSettings()
|
string
|
getThreadName()
Get the current thread name. |
string
|
getWirebox()
|
any
|
globber([any pattern=''])
Return a new globber. |
any
|
hasError()
Tells you if the error() method has been called on this command. |
any
|
multiSelect()
Let a user choose between several options. |
any
|
openPath([any path])
This will open a file or folder externally in the default editor for the user. |
any
|
openURL([any theURL], [any browser=''])
This will open a URL in the user's browser. |
any
|
propertyFile([any propertyFilePath=''])
Return a new PropertyFile instance. |
any
|
reset()
|
any
|
resolvePath(string path, [any basePath='[runtime expression]'])
This resolves an absolute or relative path using the rules of the operating system and CLI. |
any
|
run()
|
any
|
runCommand(any command, [any returnOutput='false'])
Run another command by name. |
any
|
setCR(any CR)
|
any
|
setExitCode(numeric exitCode)
|
any
|
setFileSystemUtil(any fileSystemUtil)
|
any
|
setFormatterUtil(any formatterUtil)
|
any
|
setJob(any job)
|
any
|
setLogger(any logger)
|
any
|
setParser(any parser)
|
any
|
setPrint(any print)
|
any
|
setShell(any shell)
|
any
|
setSystemSetting(string key, [string value])
Set a CommandBox environment variable. |
any
|
setSystemSettings(any SystemSettings)
|
any
|
setWirebox(any wirebox)
|
any
|
waitForKey([any message=''])
Wait until the user's next keystroke. |
any
|
watch()
Create a directory watcher. |
| Methods inherited from class lucee.Component |
|---|
| None |
| Constructor Detail |
|---|
Constructor
| Property Detail |
|---|
access - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - true| Method Detail |
|---|
ask the user a question and wait for response
message - message to prompt the user withmask - When not empty, keyboard input is masked as that characterdefaultResponsekeepHistoryhighlightcompleteCall this method periodically in a long-running task to check and see if the user has hit Ctrl-C. This method will throw an UserInterruptException which you should not catch. It will unroll the stack all the way back to the shell
thisThreadpathsRun another command by DSL.
name - The name of the command to run.Ask the user a question looking for a yes/no response Accepts any boolean value, or "y".
message - The message to display to the user such as "Would you like to continue?"Use if if your command wants to give controlled feedback to the user without raising an actual exception which comes with a messy stack trace. Use clearPrintBuffer to wipe out any output accrued in the print buffer. return error( "We're sorry, but happy hour ended 20 minutes ago." );
message - The error message to displaydetailclearPrintBuffer - Wipe out the print buffer or not, it does not by defaultexitCodeGet the current thread object
Retrieve an env value by name.
key - The name of the setting to look up.defaultValue - The default value to use if the key does not exist in the envnamedslinitArgumentstargetObjectRetrieve a Java System property by name.
key - The name of the setting to look up.defaultValue - The default value to use if the key does not exist in the system propertiesRetrieve a Java System property or env value by name.
key - The name of the setting to look up.defaultValue - The default value to use if the key does not exist in the system propertiesGet the current thread name
Return a new globber
patternTells you if the error() method has been called on this command.
Let a user choose between several options. Can be set to multiselect, which returns array of selections multiSelect().setQuestion( 'Please Choose: ' ).setOptions( 'one,two,three' ).ask()
This will open a file or folder externally in the default editor for the user. Useful for opening a new file for editing that was just created.
pathThis will open a URL in the user's browser
theURLbrowserReturn a new PropertyFile instance
propertyFilePathThis resolves an absolute or relative path using the rules of the operating system and CLI. It doesn't follow CF mappings and will also always return a trailing slash if pointing to an existing directory. Resolve the incoming path from the file system
path - The directory to resolvebasePath - An expanded base path to resolve the path against. Defaults to CWD.Run another command by name. This is deprecated in favor of command(), which escapes parameters for you.
command - The command to run. Pass the same string a user would type at the shell.returnOutputCRexitCodefileSystemUtilformatterUtiljobloggerparserprintshellSet a CommandBox environment variable
key - The name of the setting to look up.valueSystemSettingswireboxWait until the user's next keystroke
message - Message to display to the user such as "Press any key to continue."Create a directory watcher. Call its DSL to configure it.