@putout/cli-validate-args
validate args, sugest closest variant
Last updated 3 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/cli-validate-args 
SYNC missed versions from official npm registry.

@putout/cli-validate-args NPM version Dependency Status

Validate args and propose the closes variaint found by fastest-levenshtein:

Invalid option '--fi'. Perhaps you meant '--fix'`

.

Install

npm i @putout/cli-validate-args

Examples

// validate-args.js

import validateArgs from '@putout/cli-validate-args';
import parse from 'yargs-parser';

const argv = process.argv.slice(2);
const yargsConfig = {
    configuration: {
        'strip-aliased': true,
        'strip-dashed': true,
    },
    number: [
        "fix-count",
    ],
    boolean: [
        'fix',
    ],
};

const args = parse(argv, yargsConfig);

const error = await validateArgs(args, [
    ...yargsConfig.boolean,
    ...yargsConfig.number,
]);

if (error) {
    console.error(error.message);
    process.exit(1);
}
$ node validate-args.js --fi
Invalid option '--fi'. Perhaps you meant '--fix'`

License

MIT

Current Tags

  • 2.0.0                                ...           latest (5 months ago)

5 Versions

  • 2.0.0                                ...           5 months ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (10)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE