Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Tools for creating interactive command line tools
default
Tools for creating interactive command line tools.
The value returned from 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.
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.
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.
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.
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.
CursorStyle is a export const enum used to set the value in
setCursorStyle.
Deletes x characters at cursor position and to the right. Shifting line
content left.
Deletes x lines at cursor position. Shifting below lines up.
Causes cursor to remain on the same line when it hits the end of the
current line. See also ENABLE_AUTO_WRAP.
Causes the top and bottom margins to enlarge to the user's display. See
ENABLE_ORIGIN_MODE.
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.
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.
Causes content on the current line to stretch out, with each character
taking up two columns. Can be reverted with SINGLE_WIDTH.
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.
Causes top and bottom margins to shrink to scrollable region (See
setScrollableRegion) preventing the cursor from moving
to the lines outside it.
Erases all content.
Erases content of lines below cursor position and content to the right on the same line as cursor.
Erases content of lines above cursor position and content to the left on the same line as cursor.
Erases entire line content.
Erases line content to the right of cursor position.
Erases line content to the left of cursor position.
Erases x characters at cursor position and to the right.
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.
Causes cursor position to be hidden from the user. See also
SHOW_CURSOR.
Causes existing characters to the right of the cursor position to shift
right as new characters are written. Opposite of
REPLACE_MODE.
Inserts x lines at cursor position. Shifting current line and below
down. Cursor position does not change. Characters that exit the display
are discarded.
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.
Moves cursor position down x lines or up to the bottom margin.
Moves cursor position x lines down or up to the bottom margin, and to
the beginning of that line.
Moves cursor position x columns left or up to the left margin.
Moves cursor position x tab stops left or up to the left margin.
Moves cursor position x columns right or up to the right margin.
Moves cursor position x tab stops right or up to the right margin.
Moves cursor position up x lines or up to the top margin.
Moves cursor position x lines up or up to the top of the margin, and to
the beginning of that line.
Repeats last graphic character printed x times at cursor position.
Causes existing characters to be overwritten at the cursor position by new
characters. See also INSERT_MODE.
Restores:
Saves:
Sets cursor position to column x or up to the sides of the margins.
Columns begin at 1 not 0.
Sets cursor position to line x or down to the bottom of the margin.
Lines begin at 1 not 0.
Sets cursor position to x line and y column or up to the margin. Lines
and columns begin at 1 not 0.
Sets the cursor animation style.
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.
Shifts content within the scrollable region down x lines, inserting
blank lines at the top of the scrollable region.
Shifts content within the scrollable region up x lines, inserting blank
lines at the bottom of the scrollable region.
Causes cursor position to be visible to the user. See also
HIDE_CURSOR.
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.
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.
ProgressBar is a customisable class that reports updates to a
WritableStream on a 1s interval. Progress is communicated by using
the ProgressBar.value property.
The properties provided to the fmt function upon every visual update.
ProgressBarStream is a TransformStream class that reports updates
to a separate WritableStream on a 1s interval.
Value for promptMultipleSelect.
If an object, it must have a title and a value, else it can just be a string.
Shows the given message and waits for the user's input. Returns the user's selected value as string.
Value for promptSelect.
If an object, it must have a title and a value, else it can just be a string.
Shows the given message and waits for the user's input. Returns the user's selected value as string.