Node.js SDK: ux

ux.bold

ux.bold(text:string): string

Formats text as boldface for printing with ux.print or as a message in any of the other ux functions.

Formats correctly in the terminal and in Slack.

Example:

ux.italic

ux.italic(text:string): string

Formats text as italic for printing with ux.print or as a message in any of the other ux functions.

Formats correctly in the terminal and in Slack, but terminal support for italic text is limited.

Example:

ux.print

ux.print(text: string): Promise<void>

Display text to the user. Locally, prints to the terminal.

Example:

Output:

ux.progress.init

init(): ProgressBar

Create a progress bar object representing a single progress bar.

ProgressBar.start

start(length: number, initial: ?number, message: ?string): Promise<void>

Display a progress bar, with length increments of which initial are already ready, and with an accompanying optional message.

ProgressBar.increment

increment(amount?: number): Promise<void>

Increments the value of a progress bar by amount increments, or by 1 increment if no argument is provided.

ProgressBar.stop

stop(message?: string): Promise<void>

Completes the progress bar, incrementing it to 100% and optionally replacing the message with the given one.

Example:

ux.prompt

prompt(questions: Question | Question[]): Promise<any>

Request input from the user. A variety of prompt types are available for different kinds of user input, as described on this page. A single call to ux.prompt may be passed a single prompt object or an array of objects; the result will contain answers to all of the prompts passed.

Example:

ux.spinner.start

start(text: string): Promise<void>

Start a spinner accompanied with the given message.

Example:

ux.spinner.stop

stop(text: string): Promise<void>

Stop the currently running spinner, replacing the message with the given text.

Example:

See ux.spinner.start above.

ux.wait

wait(duration: number): Promise<void>

Waits for 1 second or the given number of milliseconds

Example:

ux.url

url(text: string, url: string): string

Create a terminal hyperlink, as supported by many terminals (e.g. iTerm2). Returns the raw text for use in sdk.log orux.print. If the current terminal does not support hyperlinks, renders as ${text} (${url}).

Example:

ux.table

Displays tabular data

for more information: https://github.com/oclif/cli-ux#clitable

ux.tree

Generate a tree and display it

Outputs: