Skip to content

Commit 5a5db1c

Browse files
committed
Add support for install from url
1 parent 43adba9 commit 5a5db1c

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/commands/install.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,30 @@ var request = require("../request");
1818

1919
function command(argv,result) {
2020
var module = argv._[1];
21+
var url = argv._[2];
2122
if (!module) {
2223
return result.help(command);
2324
}
25+
26+
var data = {}
27+
var m = /^(.+)@(.+)$/.exec(module);
28+
if (m) {
29+
data.module = m[1];
30+
data.version = m[2]
31+
} else {
32+
data.module = module;
33+
}
34+
if (url) {
35+
data.url = url;
36+
}
2437
return request.request('/nodes', {
2538
method: "POST",
26-
data: {
27-
module: module
28-
}
39+
data: data
2940
}).then(result.logDetails).catch(result.warn);
3041
}
3142
command.alias = "install";
32-
command.usage = command.alias+" <module>";
33-
command.description = "Install the module from NPM";
43+
command.usage = command.alias+" <module> [<url>]";
44+
command.description = "Install a module.";
3445

3546

3647
module.exports = command;

0 commit comments

Comments
 (0)