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
| Method | Icon | Theme 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.