const vorpal = require('vorpal')();
vorpal
.command('say [words...]')
.option('-b, --backwards')
.option('-t, --twice')
.action(function (args, callback) {
let str = args.words.join(' ');
str = (args.options.backwards) ?
str.split('').reverse().join('') :
str;
this.log(str);
callback();
});
const vorpal = require('vorpal')();
vorpal
.command('say [words...]')
.action(function (args, cb) {
this.log(args.words.join(' '));
cb();
});
vorpal
.command('reverse [words...]')
.action(function (args, cb) {
this.log(args.stdin.split('').reverse().join(''));
cb();
});
vorpal
.command('color [color] [text...]')
.action(function (args, cb) {
this.log(vorpal.chalk[args.color](args.stdin));
cb();
});
const vorpal = require('vorpal')();
vorpal
.command('order pizza')
.option('--anchovies')
.action(function (args, cb) {
const self = this;
this.prompt({
type: 'input',
name: 'time',
message: 'When would you like your pizza?'
}, function (result) {
self.log(`Okay, ${result.time} it is!`);
cb();
});
});
const vorpal = require('vorpal')();
const foods = ['burgers', 'chinese', 'pizza', 'sushi'];
const methods = ['a la carte', 'table d\'hote'];
const commandHelp = 'Order a type of food';
const optionHelp = 'How you want your meal served';
vorpal
.command('order ', commandHelp)
.option('--method [method]', optionHelp, methods)
.autocomplete(foods)
.action(function (args, cb) {
const food = args.food;
const method = args.options.method;
this.log(`You ordered ${food} ${method}.`);
cb();
});
const Vorpal = require('vorpal');
const chalk = Vorpal().chalk;
const unicorns = Vorpal()
.delimiter(chalk.magenta('unicorn-land~$'))
.help(require('./unicorn-help.js'))
.use(require('./unicorn-commands'))
.history('unicorn-command-history');
const narwhals = Vorpal()
.delimiter(chalk.cyan('narwhal-land~$'))
.help(require('./narwhal-help.js'))
.use(require('./narwhal-commands'))
.history('narwhal-command-history');
unicorns
.find('exit')
.remove();
unicorns
.show()
.parse(process.argv);