import * as ayonliJsext from "https://deno.land/x/ayonli_jsext@v0.9.72/cli.ts";
Useful utility functions for interacting with the terminal.
NOTE: Despite the name of this module, many of its functions can also be used in the browser environment.
Variables
v args | The command-line arguments passed to the program. |
^H - Backspace on Linux and Windows | |
^M - Enter on macOS and Windows (CRLF) | |
^A - Start of line | |
^C - Cancel | |
^E - End of line | |
^? - Backspace on macOS | |
^[ - Escape | |
^J - Enter on Linux | |
^I - Tab | |
Disable alternate screen buffer | |
Enable alternate screen buffer | |
Clear the current line | |
Clear the screen from the cursor down | |
Clear the left side of the cursor | |
Clear the right side of the cursor | |
Clear the entire screen | |
Clear the screen from the cursor up | |
Hide the cursor | |
Disable mouse tracking | |
Enable mouse tracking | |
Disable mouse wheel scrolling | |
Enable mouse wheel scrolling | |
Disable bracketed paste mode | |
Enable bracketed paste mode | |
Show the cursor | |
Disable line wrapping | |
Enable line wrapping | |
Whether the standard IO is a text terminal. | |
Functions
Returns the width of a single character. | |
f edit | Opens the given file in a text editor. |
Returns the current size of the application window. | |
Returns | |
Checks if the program is running in Windows Subsystem for Linux. | |
Requests the standard input to be used only by the given task until it is completed. | |
Moves the cursor to the left base on the width of the given string. | |
Moves the cursor to the right base on the width of the given string. | |
Parses the given CLI arguments into an object. | |
Executes the script inside PowerShell as if they were typed at the PowerShell command prompt. | |
Quotes a string to be used as a single argument to a shell command. | |
Reads a chunk of data from the standard input. This could be a single key stroke, or a multi-byte sequence for input from an IME. | |
f run | Executes a command in the terminal and returns the exit code and outputs. |
Returns the width of a string. | |
f sudo | Executes a command with elevated privileges using |
Returns the path of the given command if it exists in the system,
otherwise returns | |
Writes a chunk of data to the standard output. | |
Writes a chunk of data to the standard output synchronously. |
Interfaces
The result of command execution functions such as the run, powershell and sudo. | |
Options for parsing CLI arguments, used by the parseArgs function. | |
Options for the sudo function. |