lucee.Componentcommandbox.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
|
JSONService
|
true
|
false
|
|
any
|
colors256Data
|
true
|
false
|
|
any
|
cr
|
true
|
false
|
|
any
|
formatterUtil
|
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
- JSONServiceserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- colors256Data@constantsserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- cr@constantsserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- formatterserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- shellserializable
- trueMethod Detail |
---|
Get an 256 color ANSI
id
foreground
Get an ANSI Attribute
attribute
Pad all lines with 2 spaces
text
This 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
missingMethodName
missingMethodArguments
Removes ANSI attributes from string
ansiString