From cfbbe4d15c92c7a5f7a3e6e6a44277d74cdf93cb Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sun, 29 Apr 2018 21:56:57 +0300 Subject: [PATCH 001/285] minor code improvements --- src/config/init.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config/init.ts b/src/config/init.ts index ba4b0dc..15e2b79 100644 --- a/src/config/init.ts +++ b/src/config/init.ts @@ -15,7 +15,7 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -import { Argv } from 'yargs'; +import { Arguments, Argv } from 'yargs'; import * as inquirer from 'inquirer'; import * as fs from 'fs'; import { resolve } from '../../lib/path'; @@ -32,13 +32,13 @@ export const { command, describe, builder, handler } = { return yargs.default('path', '~/.imq'); }, - async handler(argv: any) { + async handler(argv: Arguments) { const configPath = `${resolve(argv.path)}/${CONFIG_FILENAME}`; if (fs.existsSync(configPath)) { console.log('Config already initialized, path:', configPath); - const answer: any = await inquirer.prompt([{ + const answer: any = await inquirer.prompt<{ reInit: boolean }>([{ type: 'confirm', name: 'reInit', message: 'Do you want to re-init?', From 2f9d7774c8c8bb05bf1eb5f1c761ec4ac5b41ee1 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sun, 29 Apr 2018 22:06:12 +0300 Subject: [PATCH 002/285] imq-rpc version up --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2dbebad..66a11ee 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "dependencies": { "@types/inquirer": "0.0.41", "chalk": "^2.4.1", - "imq-rpc": "^1.1.2", + "imq-rpc": "^1.1.3", "inquirer": "^5.2.0", "yargs": "^11.0.0" }, From c1fbf5373286c779c49b83e8a7eaf17f71a91b93 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Mon, 30 Apr 2018 11:18:20 +0300 Subject: [PATCH 003/285] client generate slightly improved --- src/client/generate.ts | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/client/generate.ts b/src/client/generate.ts index 6c58ab2..33bcd1e 100644 --- a/src/client/generate.ts +++ b/src/client/generate.ts @@ -18,7 +18,9 @@ import { Argv, Arguments } from 'yargs'; import { IMQClient } from 'imq-rpc'; import * as fs from 'fs'; +import * as p from 'path'; import * as inquirer from 'inquirer'; +import chalk from 'chalk'; // noinspection JSUnusedGlobalSymbols export const { command, describe, builder, handler } = { @@ -30,34 +32,46 @@ export const { command, describe, builder, handler } = { .option('o', { alias: 'overwrite', describe: 'Overwrite existing client without prompt', - boolean: true, + boolean: true }) .default('path', '.'); }, async handler(argv: Arguments) { const { path, name } = argv; - const filePath = `${path}/${name}.ts`; - - const notExists = await new Promise(resolve => - fs.access(filePath, resolve)); + const filePath = p.resolve(path, `${name}.ts`); + const exists = fs.existsSync(filePath); - if (!argv.o && !notExists) { + if (!argv.o && exists) { const write = (await inquirer.prompt<{overwrite: boolean}>([{ type: 'confirm', name: 'overwrite', default: false, message: `File "${filePath}" already exists. Overwrite it?` }])).overwrite; + if (!write) { + process.stdout.write( + chalk.yellow('File exists, overwrite disabled, exit...') + ); process.exit(0); } } - await IMQClient.create(name, { - compile: false, - path, - }); - console.log('Successfully created. Path:', filePath); + try { + await IMQClient.create(name, { + compile: false, + path + }); + + process.stdout.write( + chalk.green('Successfully created. Path: ') + + chalk.cyan(filePath) + '\n' + ) + } + + catch(err) { + process.stderr.write(chalk.bold.red(err.message) + '\n'); + } } }; From deb969588882a326aa91e6ceaf6502b782e62980 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Mon, 30 Apr 2018 11:23:04 +0300 Subject: [PATCH 004/285] minor code cleanup --- src/client/generate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/generate.ts b/src/client/generate.ts index 33bcd1e..cac8144 100644 --- a/src/client/generate.ts +++ b/src/client/generate.ts @@ -67,7 +67,7 @@ export const { command, describe, builder, handler } = { process.stdout.write( chalk.green('Successfully created. Path: ') + chalk.cyan(filePath) + '\n' - ) + ); } catch(err) { From a9ee817227f86abf612c82a34e755b7986c863d2 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Mon, 30 Apr 2018 15:18:03 +0300 Subject: [PATCH 005/285] completions command implemented --- index.ts | 2 +- lib/index.ts | 19 +++++++++ src/client/generate.ts | 4 +- src/completions.ts | 31 ++++++++++++++ src/completions/off.ts | 66 ++++++++++++++++++++++++++++++ src/completions/on.ts | 91 +++++++++++++++++++++++++++++++++++++++++ test/completions.ts | 30 ++++++++++++++ test/completions/off.ts | 30 ++++++++++++++ test/completions/on.ts | 30 ++++++++++++++ 9 files changed, 300 insertions(+), 3 deletions(-) create mode 100644 lib/index.ts create mode 100644 src/completions.ts create mode 100644 src/completions/off.ts create mode 100644 src/completions/on.ts create mode 100644 test/completions.ts create mode 100644 test/completions/off.ts create mode 100644 test/completions/on.ts diff --git a/index.ts b/index.ts index 8ae3b3d..9660533 100644 --- a/index.ts +++ b/index.ts @@ -19,10 +19,10 @@ import * as yargs from 'yargs'; yargs - .completion() .version(require(`${__dirname}/package.json`).version) .commandDir('src') .demandCommand() + .wrap(yargs.terminalWidth()) .help() .argv ; diff --git a/lib/index.ts b/lib/index.ts new file mode 100644 index 0000000..7882f15 --- /dev/null +++ b/lib/index.ts @@ -0,0 +1,19 @@ +/*! + * IMQ-CLI library: exports + * + * Copyright (c) 2018, Mykhailo Stadnyk + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +export * from './fs'; +export * from './path'; diff --git a/src/client/generate.ts b/src/client/generate.ts index cac8144..2ba31bf 100644 --- a/src/client/generate.ts +++ b/src/client/generate.ts @@ -43,7 +43,7 @@ export const { command, describe, builder, handler } = { const exists = fs.existsSync(filePath); if (!argv.o && exists) { - const write = (await inquirer.prompt<{overwrite: boolean}>([{ + const write = (await inquirer.prompt<{ overwrite: boolean }>([{ type: 'confirm', name: 'overwrite', default: false, @@ -70,7 +70,7 @@ export const { command, describe, builder, handler } = { ); } - catch(err) { + catch (err) { process.stderr.write(chalk.bold.red(err.message) + '\n'); } } diff --git a/src/completions.ts b/src/completions.ts new file mode 100644 index 0000000..f0b1401 --- /dev/null +++ b/src/completions.ts @@ -0,0 +1,31 @@ +/*! + * IMQ-CLI command: completions + * + * Copyright (c) 2018, Mykhailo Stadnyk + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +import { Argv } from "yargs"; + +// noinspection JSUnusedGlobalSymbols +export const { command, describe, builder } = { + command: 'completions', + describe: 'Generates completions script for your shell', + + builder(yargs: Argv) { + return yargs + .commandDir('completions') + .demandCommand() + .help(); + } +}; diff --git a/src/completions/off.ts b/src/completions/off.ts new file mode 100644 index 0000000..4ad9bfe --- /dev/null +++ b/src/completions/off.ts @@ -0,0 +1,66 @@ +/*! + * IMQ-CLI command: completions off + * + * Copyright (c) 2018, Mykhailo Stadnyk + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +import { Argv } from 'yargs'; +import { + existsSync as exists, + readFileSync as read, + writeFileSync as write +} from 'fs'; +import { resolve } from '../../lib'; +import chalk from 'chalk'; + +let PROGRAM: string = ''; + +// noinspection JSUnusedGlobalSymbols +export const { command, describe, builder, handler } = { + command: 'off', + describe: 'Disables completions for this program in your shell', + + builder(yargs: Argv) { + PROGRAM = yargs.argv.$0; + }, + + handler() { + const rxReplace = new RegExp(`###-begin-${PROGRAM}-completions-###` + + '[\\s\\S]*?' + `###-end-${PROGRAM}-completions-###`); + const isZsh = Object.keys(process.env).some(key => /^ZSH/.test(key)); + const rcFilename = isZsh ? '~/.zshrc' : '~/.bashrc'; + const rcFile = resolve(rcFilename); + + try { + if (exists(rcFile)) { + const rcText = read(rcFile, { encoding: 'utf8' }) + .replace(rxReplace, '') + .trim(); + + write(rcFile, rcText, { encoding: 'utf8' }); + } + + process.stdout.write( + chalk.green('Completions removed from ') + + chalk.cyan(`${rcFilename}`) + '\n' + + 'To have these changes to take effect, please, run:\n\n' + + ' $ ' + chalk.cyan(`source ${rcFilename}`) + '\n\n' + ); + } + + catch (err) { + process.stderr.write(chalk.bold.red(err.message)); + } + } +}; diff --git a/src/completions/on.ts b/src/completions/on.ts new file mode 100644 index 0000000..baadc89 --- /dev/null +++ b/src/completions/on.ts @@ -0,0 +1,91 @@ +/*! + * IMQ-CLI command: completions on + * + * Copyright (c) 2018, Mykhailo Stadnyk + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +import { Argv } from 'yargs'; +import { + existsSync as exists, + appendFileSync as append, + readFileSync as read +} from 'fs'; +import { resolve, touch } from '../../lib'; +import chalk from 'chalk'; + +let PROGRAM: string = ''; + +// noinspection JSUnusedGlobalSymbols +export const { command, describe, builder, handler } = { + command: 'on', + describe: 'Enables completions for this program in your shell', + + builder(yargs: Argv) { + PROGRAM = yargs.argv.$0; + }, + + handler() { + const zshScript = Object.keys(process.env).some(key => /^ZSH/.test(key)) + ? 'autoload bashcompinit\nbashcompinit' : ''; + const script = ` +###-begin-${PROGRAM}-completions-### +${zshScript} +_yargs_completions() { + local cur_word args type_list + cur_word="\${COMP_WORDS[COMP_CWORD]}" + args=("\${COMP_WORDS[@]}") + type_list=$(${PROGRAM} --get-yargs-completions "\${args[@]}") + COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) ) + if [ \${#COMPREPLY[@]} -eq 0 ]; then + COMPREPLY=( $(compgen -f -- "\${cur_word}" ) ) + fi + return 0 +} +complete -F _yargs_completions ${PROGRAM} +###-end-${PROGRAM}-completions-###\n`; + const rcFilename = zshScript ? '~/.zshrc' : '~/.bashrc'; + const rcFile = resolve(rcFilename); + + try { + const rcText = read(rcFile, { encoding: 'utf8' }); + const rxExist = new RegExp(`###-begin-${PROGRAM}-completions-###`); + const modify = exists(rcFile) ? append : touch; + + if (!rxExist.test(rcText)) { + modify(rcFile, script); + process.stdout.write( + chalk.green(`Completion script added to `) + + chalk.cyan(rcFilename) + '\n' + + 'To have these changes to take effect, please, run:\n\n' + + ' $ ' + chalk.cyan(`source ${rcFilename}`) + '\n\n' + ); + } + + else { + process.stdout.write( + chalk.yellow.bold( + `Completion script already exists in your ${ + rcFilename}.`) + '\n' + + 'If it does not work, please try one of:\n\n' + + chalk.cyan(' 1. Reload your shell\n') + + chalk.cyan(` 2. Run source ${rcFilename}\n\n`) + ); + } + } + + catch (err) { + process.stderr.write(chalk.bold.red(err.message)); + } + } +}; diff --git a/test/completions.ts b/test/completions.ts new file mode 100644 index 0000000..49798d8 --- /dev/null +++ b/test/completions.ts @@ -0,0 +1,30 @@ +/*! + * IMQ-CLI Unit Tests: completions + * + * Copyright (c) 2018, Mykhailo Stadnyk + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +import './mocks'; +import { expect } from 'chai'; +import * as client from '../src/completions'; + +describe('completions', () => { + it('should be a valid command definition', () => { + expect(typeof client.command).equals('string'); + expect(client.command).contains('completions'); + expect(typeof client.describe).equals('string'); + expect(client.describe).not.to.be.empty; + expect(typeof client.builder).equals('function'); + }); +}); diff --git a/test/completions/off.ts b/test/completions/off.ts new file mode 100644 index 0000000..b7a65f4 --- /dev/null +++ b/test/completions/off.ts @@ -0,0 +1,30 @@ +/*! + * IMQ-CLI Unit Tests: completions off + * + * Copyright (c) 2018, Mykhailo Stadnyk + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +import '../mocks'; +import { expect } from 'chai'; +import * as client from '../../src/completions/off'; + +describe('completions off', () => { + it('should be a valid command definition', () => { + expect(typeof client.command).equals('string'); + expect(client.command).contains('off'); + expect(typeof client.describe).equals('string'); + expect(client.describe).not.to.be.empty; + expect(typeof client.handler).equals('function'); + }); +}); diff --git a/test/completions/on.ts b/test/completions/on.ts new file mode 100644 index 0000000..54952cd --- /dev/null +++ b/test/completions/on.ts @@ -0,0 +1,30 @@ +/*! + * IMQ-CLI Unit Tests: completions on + * + * Copyright (c) 2018, Mykhailo Stadnyk + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +import '../mocks'; +import { expect } from 'chai'; +import * as client from '../../src/completions/on'; + +describe('completions on', () => { + it('should be a valid command definition', () => { + expect(typeof client.command).equals('string'); + expect(client.command).contains('on'); + expect(typeof client.describe).equals('string'); + expect(client.describe).not.to.be.empty; + expect(typeof client.handler).equals('function'); + }); +}); From 96469772ced4b83d4c0cdcc089fb9e7422fc6c0d Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Mon, 30 Apr 2018 15:30:38 +0300 Subject: [PATCH 006/285] minor chnges --- test/lib/fs.ts | 2 +- test/lib/path.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/fs.ts b/test/lib/fs.ts index db4c15f..9a2ceda 100644 --- a/test/lib/fs.ts +++ b/test/lib/fs.ts @@ -21,7 +21,7 @@ import * as os from 'os'; import * as fs from 'fs'; import { uuid } from 'imq-rpc'; import * as p from 'path'; -import { mkdirp, touch } from '../../lib/fs'; +import { mkdirp, touch } from '../../lib'; const TEMP_DIR: string = p.resolve(os.tmpdir(), '.imq-cli-test'); diff --git a/test/lib/path.ts b/test/lib/path.ts index ea4c418..97cce93 100644 --- a/test/lib/path.ts +++ b/test/lib/path.ts @@ -17,7 +17,7 @@ */ import '../mocks'; import { expect } from 'chai'; -import { resolve } from '../../lib/path'; +import { resolve } from '../../lib'; import * as p from 'path'; const HOME: string = process.env['HOME'] || From e2384cab1b6320f3c230d60dbc77b7fb6ae847b3 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Mon, 30 Apr 2018 15:34:34 +0300 Subject: [PATCH 007/285] command definitions fixed --- src/client/patch.ts | 4 ++-- src/config/get.ts | 7 +++---- src/config/set.ts | 10 +++++++--- src/service.ts | 2 +- src/service/create.ts | 6 +++--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/client/patch.ts b/src/client/patch.ts index e83f965..f6367a2 100644 --- a/src/client/patch.ts +++ b/src/client/patch.ts @@ -15,7 +15,7 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -import { Argv } from 'yargs'; +import { Argv, Arguments } from 'yargs'; // noinspection JSUnusedGlobalSymbols export const { command, describe, builder, handler } = { @@ -26,7 +26,7 @@ export const { command, describe, builder, handler } = { return yargs.default('path', '.'); }, - handler(argv: Argv) { + handler(argv: Arguments) { // TODO: implement } }; diff --git a/src/config/get.ts b/src/config/get.ts index 12f3e62..769defb 100644 --- a/src/config/get.ts +++ b/src/config/get.ts @@ -15,7 +15,7 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -import { Argv } from 'yargs'; +import { Argv, Arguments } from 'yargs'; // noinspection JSUnusedGlobalSymbols export const { command, describe, builder, handler } = { @@ -24,11 +24,10 @@ export const { command, describe, builder, handler } = { 'not provided, will list all config options', builder(yargs: Argv) { - return yargs - .default('option', ''); + return yargs.default('option', ''); }, - handler(argv: Argv) { + handler(argv: Arguments) { // TODO: implement } }; diff --git a/src/config/set.ts b/src/config/set.ts index 892ce4a..6b85b8a 100644 --- a/src/config/set.ts +++ b/src/config/set.ts @@ -15,14 +15,18 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -import { Argv } from 'yargs'; +import { Argv, Arguments } from 'yargs'; // noinspection JSUnusedGlobalSymbols -export const { command, describe, handler } = { +export const { command, describe, builder, handler } = { command: 'set