UNPKG

ryuu

Version:

Domo App Dev Studio CLI, The main tool used to create, edit, and publish app designs to Domo

56 lines 2.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var log_1 = require("../util/log"); var inquirer = require("inquirer"); var Configstore = require("configstore"); module.exports = function (program) { program .command('proxy [host] [port]') .description('configure the proxy through which you wish to send all commands') //.option('-u, --username <value>, Username for authentication based proxy') //.option('-p, --password <value>, Password for authentication based proxy') .option('-r, --remove-proxy', 'Remove current proxy settings') .option('-a, --auth, Flag for if you wish to enter a username for your corporate proxy (password will be prompted on each command)') .action(function (host, port, options) { if (options['removeProxy']) { var proxy = new Configstore('/proxy'); proxy.delete('host'); proxy.delete('port'); proxy.delete('username'); log_1.log.ok('Proxy Removed!'); } else { var prompts = []; if (options['auth']) { prompts.push({ type: 'input', message: "Please enter your username:", name: 'username' }); } prompts.push({ type: 'confirm', message: "You are about to set all requests to go through proxy ".concat(host, ":").concat(port, ", are you sure you want to do this?"), name: 'proxy', default: false }); inquirer .prompt(prompts) .then(handleUserResponse) .catch(function (err) { return console.log("Login unsuccessful: ".concat(JSON.stringify(err))); }); } function handleUserResponse(answer) { if (answer.proxy) { var proxy = new Configstore('/proxy'); proxy.set('host', host); proxy.set('port', port); proxy.set('username', answer.username); log_1.log.ok('Proxy set for all future commands'); } else { log_1.log.fail('Proxy command aborted'); } } }); }; //# sourceMappingURL=proxy.js.map