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 |
|
|
6 |
|
/*jslint nomen: true */ |
7 |
1 |
var Factory = require('../util/factory'), |
8 |
|
factory = new Factory('command', __dirname, true); |
9 |
|
|
10 |
1 |
function Command() {} |
11 |
|
// add register, create, mix, loadAll, getCommandList, resolveCommandName to the Command object |
12 |
1 |
factory.bindClassMethods(Command); |
13 |
|
|
14 |
1 |
Command.prototype = { |
15 |
|
toolName: function () { |
16 |
16 |
return require('../util/meta').NAME; |
17 |
|
}, |
18 |
|
|
19 |
|
type: function () { |
20 |
12 |
return this.constructor.TYPE; |
21 |
|
}, |
22 |
|
synopsis: function () { |
23 |
|
return "the developer has not written a one-line summary of the " + this.type() + " command"; |
24 |
|
}, |
25 |
|
usage: function () { |
26 |
|
console.error("the developer has not provided a usage for the " + this.type() + " command"); |
27 |
|
}, |
28 |
|
run: function (args) { |
29 |
|
throw new Error("run: must be overridden for the " + this.type() + " command"); |
30 |
|
} |
31 |
|
}; |
32 |
|
|
33 |
1 |
module.exports = Command; |
34 |
|
|
35 |
|
|