Class: Prompt

Prompt(setup)

new Prompt(setup)

Creates an instance of Prompt.

Parameters:
Name Type Description
setup Object

Configuration options for the prompt.

Properties
Name Type Description
rootPath string

The root path for the prompt (defaults to the current directory).

Source:

Members

rootPath :string

The root path for the prompt.

Type:
  • string
Source:

Methods

cmd(command, options, dontPrint) → {Object|Error.Log}

Executes a command in the shell synchronously.

Parameters:
Name Type Description
command string

The command to be executed.

options Object

Additional options for the execution.

dontPrint boolean

If true, the command output will not be printed (defaults to false).

Source:
Returns:

An object containing the execution result or an Error.Log object if an error occurs.

Type
Object | Error.Log

(async) exec(cmd) → {Promise}

Asynchronously executes a command in the shell and returns a Promise.

Parameters:
Name Type Description
cmd string

The command to be executed.

Source:
Returns:

A Promise that resolves with the execution result.

Type
Promise

(async) question(questionText) → {Promise.<string>}

Asynchronously asks a question in the terminal and returns the user's input as a Promise.

Parameters:
Name Type Description
questionText string

The text of the question to be asked.

Source:
Returns:

A Promise that resolves with the user's input.

Type
Promise.<string>

strigifyParams(params) → {string}

Converts parameters into a string format suitable for command-line arguments.

Parameters:
Name Type Description
params Array | Object | string

The parameters to be converted.

Source:
Throws:

If an error occurs during parameter conversion.

Type
Error.Log
Returns:

A string representation of the parameters for command-line use.

Type
string