Skip to main content
Home

@std/cli@1.0.25
Built and signed on GitHub Actions

Works with
This package works with DenoIt is unknown whether this package works with Bun
This package works with Deno
It is unknown whether this package works with Bun
JSR Score94%
Downloads18,602/wk
Published3 weeks ago (1.0.25)

Tools for creating interactive command line tools

default

Tools for creating interactive command line tools.

T
Args

The value returned from parseArgs.

f
parseArgs

Take a set of command line arguments, optionally with a set of options, and return an object representing the flags found in the passed arguments.

f
promptSecret

Shows the given message and waits for the user's input. Returns the user's input as string. This is similar to prompt() but it print user's input as * to prevent password from being shown. Use an empty mask if you don't want to show any character.

T
PromptSecretOptions

Options for promptSecret.

f
unicodeWidth

Calculate the physical width of a string in a TTY-like environment. This is useful for cases such as calculating where a line-wrap will occur and underlining strings.

parse-args

Command line arguments parser based on minimist.

T
Args

The value returned from parseArgs.

f
parseArgs

Take a set of command line arguments, optionally with a set of options, and return an object representing the flags found in the passed arguments.

f
promptSecret

Shows the given message and waits for the user's input. Returns the user's input as string. This is similar to prompt() but it print user's input as * to prevent password from being shown. Use an empty mask if you don't want to show any character.

T
PromptSecretOptions

Options for promptSecret.

f
unicodeWidth

Calculate the physical width of a string in a TTY-like environment. This is useful for cases such as calculating where a line-wrap will occur and underlining strings.

unstable-ansi

Ansi is a module that offers export function s and variables that returns various Ansi Escape Sequences. This class is not an exhaustive list of what is possible with Ansi Escape Sequences, nor does it guarantee that every code will work in every terminal. The only way to guarantee that only one code will work in a particular terminal, is to check for yourself. Calling these export function s and variables does not automatically change the terminal settings. Only once they are passed to stdout or stderr will they take effect.

E
CursorStyle

CursorStyle is a export const enum used to set the value in setCursorStyle.

f
deleteCharacters

Deletes x characters at cursor position and to the right. Shifting line content left.

f
deleteLines

Deletes x lines at cursor position. Shifting below lines up.

v
DISABLE_AUTO_WRAP

Causes cursor to remain on the same line when it hits the end of the current line. See also ENABLE_AUTO_WRAP.

v
DISABLE_ORIGIN_MODE

Causes the top and bottom margins to enlarge to the user's display. See ENABLE_ORIGIN_MODE.

v
DOUBLE_HEIGHT_BOTTOM

Causes content on the current line to enlarge, showing only the bottom half of the characters with each character taking up two columns. Can be used in combination with DOUBLE_HEIGHT_TOP on the previous line to make text appear twice as big.

v
DOUBLE_HEIGHT_TOP

Causes content on the current line to enlarge, showing only the top half of characters with each character taking up two columns. Can be used in combination with DOUBLE_HEIGHT_BOTTOM on the next line to make text appear twice as big.

v
DOUBLE_WIDTH

Causes content on the current line to stretch out, with each character taking up two columns. Can be reverted with SINGLE_WIDTH.

v
ENABLE_AUTO_WRAP

Causes cursor to automatically move to the next line when it hits the end of the current line to continue writing. See also DISABLE_AUTO_WRAP.

v
ENABLE_ORIGIN_MODE

Causes top and bottom margins to shrink to scrollable region (See setScrollableRegion) preventing the cursor from moving to the lines outside it.

v
ERASE_DISPLAY

Erases all content.

v
ERASE_DISPLAY_AFTER_CURSOR

Erases content of lines below cursor position and content to the right on the same line as cursor.

v
ERASE_DISPLAY_BEFORE_CURSOR

Erases content of lines above cursor position and content to the left on the same line as cursor.

v
ERASE_LINE

Erases entire line content.

v
ERASE_LINE_AFTER_CURSOR

Erases line content to the right of cursor position.

v
ERASE_LINE_BEFORE_CURSOR

Erases line content to the left of cursor position.

f
eraseCharacters

Erases x characters at cursor position and to the right.

v
HARD_RESET

This is a full reset of the terminal, reverting it back to its original default settings, clearing the screen, resetting modes, colors, character sets and more. Essentially making the terminal behave as if it were just started by the user. This command is very disruptive to the user. Also see SOFT_RESET.

v
HIDE_CURSOR

Causes cursor position to be hidden from the user. See also SHOW_CURSOR.

v
INSERT_MODE

Causes existing characters to the right of the cursor position to shift right as new characters are written. Opposite of REPLACE_MODE.

f
insertLines

Inserts x lines at cursor position. Shifting current line and below down. Cursor position does not change. Characters that exit the display are discarded.

f
insertSpace

Inserts x spaces at the cursor position. Shifting existing line content to the right. Cursor position does not change. Characters that exit the display are discarded.

f
moveCursorDown

Moves cursor position down x lines or up to the bottom margin.

f
moveCursorDownStart

Moves cursor position x lines down or up to the bottom margin, and to the beginning of that line.

f
moveCursorLeft

Moves cursor position x columns left or up to the left margin.

f
moveCursorLeftTab

Moves cursor position x tab stops left or up to the left margin.

f
moveCursorRight

Moves cursor position x columns right or up to the right margin.

f
moveCursorRightTab

Moves cursor position x tab stops right or up to the right margin.

f
moveCursorUp

Moves cursor position up x lines or up to the top margin.

f
moveCursorUpStart

Moves cursor position x lines up or up to the top of the margin, and to the beginning of that line.

f
repeatLastCharacter

Repeats last graphic character printed x times at cursor position.

v
REPLACE_MODE

Causes existing characters to be overwritten at the cursor position by new characters. See also INSERT_MODE.

v
RESTORE_CURSOR

Restores:

v
SAVE_CURSOR

Saves:

f
setCursorColumn

Sets cursor position to column x or up to the sides of the margins. Columns begin at 1 not 0.

f
setCursorLine

Sets cursor position to line x or down to the bottom of the margin. Lines begin at 1 not 0.

f
setCursorPosition

Sets cursor position to x line and y column or up to the margin. Lines and columns begin at 1 not 0.

f
setCursorStyle

Sets the cursor animation style.

f
setScrollableRegion

Sets the scrollable region of the display. Allowing either or both the top and bottom lines to not have their content moved when the scrolling region is updated. x is the top line of the scrollable region. y is the bottom line of the scrollable region.

f
shiftDownAndInsert

Shifts content within the scrollable region down x lines, inserting blank lines at the top of the scrollable region.

f
shiftUpAndInsert

Shifts content within the scrollable region up x lines, inserting blank lines at the bottom of the scrollable region.

v
SHOW_CURSOR

Causes cursor position to be visible to the user. See also HIDE_CURSOR.

v
SINGLE_WIDTH

Causes content on the current line to shrink down to a single column, essentially reverting the effects of DOUBLE_HEIGHT_TOP, DOUBLE_HEIGHT_BOTTOM, or DOUBLE_WIDTH.

v
SOFT_RESET

This command resets many settings to their initial state without fully reinitializing the terminal like HARD_RESET. It preserves things like cursor position and display content, but clears modes, character sets, etc. Should probably be called when exiting the program.

c
ProgressBar

ProgressBar is a customisable class that reports updates to a WritableStream on a 1s interval. Progress is communicated by using the ProgressBar.value property.

I
ProgressBarFormatter

The properties provided to the fmt function upon every visual update.

I
ProgressBarOptions

The options that are provided to a createProgressBar or ProgressBarStream.

c
ProgressBarStream

ProgressBarStream is a TransformStream class that reports updates to a separate WritableStream on a 1s interval.

T
PromptEntry

Value for promptMultipleSelect. If an object, it must have a title and a value, else it can just be a string.

I
PromptEntryWithValue

A PromptEntry with an underlying value.

f
promptMultipleSelect

Shows the given message and waits for the user's input. Returns the user's selected value as string.

I
PromptMultipleSelectOptions

Options for promptMultipleSelect.

T
PromptEntry

Value for promptSelect. If an object, it must have a title and a value, else it can just be a string.

I
PromptEntryWithValue

A PromptEntry with an underlying value.

f
promptSelect

Shows the given message and waits for the user's input. Returns the user's selected value as string.

I
T
Color

Color options for SpinnerOptions.color.

c
Spinner

A spinner that can be used to indicate that something is loading.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.