UNPKG

1.15 kBJavaScriptView Raw
1/*
2 Copyright (c) 2012, Yahoo! Inc. All rights reserved.
3 Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
4 */
5
6var Factory = require('../util/factory'),
7 factory = new Factory('command', __dirname, true);
8
9function Command() {}
10// add register, create, mix, loadAll, getCommandList, resolveCommandName to the Command object
11factory.bindClassMethods(Command);
12
13Command.prototype = {
14 toolName: function () {
15 return require('../util/meta').NAME;
16 },
17
18 type: function () {
19 return this.constructor.TYPE;
20 },
21 synopsis: /* istanbul ignore next: base method */ function () {
22 return "the developer has not written a one-line summary of the " + this.type() + " command";
23 },
24 usage: /* istanbul ignore next: base method */ function () {
25 console.error("the developer has not provided a usage for the " + this.type() + " command");
26 },
27 run: /* istanbul ignore next: abstract method */ function (args, callback) {
28 return callback(new Error("run: must be overridden for the " + this.type() + " command"));
29 }
30};
31
32module.exports = Command;
33