lucee.Component
commandbox.system.util.Print
Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I am a helper object for creating pretty ANSI-formmatted text in the shell. I use onMissingMethod to allow for nice, readable methods that contain combinations of text and background colors as well as text formatting. Ex. print.Line() print.text( 'Hello World' ); print.boldText( 'Hello World' ); print.line( 'Hello World' ); print.redLine( 'Hello World' ); print.redOnWhiteLine( 'Hello World' ); print.redOnWhiteBold( 'Hello World' ); print.boldBlinkingUnderscoredBlueTextOnRedBackground( 'Test' ); If you want to modify formatting at runtime, pass a second parameter of additional text that will be appended to the method name upon processing. print.text( 'Hello World', 'blue' ); print.text( 'Hello World', statusColor ); print.text( 'Hello World', ( status == 'running' ? 'green' : 'red' ) ); Indent each carridge return with two spaces like so: print.indentedLine( 'Hello World' );
| Property Summary | ||||
|---|---|---|---|---|
| type | property | default | serializable | required |
any
|
colors256Data
|
true
|
false
|
|
any
|
cr
|
true
|
false
|
|
any
|
formatterUtil
|
true
|
false
|
|
any
|
JSONService
|
true
|
false
|
|
any
|
shell
|
true
|
false
|
|
| Method Summary | |
|---|---|
private string
|
get256Color(any id, [any foreground='true'])
Get an 256 color ANSI. |
private string
|
getANSIAttribute(any attribute)
Get an ANSI Attribute. |
private string
|
indent([any text])
Pad all lines with 2 spaces. |
any
|
onMissingMethod([any missingMethodName], [any missingMethodArguments])
This allows you concatenate pretty method names to describe the kind of text you want to generate. |
any
|
unansi(any ansiString)
Removes ANSI attributes from string. |
| Methods inherited from class lucee.Component |
|---|
| None |
| Property Detail |
|---|
access - publicrequired - falsereturntype - anyinject - colors256Data@constantsserializable - trueaccess - publicrequired - falsereturntype - anyinject - cr@constantsserializable - trueaccess - publicrequired - falsereturntype - anyinject - formatterserializable - trueaccess - publicrequired - falsereturntype - anyinject - JSONServiceserializable - trueaccess - publicrequired - falsereturntype - anyinject - shellserializable - true| Method Detail |
|---|
Get an 256 color ANSI
idforegroundGet an ANSI Attribute
attributePad all lines with 2 spaces
textThis allows you concatenate pretty method names to describe the kind of text you want to generate If the method name contains "line", it will be appended with a carriage return Any other token in the name that exists in the list of ANSI attributes above will be picked up and applied to the text
missingMethodNamemissingMethodArgumentsRemoves ANSI attributes from string
ansiString