Pear Terminal User Interface library
> Pear Terminal User Interface library
Strings for CLI banners & footers.
Returns { header, version, banner, footer }.
Ask user to trust or unlock an app/template.
Returns Promise.
- ipc: { permit({ key, password? }), close() }
- info: { key: Buffer|string, encrypted: boolean }
- cmd: 'run'|'init'|'stage'|'seed'|'dump'|'info'
One-shot confirmation prompt.
Returns Promise.
- dialog: string preface text
- ask: string prompt label
- delim: string delimiter (e.g. ':' or '?')validation
- : (value:string) => boolean|Promisemsg
- : string error message on invalid input
Interactive prompt runner.
- header: string shown once before promptsparams
- : Array<{ name, prompt, default?, delim?, validation?, msg?, shave? }>opts.masked
- : boolean mask user input (passwords)opts.defaults
- : { [name:string]: any } fallback values
#### interact.run([opts])
Process prompts and return answers.
Returns Promise<{ fields, shave }>.
- opts.autosubmit: boolean fill with defaults without prompting
Thin stdio wrapper with Bare/TTY streams.
Returns object with:
- in, out, err: lazy streamssize() -> { width, height }
- raw(bool) -> void
- set raw modedrained(stream) -> Promise
- inAttached
- : boolean
ANSI styling helpers (no-op on Windows).
Returns object with:
- text: bold, dim, italic, underline, inverse, red, green, yellow, grayupHome(n)
- cursor: , hideCursor(), showCursor()link(url, text?)
- links: sep, tick, cross, warning, pear, dot, key, down, up
- glyphs:
Status glyph helper.
Returns string.
- value: true|false|null|number (>0 success, <0 fail, 0|null neutral)type
- : 'success'|'diff' (diff: + | - | ~)
Live status line (TTY-aware).
Returns void.
- message: stringsuccess
- : boolean|null|number (see indicator)
Plain line print with optional status glyph.
Returns void.
- message: stringsuccess
- : boolean|null|number
Pretty-print byte deltas.
Returns void.
- type: any value passed to indicator(..., 'diff')sizes
- : number[] byte changes (signed)message
- : string
Create a stream consumer that routes tagged events to print/status (TTY) or JSON.
Returns (opts, stream, info?, ipc?) -> Promise.
- cmd: string command nametaggers
- : { [tag]: (data, info, ipc) => string|{ output, message, success }|false|Promise<...> }output
- : 'print'|'status'message
- : string|string[]success
- : booleanopts
- : { json?: boolean, log?: (msg, { output, success? }) => void, ctrlTTY?: boolean }stream
- : Readable|Array of { tag, data } eventsinfo
- : any extra contextipc
- : optional IPC handle
Behavior:
- opts.json === true → emits JSON lines: { cmd, tag, data }tagger
- result false:tag==='final'
- for prints default success/failure
- otherwise suppressed
- TTY: hides/shows cursor, handles Ctrl+C cleanup
Processes failure mode flow for various Pear scenarios that prints sensible output showing stacks for operational errors and beautified output user errors.
Returns void.
- bail: a paparam bail object
boolean indicating stdin TTY status.
Format bytes into human-friendly string.
Returns string`.
Apache-2.0