celeri
v1.0.0
Published
![Alt command line](http://i.imgur.com/DA77U.png)
Downloads
960
Readme
C-e-L-er-I is an es6 command line utility belt library for NodeJS.
Example
{ prompt, confirm } = require("celeri");
var name = yield prompt("What is your name?");
console.log(name);
if (yield confirm("Do you like dog spaghetti?")) {
console.log("awesome!");
}
Utilities
Promise celeri.prompt(label)
Prompts the user for a question
import { prompt } from "celeri";
console.log("Your name is %s", yield prompt("What is your name?"));
Promise celeri.confirm(label, default)
Confirm y/n
import { confirm } from "celeri";
if (yield confirm("Do you like cheese?", true)) {
console.log("you like cheese.");
} else {
console.log("you do not like cheese.");
}
Promise celeri.pickOne(label, items)
Picks one item from a list
import { pickOne, listItem } from "celeri";
var color = yield pickOne("What is your favorite color?", ["red", "green", "blue"]);
console.log("your favorite color is %s", color);
Promise celeri.pickMany(label, items)
Picks many items from a list
var colors = yield pickMany("what are your favorite colors?", ["red", "green", "blue"]);
Promise celeri.secret(label)
Prompts the user for a secret value (hidden from stdout).
var password = yield secret("What's the secret?");
ListItem celeri.listItem(optionsOrValue)
Creates a new list item
optionsOrValue
- options or value of list itemlabel
var glob = require("glob");
var file = yield pickOne("Pick a file", glob.sync(process.cwd() + "/*").map(function(filename) {
return listItem({
label: filename,
value: filename
})
}))