Face
Build CLI app with joy
Install
$ npm install --save face
Example
const App = ;const app = ; app;
API
app.argv
The parsed user input. Using minimist
app.cmd(template, callback)
Execute the callback if the user inputs the template
Example
app;
app.opt(opts, callback)
Execute the callback if the user inputs the option
Example
app;
app.help(callback)
Execute the help function if the user inputs -h, --h or nothing
Example
app;
app.print(string)
Wrapper for process.stdout. Using perfume to stylize output
Example
app; // apply `red` to 'World' and `bold` to the wholeapp; // prints emoji
app.println(string)
Wrapper for process.stdout. Using perfume to stylize output
Example
app; // apply `red` to 'World' and `bold` to the wholeapp; // prints emoji
app.ask(question, callback, options)
Prompt for user input
Example
app; // Options app;
app.store(path, initVal)
Use JSON to store data in
path
. Createsapp.storage
to manage data
Example
app;appstoragedataname = "Voyga";appstorage;
app.update(path)
Execute the callback if there's an update. Using update-notifier
Example
app;
app.size
The terminal window size
Example
console;console;
app.on(event, callback)
Execute the callback on a certain event
Example
// Current available events: `exit`, `key` app;
app.cursor
Hide and show the cursor. Using cli-cursor
Example
appcursor;appcursor;
app.clearScreen()
Clear the terminal screen
app.clearLine()
Clear a line of output
app.exec(cmd, callback, options)
Wrapper for
childProcess.exec
app.exit(code)
Wrapper for
process.exit