@concepto/console

Concepto DSL - visually create and maintain modern node.js based apps (@console)

Usage no npm install needed!

<script type="module">
  import conceptoConsole from 'https://cdn.skypack.dev/@concepto/console';
</script>

README

Concepto DSL Logo

A progressive Node.js framework for visually building efficient and scalable nodejs based applications.

NPM Version Package License NPM Downloads

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

Param Type Description
value Boolean if true, hides all output

open_console.time(id)

Calls timer start

Kind: instance method of open_console

Param Type Description
id String key ID to measure

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

Calls timer end

Kind: instance method of open_console

Param Type Description
id String key ID to measure and show timming for.
[data] Object var dump to include in output
[color] String black,red,green,yellow,blue,purple,cyan,white
[prefix] String use 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

Param Type Description
[prefix] String prefix
[color] String black,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

Param Type Description
message String message to output
[color] String black,red,green,yellow,blue,purple,cyan,white
[prefix] String use 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

Param Type Description
format String format of progress message. Example: 'Progress {bar} - {percentage} %'
[config] Object options overwrite for cli-progress multibar config
[prefix] String use this prefix instead of the configured one. To use color, use format 'prefix,color'
[formatData] function function(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

Param Type Description
message String message to output
[data] Object var dump to include in output
[color] String black,red,green,yellow,blue,purple,cyan,white
[prefix] String use 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

Param Type Description
message String message to output
[data] Object var dump to include in output
[color] String black,red,green,yellow,blue,purple,cyan,white
[prefix] String use 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

Param Type Default Description
title String title to display
[color] String white color for box borders.
[titleColor] String color for title. If undefined, uses the box color.
[config] Object config overwrite params for boxen.
[config.align] String center aligns 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

Param Type Description
title String title for table
data Array array of objects for building the table.
[struct_sort] String sort data before displaying. Supports: field asc/desc.
[color] String color for table.

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