BajoCli

BajoCli class definition.

Constructor

new BajoCli()

Constructor

Members

config :BajoCli.TConfig

Configuration object.

Methods

(async) getNpmPkgInfo(name) → {Promise.<object>}

Get package information from NPM registry

Parameters:
NameTypeDescription
namestring

Package name

Returns:
  • Package information
Type: 
Promise.<object>

getOutputFormat() → {string}

Get output format from configuration

Returns:
  • Output format
Type: 
string

(async) hTable(…args) → {Promise.<any>}

Draw a horizontal table

Parameters:
NameTypeAttributesDescription
argsany<repeatable>

Arguments to be passed to the horizontal table

Returns:
  • Result of the horizontal table
Type: 
Promise.<any>

(async) prettyPrint(obj, printopt, titleFnopt) → {Promise.<string>}

Pretty print an object

Parameters:
NameTypeAttributesDefaultDescription
objstring | number | Array | Object

Object to be pretty printed

printboolean<optional>
false

Whether to print the result (if true) or return it (default: false)

titleFnfunction<optional>

Function to generate titles

Returns:
  • Pretty printed string
Type: 
Promise.<string>

(async) runApplet(applet, path, …args) → {Promise.<any>}

Run an applet

Parameters:
NameTypeAttributesDescription
appletobject

Applet object

pathstring

Path to the applet

argsany<repeatable>

Arguments to be passed to the applet

Returns:
  • Result of the applet
Type: 
Promise.<any>

(async) vTable(…args) → {Promise.<any>}

Draw a vertical table

Parameters:
NameTypeAttributesDescription
argsany<repeatable>

Arguments to be passed to the vertical table

Returns:
  • Result of the vertical table
Type: 
Promise.<any>

(async) writeOutput(content, path, terminate)

Write output to a file or console

Parameters:
NameTypeDescription
contentobject | array

Object or array to be written

pathstring

Path to the output file. Ignored if config.applet.save is false.

terminateboolean

Whether to terminate the process after writing

Type Definitions

TConfig

Configuration object.

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
appletobject<optional>
{}

Applet configuration object

Properties
NameTypeAttributesDefaultDescription
saveboolean<optional>
false

Whether to save the output of an applet to a file or not. Default: false