termprompt

Log & Display

Structured logging, intro/outro markers, and notes.

Preview

log output
my-cli
Starting build...
Build complete.
No tests found.
Linter failed.
Running migrations...
Plain text, no icon.
Done!

Intro / Outro

Wrap your CLI flow with visual bookends.

import { intro, outro } from 'termprompt';

intro('my-cli');
// ... prompts ...
outro('Done!');

Both accept an optional string. Without it, they render just the box-drawing character.

intro
my-cli
outro
Done!

Log

Structured log messages with colored icons.

import { log } from 'termprompt';

log.info('Starting build...');
log.success('Build complete.');
log.warn('No tests found.');
log.error('Build failed.');
log.step('Running migrations...');
log.message('Plain text, no icon.');

Methods

MethodIconTheme color
log.info (info)info
log.success (diamond)success
log.warn (triangle)warning
log.error (triangle)error
log.step (bar)Gray
log.message (bar)Gray

Colors are customizable via setTheme.

all log levels
Starting build...
Build complete.
No tests found.
Build failed.
Running migrations...
Plain text, no icon.

Note

Display a boxed note with an optional title.

import { note } from 'termprompt';

note('Remember to set DATABASE_URL\nbefore running migrations.', 'Important');
note with title
──────────────────────────────────
Important
Remember to set DATABASE_URL
before running migrations.
──────────────────────────────────

The note is wrapped in horizontal rules. If a title is provided, it appears in bold above the content, using the success theme color.

On this page