UNPKG

vodafone-station-cli

Version:

Access your Vodafone Station from the comfort of the command line.

46 lines (45 loc) 1.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const core_1 = require("@oclif/core"); const base_command_1 = tslib_1.__importStar(require("../../base-command")); const host_exposure_1 = require("../../modem/host-exposure"); class DisableHostExposureEntries extends base_command_1.default { static args = { entries: core_1.Args.string({ description: 'Host exposure entries to disable. Pass no names to disable every existing entry.', required: false, }), }; static description = 'Disable a set of host exposure entries'; static examples = [ '$ vodafone-station-cli host-exposure:disable -p PASSWORD [ENTRY NAME | [ENTRY NAME...]]', '$ vodafone-station-cli host-exposure:disable -p PASSWORD --ip 192.168.100.1 [ENTRY NAME | [ENTRY NAME...]]', ]; static flags = { ip: (0, base_command_1.ipFlag)(), password: core_1.Flags.string({ char: 'p', description: 'router/modem password', }), }; static strict = false; async run() { const { argv, flags } = await this.parse(DisableHostExposureEntries); const password = flags.password ?? process.env.VODAFONE_ROUTER_PASSWORD; if (!password || password === '') { this.log('You must provide a password either using -p or by setting the environment variable VODAFONE_ROUTER_PASSWORD'); return; } const discoveryOptions = { ip: flags.ip, }; try { await (0, host_exposure_1.toggleHostExposureEntries)(false, argv, password, this.logger, discoveryOptions); } catch (error) { this.error(error, { message: 'Something went wrong.' }); } } } exports.default = DisableHostExposureEntries;