feat(xapi): add xo-xapi CLI
Allows to easily test @xen-orchestra/xapi features.
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
"files": [
|
||||
"dist/"
|
||||
],
|
||||
"bin": {
|
||||
"xo-xapi": "./dist/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.10"
|
||||
},
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
"bind-property-descriptor": "^1.0.0",
|
||||
"blocked": "^1.2.1",
|
||||
"debug": "^4.0.1",
|
||||
"exec-promise": "^0.7.0",
|
||||
"http-request-plus": "^0.8.0",
|
||||
"jest-diff": "^26.4.2",
|
||||
"json-rpc-protocol": "^0.13.1",
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import blocked from 'blocked'
|
||||
import createDebug from 'debug'
|
||||
import diff from 'jest-diff'
|
||||
import execPromise from 'exec-promise'
|
||||
import minimist from 'minimist'
|
||||
import pw from 'pw'
|
||||
import { asCallback, fromCallback, fromEvent } from 'promise-toolbox'
|
||||
@@ -11,8 +10,6 @@ import { filter, find } from 'lodash'
|
||||
import { getBoundPropertyDescriptor } from 'bind-property-descriptor'
|
||||
import { start as createRepl } from 'repl'
|
||||
|
||||
import { createClient } from './'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
function askPassword(prompt = 'Password: ') {
|
||||
@@ -43,8 +40,8 @@ function getAllBoundDescriptors(object) {
|
||||
|
||||
const usage = 'Usage: xen-api <url> [<user> [<password>]]'
|
||||
|
||||
const main = async args => {
|
||||
const opts = minimist(args, {
|
||||
async function main(createClient) {
|
||||
const opts = minimist(process.argv.slice(2), {
|
||||
boolean: ['allow-unauthorized', 'help', 'read-only', 'verbose'],
|
||||
|
||||
alias: {
|
||||
@@ -124,5 +121,5 @@ const main = async args => {
|
||||
export default main
|
||||
|
||||
if (!module.parent) {
|
||||
execPromise(main)
|
||||
main(require('./').createClient).catch(console.error.bind(console, 'FATAL'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user