hueadm
Version:
A command line management interface to phillips hue
38 lines (29 loc) • 727 B
JavaScript
var common = require('../common');
module.exports = deleteRule;
function deleteRule(subcmd, opts, args, cb) {
var self = this;
var finish = common.makeFinisher(opts, cb);
if (opts.help) {
self.do_help('help', {}, [subcmd], cb);
return;
}
var id = parseInt(args.shift(), 10);
if (isNaN(id)) {
cb(new Error('`id` argument must be a number'));
return;
}
self.client.deleteRule(id, finish);
}
deleteRule.options = [
{
names: ['help', 'h'],
type: 'bool',
help: 'Show this help.'
},
{
names: ['json', 'j'],
type: 'bool',
help: 'JSON output.'
}
];
deleteRule.help = 'Delete a rule\n\n{{options}}';