@clack/core

v1.1.0
  • Types
  • ESM

Clack contains low-level primitives for implementing your own command-line applications.

License
MIT
Install Size
136 kB/-
Vulns
0
Published

Get started

$npm install @clack/core
$pnpm add @clack/core
$yarn add @clack/core
$bun add @clack/core
$deno add npm:@clack/core
$vlt install @clack/core

Readme

@clack/core

Clack contains low-level primitives for implementing your own command-line applications.

Currently, TextPrompt, SelectPrompt, and ConfirmPrompt are exposed as well as the base Prompt class.

Each Prompt accepts a render function.

import { TextPrompt, isCancel } from '@clack/core';

const p = new TextPrompt({
  render() {
    return `What's your name?\n${this.userInputWithCursor}`;
  },
});

const name = await p.prompt();
if (isCancel(name)) {
  process.exit(0);
}