1.2.68 • Published 2 years ago

@concepto/console v1.2.68

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Description

Advanced ES6 console output class used within Concepto DSL Note you need to pass all arguments as an object with keys.

API Reference

Open_console: A class to help display information in the console.

open_console.setSilent(value)

Sets visibility output

Kind: instance method of open_console

ParamTypeDescription
valueBooleanif true, hides all output

open_console.time(id)

Calls timer start

Kind: instance method of open_console

ParamTypeDescription
idStringkey ID to measure

open_console.timeEnd(id, data, color, prefix)

Calls timer end

Kind: instance method of open_console

ParamTypeDescription
idStringkey ID to measure and show timming for.
dataObjectvar dump to include in output
colorStringblack,red,green,yellow,blue,purple,cyan,white
prefixStringuse this prefix instead of the configured one. To use color, use format 'prefix,color'

open_console.setPrefix(prefix, color)

Sets output prefix

Kind: instance method of open_console

ParamTypeDescription
prefixStringprefix
colorStringblack,red,green,yellow,blue,purple,cyan,white

open_console.clear()

Clears the console screen

Kind: instance method of open_console

open_console.spinner(message, color, prefix) ⇒ Object

Outputs an ora spinner with the given message, used prefix and color.

Kind: instance method of open_console
Returns: Object - - Object similar to ora object with an additional text(x) method

ParamTypeDescription
messageStringmessage to output
colorStringblack,red,green,yellow,blue,purple,cyan,white
prefixStringuse this prefix instead of the configured one. To use color, use format 'prefix,color'

open_console.progress(format, config, prefix, formatData) ⇒ Object

Returns an instance of cli-progress with the given total amount, format, and color.

Kind: instance method of open_console
Returns: Object - - Object similar to cli-progress object with methods to create,update,remove progress bars

ParamTypeDescription
formatStringformat of progress message. Example: 'Progress {bar} - {percentage} %'
configObjectoptions overwrite for cli-progress multibar config
prefixStringuse this prefix instead of the configured one. To use color, use format 'prefix,color'
formatDatafunctionfunction(data) expects a return of a modified data instance. Inside you can control the format presentation and vars used inside the format argument. You also have access to special keys (progress,value,total,bar,eta,percentage,...all your data keys) and helper functions (data.funcs.colors and data.funcs.symbols).

open_console.out(message, data, color, prefix)

Output a message to the console screen, with an optional var with data

Kind: instance method of open_console

ParamTypeDescription
messageStringmessage to output
dataObjectvar dump to include in output
colorStringblack,red,green,yellow,blue,purple,cyan,white
prefixStringuse this prefix instead of the configured one. To use color, use format 'prefix,color'

open_console.outT(message, data, color, prefix)

Output a message to the console screen with timestamp, and an optional var with data

Kind: instance method of open_console

ParamTypeDescription
messageStringmessage to output
dataObjectvar dump to include in output
colorStringblack,red,green,yellow,blue,purple,cyan,white
prefixStringuse this prefix instead of the configured one. To use color, use format 'prefix,color'

open_console.title(title, color, titleColor, config)

Displays the given text as a title

Kind: instance method of open_console

ParamTypeDefaultDescription
titleStringtitle to display
colorStringwhitecolor for box borders.
titleColorStringcolor for title. If undefined, uses the box color.
configObjectconfig overwrite params for boxen.
config.alignStringcenteraligns the title by its value: left,center,right

open_console.table(title, data, struct_sort, color)

Shows data array as table in the console

Kind: instance method of open_console

ParamTypeDescription
titleStringtitle for table
dataArrayarray of objects for building the table.
struct_sortStringsort data before displaying. Supports: field asc/desc.
colorStringcolor for table.

© 2020-2022 Pablo Schaffner <pablo@puntorigen.com>.