Various updates.
This commit is contained in:
parent
8b65a75235
commit
29398b9869
@ -1,11 +1,22 @@
|
||||
{
|
||||
"name": "xo-cli",
|
||||
"version": "0.1.1",
|
||||
"license": "AGPL3",
|
||||
"description": "Basic CLI for Xen-Orchestra",
|
||||
"author": "Julien Fontanet <julien.fontanet@vates.fr>",
|
||||
"keywords": [
|
||||
"xo",
|
||||
"xen-orchestra",
|
||||
"xen",
|
||||
"orchestra"
|
||||
],
|
||||
"homepage": "https://github.com/vatesfr/xo-cli",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vatesfr/xo-cli"
|
||||
"bugs": "https://github.com/vatesfr/xo-cli/issues",
|
||||
"author": "Julien Fontanet <julien.fontanet@vates.fr>",
|
||||
"preferGlobal": true,
|
||||
"main": "./src/cli.js",
|
||||
"directories": {
|
||||
"bin": "./bin",
|
||||
"man": "./man"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -24,16 +35,11 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^1.9.0",
|
||||
"human-format": "^0.1.0",
|
||||
"mocha": "^1.18.0",
|
||||
"mocha-promise": "0.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha cli.spec.js"
|
||||
},
|
||||
"main": "cli.js",
|
||||
"bin": {
|
||||
"xo-cli": "bin/xo-cli"
|
||||
},
|
||||
"preferGlobal": true,
|
||||
"license": "AGPL3"
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ module.exports = function (argv) {
|
||||
{
|
||||
prompts.push({
|
||||
name: name,
|
||||
message: def.prompt || def.description,
|
||||
message: def.prompt || def.description || name,
|
||||
type: def.promptType || 'input',
|
||||
});
|
||||
}
|
||||
@ -167,6 +167,23 @@ module.exports = function (argv) {
|
||||
}).bind();
|
||||
});
|
||||
|
||||
registerCommand('list-commands', {}, function () {
|
||||
return connect().then(function (xo) {
|
||||
return xo.send('system.listMethods').then(JSON.stringify);
|
||||
});
|
||||
});
|
||||
registerCommand('show-command', {
|
||||
args: {
|
||||
name: {
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
}, function (opts) {
|
||||
return connect().then(function (xo) {
|
||||
return xo.send('system.methodSignature', {name: opts.name}).then(console.log);
|
||||
});
|
||||
});
|
||||
|
||||
registerCommand('whoami', {
|
||||
description: 'displays information about the current user',
|
||||
}, function () {
|
||||
@ -186,7 +203,16 @@ module.exports = function (argv) {
|
||||
});
|
||||
|
||||
// TODO: handle global `--config FILE` option.
|
||||
nomnom.parse(argv);
|
||||
nomnom
|
||||
.option('version', {
|
||||
flag: true,
|
||||
help: 'prints the current version of xo-cli',
|
||||
callback: function () {
|
||||
return 'xo-cli version '+ require('../package').version;
|
||||
},
|
||||
})
|
||||
.parse(argv)
|
||||
;
|
||||
|
||||
// Executes the selected command.
|
||||
Promise.try(command, [commandOpts]).then(function (value) {
|
Loading…
Reference in New Issue
Block a user