lucee.Component
commandbox.system.util.InteractiveJob
Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I help update the user's console with progress for a currently executing (foreground) job in a nice and tidy way.
| Property Summary | ||||
|---|---|---|---|---|
| type | property | default | serializable | required |
any
|
ConsolePainter
|
true
|
false
|
|
boolean
|
active
|
true
|
false
|
|
numeric
|
animation
|
true
|
false
|
|
boolean
|
dumpLog
|
true
|
false
|
|
array
|
jobs
|
true
|
false
|
|
any
|
print
|
true
|
false
|
|
any
|
printBuffer
|
true
|
false
|
|
any
|
shell
|
true
|
false
|
|
numeric
|
startTime
|
true
|
false
|
|
| Constructor Summary | |
|---|---|
|
init()
|
|
| Method Summary | |
|---|---|
any
|
addErrorLog(string line)
Convenience method to log a red message. |
any
|
addLog(string line, [string color=''])
Add a line of logging. |
any
|
addSuccessLog(string line)
Convenience method to log a green message. |
any
|
addWarnLog(string line)
Convenience method to log a yellow message. |
any
|
clear()
Clear from the screen, but don't reset. |
any
|
complete([boolean dumpLog='[runtime expression]'])
Mark job as completed. |
any
|
draw()
Render the information to the console. |
any
|
error([string message=''], [boolean dumpLog='[runtime expression]'])
Mark job as Failed. |
any
|
errorRemaining([any message=''])
Cancel all remaining jobs and mark with error. |
private any
|
finalizeOutput([boolean dumpLog])
Outputs final representation of job to console for good. |
string
|
getActive()
|
string
|
getAnimation()
|
string
|
getConsolePainter()
|
private struct
|
getCurrentJob()
Get struct that represents the currently executing job. |
numeric
|
getCurrentJobDepth()
Get number that represents the depth of the currently executing job. |
string
|
getDumpLog()
|
private string
|
getJobTitle([any job])
Returns colored and formatted job title. |
string
|
getJobs()
|
array
|
getLines([any job], [any includeAllLogs='false'], [any finalOutput='false'])
Returns array of AttributedString objects that represent this job and its children's current state. |
string
|
getPrint()
|
string
|
getPrintBuffer()
|
string
|
getShell()
|
string
|
getStartTime()
|
boolean
|
isActive()
Is there an active job?. |
private struct
|
newJob([any name], [any logSize])
Returns empty struct of default job details. |
any
|
onDIComplete()
|
any
|
reset()
Reset the internal state of this job. |
any
|
runningAnimation()
Returns a character to aninmate for running jobs. |
any
|
setActive(boolean active)
|
any
|
setAnimation(numeric animation)
|
any
|
setConsolePainter(any ConsolePainter)
|
any
|
setDumpLog(boolean dumpLog)
|
any
|
setJobs(array jobs)
|
any
|
setPrint(any print)
|
any
|
setPrintBuffer(any printBuffer)
|
any
|
setShell(any shell)
|
any
|
setStartTime(numeric startTime)
|
any
|
start(string name, [any logSize='5'])
Kick off a job. |
private string
|
statusColor([any job])
Returns name of color for current job status. |
| Methods inherited from class lucee.Component |
|---|
| None |
| Constructor Detail |
|---|
| Property Detail |
|---|
access - publicrequired - falsereturntype - anyinject - provider:ConsolePainterserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyinject - printserializable - trueaccess - publicrequired - falsereturntype - anyinject - printBufferserializable - trueaccess - publicrequired - falsereturntype - anyinject - shellserializable - trueaccess - publicrequired - falsereturntype - anyserializable - true| Method Detail |
|---|
Convenience method to log a red message
line - Message to logAdd a line of logging. Feel free to use ANSI formatting
line - Message to logcolorConvenience method to log a green message
line - Message to logConvenience method to log a yellow message
line - Message to logClear from the screen, but don't reset
Mark job as completed. This will print out any final permanent lines and clear the state
dumpLog - Dump out all internal log lines permanently to the consoleRender the information to the console
Mark job as Failed. This will print out any final permanent lines and clear the state
messagedumpLog - Dump out all internal log lines permanently to the consoleCancel all remaining jobs and mark with error
message - Error message to be applied to the current jobOutputs final representation of job to console for good Resets the internal state this CFC so all job data is gone and there is no active job.
dumpLog - Include all log messages in output regardless of logSizeGet struct that represents the currently executing job.
Get number that represents the depth of the currently executing job.
Returns colored and formatted job title
job - Job struct to useReturns array of AttributedString objects that represent this job and its children's current state
job - Reference to a job struct so this method can be called recursivelyincludeAllLogs - Ignore logSize and include all log linesfinalOutput - True if getting final output at the completion of the job.Is there an active job?
Returns empty struct of default job details
name - Name of joblogSize - Size of the log to displayReset the internal state of this job
Returns a character to aninmate for running jobs
activeanimationConsolePainterdumpLogjobsprintprintBuffershellstartTimeKick off a job. Clears any previous state and starts drawing
name - Name of the joblogSizeReturns name of color for current job status
job - Job struct to use