@types/yargs-parser
- Version 21.0.3
- Published
- 8.65 kB
- No dependencies
- MIT license
Install
npm i @types/yargs-parser
yarn add @types/yargs-parser
pnpm add @types/yargs-parser
Overview
TypeScript definitions for yargs-parser
Index
Variables
Interfaces
Configuration
- "boolean-negation"
- "camel-case-expansion"
- "combine-arrays"
- "dot-notation"
- "duplicate-arguments-array"
- "flatten-duplicate-arrays"
- "greedy-arrays"
- "halt-at-non-option"
- "nargs-eats-options"
- "negation-prefix"
- "parse-numbers"
- "parse-positional-numbers"
- "populate--"
- "set-placeholder-key"
- "short-option-groups"
- "strip-aliased"
- "strip-dashed"
- "unknown-options-as-args"
Variables
variable yargsParser
var yargsParser: yargsParser.Parser;
Interfaces
interface Arguments
interface Arguments {}
property "--"
'--'?: Array<string | number>;
Arguments after the end-of-options flag
--
index signature
[argName: string]: any;
All remaining options
interface Configuration
interface Configuration {}
property "boolean-negation"
'boolean-negation': boolean;
Should variables prefixed with --no be treated as negations? Default is
true
property "camel-case-expansion"
'camel-case-expansion': boolean;
Should hyphenated arguments be expanded into camel-case aliases? Default is
true
property "combine-arrays"
'combine-arrays': boolean;
Should arrays be combined when provided by both command line arguments and a configuration file. Default is
false
property "dot-notation"
'dot-notation': boolean;
Should keys that contain . be treated as objects? Default is
true
property "duplicate-arguments-array"
'duplicate-arguments-array': boolean;
Should arguments be coerced into an array when duplicated. Default is
true
property "flatten-duplicate-arrays"
'flatten-duplicate-arrays': boolean;
Should array arguments be coerced into a single array when duplicated. Default is
true
property "greedy-arrays"
'greedy-arrays': boolean;
Should arrays consume more than one positional argument following their flag. Default is
true
property "halt-at-non-option"
'halt-at-non-option': boolean;
Should parsing stop at the first text argument? This is similar to how e.g. ssh parses its command line. Default is
false
property "nargs-eats-options"
'nargs-eats-options': boolean;
Should nargs consume dash options as well as positional arguments. Default is
false
property "negation-prefix"
'negation-prefix': string;
The prefix to use for negated boolean variables. Default is
'no-'
property "parse-numbers"
'parse-numbers': boolean;
Should keys that look like numbers be treated as such? Default is
true
property "parse-positional-numbers"
'parse-positional-numbers': boolean;
Should positional keys that look like numbers be treated as such? Default is
true
property "populate--"
'populate--': boolean;
Should unparsed flags be stored in -- or _. Default is
false
property "set-placeholder-key"
'set-placeholder-key': boolean;
Should a placeholder be added for keys not set via the corresponding CLI argument? Default is
false
property "short-option-groups"
'short-option-groups': boolean;
Should a group of short-options be treated as boolean flags? Default is
true
property "strip-aliased"
'strip-aliased': boolean;
Should aliases be removed before returning results? Default is
false
property "strip-dashed"
'strip-dashed': boolean;
Should dashed keys be removed before returning results? This option has no effect if camel-case-expansion is disabled. Default is
false
property "unknown-options-as-args"
'unknown-options-as-args': boolean;
Should unknown options be treated like regular arguments? An unknown option is one that is not configured in opts. Default is
false
interface DetailedArguments
interface DetailedArguments {}
property aliases
aliases: { [alias: string]: string[] };
The inferred list of aliases built by combining lists in opts.alias.
property argv
argv: Arguments;
An object representing the parsed value of
args
property configuration
configuration: Configuration;
The configuration loaded from the yargs stanza in package.json.
property error
error: Error | null;
Populated with an error object if an exception occurred during parsing.
property newAliases
newAliases: { [alias: string]: boolean };
Any new aliases added via camel-case expansion.
interface Options
interface Options {}
property alias
alias?: { [key: string]: string | string[] } | undefined;
An object representing the set of aliases for a key:
{ alias: { foo: ['f']} }
.
property array
array?: | string[] | Array<{ key: string; boolean?: boolean | undefined; number?: boolean | undefined; }> | undefined;
Indicate that keys should be parsed as an array:
{ array: ['foo', 'bar'] }
. Indicate that keys should be parsed as an array and coerced to booleans / numbers: { array: [ { key: 'foo', boolean: true }, {key: 'bar', number: true} ] }`.
property boolean
boolean?: string[] | undefined;
Arguments should be parsed as booleans:
{ boolean: ['x', 'y'] }
.
property coerce
coerce?: { [key: string]: (arg: any) => any } | undefined;
Provide a custom synchronous function that returns a coerced value from the argument provided (or throws an error), e.g.
{ coerce: { foo: function (arg) { return modifiedArg } } }
.
property config
config?: string | string[] | { [key: string]: boolean } | undefined;
Indicate a key that represents a path to a configuration file (this file will be loaded and parsed).
property configuration
configuration?: Partial<Configuration> | undefined;
Provide configuration options to the yargs-parser.
property count
count?: string[] | undefined;
Indicate a key that should be used as a counter, e.g.,
-vvv = {v: 3}
.
property default
default?: { [key: string]: any } | undefined;
Provide default values for keys:
{ default: { x: 33, y: 'hello world!' } }
.
property envPrefix
envPrefix?: string | undefined;
Environment variables (
process.env
) with the prefix provided should be parsed.
property narg
narg?: { [key: string]: number } | undefined;
Specify that a key requires n arguments:
{ narg: {x: 2} }
.
property normalize
normalize?: string[] | undefined;
path.normalize()
will be applied to values set to this key.
property number
number?: string[] | undefined;
Keys should be treated as numbers.
property string
string?: string[] | undefined;
Keys should be treated as strings (even if they resemble a number
-x 33
).
interface Parser
interface Parser {}
method camelCase
camelCase: (str: string) => string;
method decamelize
decamelize: (str: string, joinString?: string) => string;
method detailed
detailed: (argv: string | string[], opts?: Options) => DetailedArguments;
method looksLikeNumber
looksLikeNumber: (value: string | number | null | undefined) => boolean;
call signature
(argv: string | string[], opts?: Options): Arguments;
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/yargs-parser
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/yargs-parser)
- HTML<a href="https://www.jsdocs.io/package/@types/yargs-parser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1231 ms. - Missing or incorrect documentation? Open an issue for this package.