mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Add yargs-parser package. * Add tests. * More polish. * Bump version. * Switch to namespace. * More work. * Import yargs type.
48 lines
774 B
TypeScript
48 lines
774 B
TypeScript
import parse, { Arguments } from 'yargs-parser';
|
|
|
|
parse('--foo -bar');
|
|
|
|
parse(['--foo', '-bar']);
|
|
|
|
parse(['--foo', '-bar'], {
|
|
boolean: ['b', 'a', 'r'],
|
|
});
|
|
|
|
// prettier-ignore
|
|
// $ExpectError
|
|
parse(['--foo', '-bar'], {
|
|
string: 123,
|
|
});
|
|
|
|
parse(['--foo', '-bar'], {
|
|
// $ExpectError
|
|
unknown: ['b', 'a', 'r'],
|
|
});
|
|
|
|
parse(['--foo', '-bar'], {
|
|
alias: { foo: 'foo', bar: ['bar'] },
|
|
'--': true,
|
|
});
|
|
|
|
parse(['--foo', '-bar'], {
|
|
configuration: {
|
|
'dot-notation': false,
|
|
},
|
|
});
|
|
|
|
parse(['--foo', '-bar'], {
|
|
envPrefix: 'YARG_',
|
|
configuration: {
|
|
// $ExpectError
|
|
'fake-key': true,
|
|
},
|
|
});
|
|
|
|
parse.detailed('--foo -bar');
|
|
|
|
parse.detailed(['--foo', '-bar']);
|
|
|
|
parse.detailed(['--foo'], {});
|
|
|
|
function test(args: Arguments) {}
|