x/cliffy@v0.24.2

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
GitHub Stars
411
Latest
ansi/
command/
examples/
flags/
keycode/
keypress/
prompt/
table/
import * as cliffy from "https://deno.land/x/cliffy@v0.24.2/mod.ts";

Classes

ActionListType

Completion list type.

BooleanType

Boolean type with auto completion. Allows true, false, 0 and 1.

Cell

Cell representation.

Checkbox

Checkbox prompt representation.

ChildCommandType

String type with auto completion of child command names.

Command
CompletionsCommand

Generates shell completion scripts for various shells.

Confirm

Confirm prompt representation.

EnumType

Enum type. Allows only provided values.

FileType

Integer type.

GenericInput abstract

Generic input prompt representation.

GenericList abstract

Generic list prompt representation.

GenericPrompt abstract

Generic prompt representation.

HelpCommand

Generates well formatted and colored help output for specified command.

Input

Input prompt representation.

List

List prompt representation.

Number

Number prompt representation.

NumberType

Number type.

Row

Row representation.

Secret

Secret prompt representation.

Select

Select prompt representation.

StringType

String type. Allows any value.

Table

Table representation.

Toggle

Toggle prompt representation.

Type abstract

Base class for custom types.

ValidationError

Enums

OptionType

Available build-in argument types.

Variables

ansi

Chainable ansi escape sequences. If invoked as method, a new Ansi instance will be returned.

await Deno.stdout.write(
  new TextEncoder().encode(
    ansi.cursorTo(0, 0).eraseScreen(),
  ),
);

Or shorter:

await Deno.stdout.write(
  ansi.cursorTo(0, 0).eraseScreen.toBuffer(),
);
bel

Ring audio bell: \u0007

boolean

Boolean type handler. Excepts true, false, 1, 0

clearScreen

Clear the terminal screen. (Viewport)

clearTerminal

Clear the whole terminal, including scrollback buffer. (Not just the visible part of it).

colors
cursorHide

Hide cursor.

cursorLeft

Move cursor to first column of current row.

cursorPosition

Get cursor position.

cursorRestore

Restore cursor.

cursorSave

Save cursor.

cursorShow

Show cursor.

eraseLine

Clear current line.

eraseLineEnd

Clear to line end.

eraseLineStart

Clear to line start.

eraseScreen

Clear screen.

Figures

Prompt icons.

KeyMap

Base key mapping.

KeyMapCtrl

Ctrl key mapping.

KeyMapShift

Shift key mapping.

number

Number type handler. Excepts any numeric value.

SpecialKeyMap

Special key mapping.

string

String type handler. Excepts any value.

tty

Chainable ansi escape sequences. If invoked as method, a new Tty instance will be returned.

tty.cursorTo(0, 0).eraseScreen();

Functions

cursorBackward

Move cursor backward by n lines.

cursorDown

Move cursor down by n lines.

cursorForward

Move cursor forward by n lines.

cursorMove

Move cursor by offset.

cursorNextLine

Move cursor to the beginning of the line n lines down.

cursorPrevLine

Move cursor to the beginning of the line n lines up.

cursorTo

Move cursor to x, y, counting from the top left corner.

cursorUp

Move cursor up by n lines.

eraseDown

Clear screen down by n lines.

eraseLines

Clear screen and move cursor by n lines up and move cursor to first column.

eraseUp

Clear screen up by n lines.

getCursorPosition

Get cursor position.

getFiguresByKeys
image

Create image.

inject

Inject prompt values. Can be used for unit tests or pre selections.

link

Create link.

parse

Parse ansi escape sequence.

parseFlags

Parse command line arguments.

prompt
scrollDown

Scroll window down by n lines.

scrollUp

Scroll window up by n lines.

validateFlags

Flags post validation. Validations that are not already done by the parser.

Interfaces

AnsiChain

Ansi instance returned by all ansi escape properties.

Chain

Chainable ansi escape method declarations.

CheckboxKeys

Checkbox key options.

CheckboxOption

Checkbox option options.

CheckboxOptions

Checkbox prompt options.

CheckboxOptionSettings

Checkbox option settings.

ConfirmOptions

Confirm prompt options.

Cursor

Cursor position.

CursorPositionOptions

Cursor position options.

GenericInputKeys

Input keys options.

GenericInputPromptOptions

Generic input prompt options.

GenericInputPromptSettings

Generic input prompt settings.

GenericListKeys

Select key options.

GenericListOption

Generic list option options.

GenericListOptions

Generic list prompt options.

GenericListOptionSettings

Generic list option settings.

GenericListSettings

Generic list prompt settings.

GenericPromptKeys

Input keys options.

GenericPromptOptions

Generic prompt options.

GenericPromptSettings

Generic prompt settings.

GlobalPromptOptions

Global prompt options.

IArgument

Argument details.

ICellOptions

Cell options.

ICommandGlobalOption

Command option options.

ICommandOption
ICompleteOptions

Completion options.

ICompletion

Completion settings.

IEnvVar

Environment variable settings.

IEnvVarOptions

Environment variable options

IExample

Example settings.

IFlagArgument

Flag argument definition.

IFlagOptions

Flag options.

IFlagsResult

Result of the parseFlags method.

IGlobalEnvVarOptions

Environment variable options

ImageOptions

Image options.

InputOptions

Input prompt options.

IOption

Command option settings.

IParseOptions

Parser options.

IParseResult

Result of cmd.parse() method.

IRowOptions

Row options.

ITableOptions

Table options.

ITableSettings

Table settings.

IType

Type settings.

ITypeInfo

Type details.

ITypeOptions

Type options.

KeyCode
ListOptions

List prompt options.

NumberKeys

Number key options.

NumberOptions

Number prompt options.

SecretOptions

Secret prompt options.

SelectOptions

Select prompt options.

SelectSettings

Select prompt settings.

StaticGenericPrompt

Static generic prompt interface.

ToggleKeys

Toggle key options.

ToggleOptions

Generic prompt options.

TtyChain

Ansi instance returned by all ansi escape properties.

TtyOptions

Create new Ansi instance.

ValidationErrorOptions

Type Aliases

Ansi

Chainable ansi escape sequences. If invoked as method, a new Ansi instance will be returned.

AnsiFactory

Create new Ansi instance.

CheckboxValueOptions

Checkbox options type.

CheckboxValueSettings

Checkbox option settings type.

Colors

Chainable colors module. If invoked as method, a new Colors instance will be returned.

ColorsChain

Chainable colors instance returned by all ansi escape properties.

ColorsFactory

Create new Colors instance.

CompleteHandlerResult
ConfirmKeys
Direction
GenericListValueOptions
GenericListValueSettings
IAction

Action handler for commands and options.

IBorderOptions

Border characters settings.

ICell

Cell type

ICompleteHandler

Type parser method.

IDataRow

Json row.

IDefaultValue

Default flag value

IDescription

Description handler.

IEnvVarValueHandler
IFlagValueHandler

Value handler for custom value processing.

IHelpHandler

Help callback method to print the help. Invoked by the --help option and help command and the .getHelp() and .showHelp() methods.

InputKeys
IRow

Row type

ITable

Table type.

ITypeHandler

Custom type handler/parser.

IVersionHandler

Version callback method to print the version. Invoked by the --help option command and the .getVersion() and .showHelp() methods.

ListKeys

List key options.

MapTypes
SecretKeys

Secret key options.

SelectKeys

Select key options.

SelectOption

Select option options.

SelectOptionSettings

Select option settings.

SelectValueOptions

Select options type.

SelectValueSettings

Select option settings type.

Tty

Chainable ansi escape sequences. If invoked as method, a new Tty instance will be returned.

TtyFactory

Create new Tty instance.

TypeOrTypeHandler
TypeValue
ValidateResult

Prompt validation return tape.

ValuesHandlerResult

Cliffy is a simple and type-safe commandline framework for building complex commandline tools with deno.

Latest version Build status Code coverage Issues License

Discord deno.land nest.land

⚠️ This project is still under development. Expect breaking changes.

Documentation

The documentation is available on cliffy.io.

Modules

Following modules are included in cliffy:

  • ansi: Chainable ansi escape sequences.

  • command: Create complex and type-safe commandline tools with build-in input validation, auto generated help, shell completions and more.

  • flags: Parse command line arguments (used by the command module).

  • keycode: Parser ansi key codes.

  • keypress: Listen to keypress events with Promise, AsyncIterator and EventTarget APIs.

  • prompt: Create simple and powerful interactive prompts.

  • table: Create cli tables with border, padding, nested tables, etc...

Contributing

Any kind of contribution is welcome! Please take a look at the contributing guidelines.

License

MIT