@absolunet/ioc2.1.0

View on GitHub

Terminal

The enhanced Absolunet terminal class.

Members

chalk :Chalk

Source:
The Chalk instance.

file :string

Source:
Get the currently executed file. By default, should be "ioc".

argv :Array.<string>

Source:
Get the process argv.

command :string

Source:
Get the current console command.

args

Source:
Get the current console command arguments.

inquirer :Inquirer

Source:
The inquirer module.

crossSpawn :spawn

Source:
The cross-spawn module.

Methods

(async) spawn(command, parameters, options)

Source:
Spawn a process as a promise.
Parameters:
Name Type Description
command string The command to run.
parameters Array.<string> The command arguments.
options object The spawn options.
Returns:
The async process promise.
Type
Promise

spawnSync(command, parameters, options)

Source:
Spawn a process in sync mode.
Parameters:
Name Type Description
command string The command to run.
parameters Array.<string> The command arguments.
options object The spawn options.

(async) ask(question, defaultAnswer, options)

Source:
Ask a question to the user.
Parameters:
Name Type Default Description
question string The question to ask.
defaultAnswer string | null null The default answer.
options object The inquirer options.
Returns:
The user answer.
Type
Promise.<(string|null)>

secret(question, optionsopt)

Source:
Ask a question to the user with a secret answer.
Parameters:
Name Type Attributes Default Description
question string The question to ask.
options object <optional>
{} The inquirer options.
Returns:
The user answer.
Type
Promise.<(string|null)>

(async) confirm(statement, defaultValueopt)

Source:
Ask the user to confirm an action.
Parameters:
Name Type Attributes Default Description
statement string The confirmation statement.
defaultValue boolean <optional>
false The default confirmation value.
Returns:
The user confirmation.
Type
Promise.<boolean>

(async) choice(question, choices, defaultValueopt)

Source:
Ask a question with a list of potential answers to the user.
Parameters:
Name Type Attributes Description
question string The question to ask.
choices Array.<string> | object.<string, string> The available choices.
defaultValue string <optional>
The default value.
Returns:
The user answer.
Type
Promise.<string>

table(header, data, optionsopt, printopt)

Source:
Print a table with list of models.
Parameters:
Name Type Attributes Default Description
header Array.<string> The table header.
data Array.<object.<string, string>> The table data.
options object <optional>
{} The table options.
print boolean <optional>
true Indicates if the table should be printed or returned as a string.
Returns:
Either the terminal or the table as string.
Type
console.services.Terminal | string

tables(tables, sideBySideopt, optionsopt, printopt)

Source:
Print multiple tables.
Parameters:
Name Type Attributes Default Description
tables Array.<Array.<Array.<string>>> The tables.
sideBySide boolean <optional>
false Indicates that the tables should be side by side instead on one under the other.
options object <optional>
{} The table options.
print boolean <optional>
true Indicates if the table should be printed or returned as a string.
Returns:
Either the terminal or the table as string.
Type
console.services.Terminal | string