Nonflavored Prescription Medicine
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

castle

0.1.3 • Public • Published

Castle

Terminal utils for happy scripting

Build Status

Installing

npm install castle

API

castle.prompt(message, options);

message (string, required) — message to display options (object, optional) — see options below:

option type default value description
allowEmpty boolean true If false will ask again on empty input
defaultValue string undefined Uses default value on empty input
style string prompt.Style.Default Specifies prompt color, supported values: prompt.Style.Default, prompt.Style.Dangerous (red)
const {prompt} = require('castle');
 
prompt('Your name');
prompt
const name = await prompt('Your name', {defaultValue: 'Anonymous'});
prompt with default value

castle.confirm(message, options);

message (string, required) — message to display options (object, optional) — see options below:

option type default value description
allowEmpty boolean true If false will ask again on empty input, otherwise treats empty input as negative answer
defaultValue boolean undefined Uses default value on empty input
style string prompt.Style.Default Specifies prompt color, supported values: confirm.Style.Default, confirm.Style.Dangerous (red)
const {confirm} = require('castle');
 
const isConfirmed = await confirm('Proceed?');
confirm

Install

npm i castle

DownloadsWeekly Downloads

0

Version

0.1.3

License

ISC

Unpacked Size

53.6 kB

Total Files

10

Last publish

Collaborators

  • avatar