mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
yargs: Add 'sort-commands' option to parserConfiguration (#41718)
* Add 'sort-commands' option to `parserConfiguration` * Use defined type instead of inline in the generic
This commit is contained in:
committed by
Wesley Wigham
parent
217d81c806
commit
1c51f0ffc4
Vendored
+6
-1
@@ -30,6 +30,11 @@ import { DetailedArguments, Configuration } from 'yargs-parser';
|
||||
declare namespace yargs {
|
||||
type BuilderCallback<T, R> = ((args: Argv<T>) => Argv<R>) | ((args: Argv<T>) => void);
|
||||
|
||||
type ParserConfigurationOptions = Configuration & {
|
||||
/** Sort commands alphabetically. Default is `false` */
|
||||
'sort-commands': boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* The type parameter `T` is the expected shape of the parsed options.
|
||||
* `Arguments<T>` is those options plus `_` and `$0`, and an indexer falling
|
||||
@@ -427,7 +432,7 @@ declare namespace yargs {
|
||||
parsed: DetailedArguments | false;
|
||||
|
||||
/** Allows to configure advanced yargs features. */
|
||||
parserConfiguration(configuration: Partial<Configuration>): Argv<T>;
|
||||
parserConfiguration(configuration: Partial<ParserConfigurationOptions>): Argv<T>;
|
||||
|
||||
/**
|
||||
* Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object.
|
||||
|
||||
Vendored
+6
-1
@@ -30,6 +30,11 @@ import { DetailedArguments, Configuration } from 'yargs-parser';
|
||||
declare namespace yargs {
|
||||
type BuilderCallback<T, R> = ((args: Argv<T>) => Argv<R>) | ((args: Argv<T>) => void);
|
||||
|
||||
type ParserConfigurationOptions = Configuration & {
|
||||
/** Sort commands alphabetically. Default is `false` */
|
||||
'sort-commands': boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* The type parameter `T` is the expected shape of the parsed options.
|
||||
* `Arguments<T>` is those options plus `_` and `$0`, and an indexer falling
|
||||
@@ -421,7 +426,7 @@ declare namespace yargs {
|
||||
parsed: DetailedArguments | false;
|
||||
|
||||
/** Allows to configure advanced yargs features. */
|
||||
parserConfiguration(configuration: Partial<Configuration>): Argv<T>;
|
||||
parserConfiguration(configuration: Partial<ParserConfigurationOptions>): Argv<T>;
|
||||
|
||||
/**
|
||||
* Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object.
|
||||
|
||||
@@ -735,6 +735,7 @@ function Argv$parserConfiguration() {
|
||||
'populate--': false,
|
||||
'set-placeholder-key': false,
|
||||
'short-option-groups': false,
|
||||
'sort-commands': true,
|
||||
}).parse();
|
||||
|
||||
const argv2 = yargs.parserConfiguration({
|
||||
|
||||
@@ -735,6 +735,7 @@ function Argv$parserConfiguration() {
|
||||
'populate--': false,
|
||||
'set-placeholder-key': false,
|
||||
'short-option-groups': false,
|
||||
'sort-commands': true,
|
||||
}).parse();
|
||||
|
||||
const argv2 = yargs.parserConfiguration({
|
||||
|
||||
Reference in New Issue
Block a user