yargs 15.3.2-beta.0 → 15.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE +2 -3
- package/README.md +4 -4
- package/build/lib/apply-extends.d.ts +2 -2
- package/build/lib/apply-extends.js +2 -1
- package/build/lib/argsert.js +1 -0
- package/build/lib/command.d.ts +64 -0
- package/build/lib/command.js +416 -0
- package/build/lib/common-types.d.ts +36 -0
- package/build/lib/common-types.js +25 -0
- package/build/lib/completion-templates.js +1 -0
- package/build/lib/completion.d.ts +20 -1
- package/build/lib/completion.js +14 -5
- package/build/lib/is-promise.js +1 -0
- package/build/lib/levenshtein.js +1 -0
- package/build/lib/middleware.d.ts +10 -0
- package/build/lib/middleware.js +57 -0
- package/build/lib/obj-filter.d.ts +1 -2
- package/build/lib/obj-filter.js +4 -2
- package/build/lib/parse-command.d.ts +10 -1
- package/build/lib/parse-command.js +1 -0
- package/build/lib/process-argv.js +1 -0
- package/build/lib/usage.d.ts +48 -2
- package/build/lib/usage.js +19 -5
- package/build/lib/validation.d.ts +33 -2
- package/build/lib/validation.js +6 -4
- package/build/lib/yargs.d.ts +274 -0
- package/build/lib/yargs.js +1190 -0
- package/build/lib/yerror.js +1 -0
- package/package.json +5 -8
- package/yargs.js +2 -1291
- package/build/lib/type-helpers/command-builder.d.ts +0 -2
- package/build/lib/type-helpers/command-builder.js +0 -6
- package/build/lib/type-helpers/completion-function.d.ts +0 -2
- package/build/lib/type-helpers/completion-function.js +0 -6
- package/build/lib/type-helpers/index.d.ts +0 -2
- package/build/lib/type-helpers/index.js +0 -7
- package/build/lib/types/command-builder.d.ts +0 -5
- package/build/lib/types/command-builder.js +0 -2
- package/build/lib/types/command-handler.d.ts +0 -4
- package/build/lib/types/command-handler.js +0 -2
- package/build/lib/types/command-instance.d.ts +0 -7
- package/build/lib/types/command-instance.js +0 -2
- package/build/lib/types/completion-function.d.ts +0 -8
- package/build/lib/types/completion-function.js +0 -2
- package/build/lib/types/completion-instance.d.ts +0 -10
- package/build/lib/types/completion-instance.js +0 -2
- package/build/lib/types/context.d.ts +0 -4
- package/build/lib/types/context.js +0 -2
- package/build/lib/types/custom-check.d.ts +0 -5
- package/build/lib/types/custom-check.js +0 -2
- package/build/lib/types/dictionary.d.ts +0 -3
- package/build/lib/types/dictionary.js +0 -2
- package/build/lib/types/electron-process.d.ts +0 -7
- package/build/lib/types/electron-process.js +0 -2
- package/build/lib/types/failure-function.d.ts +0 -5
- package/build/lib/types/failure-function.js +0 -2
- package/build/lib/types/frozen-usage-instance.d.ts +0 -11
- package/build/lib/types/frozen-usage-instance.js +0 -2
- package/build/lib/types/frozen-validation-instance.d.ts +0 -8
- package/build/lib/types/frozen-validation-instance.js +0 -2
- package/build/lib/types/index.d.ts +0 -20
- package/build/lib/types/index.js +0 -2
- package/build/lib/types/key-or-pos.d.ts +0 -1
- package/build/lib/types/key-or-pos.js +0 -2
- package/build/lib/types/logger-instance.d.ts +0 -2
- package/build/lib/types/logger-instance.js +0 -2
- package/build/lib/types/options.d.ts +0 -19
- package/build/lib/types/options.js +0 -2
- package/build/lib/types/parsed-command.d.ts +0 -6
- package/build/lib/types/parsed-command.js +0 -2
- package/build/lib/types/parser-configuration.d.ts +0 -5
- package/build/lib/types/parser-configuration.js +0 -2
- package/build/lib/types/positional.d.ts +0 -4
- package/build/lib/types/positional.js +0 -2
- package/build/lib/types/usage-instance.d.ts +0 -37
- package/build/lib/types/usage-instance.js +0 -2
- package/build/lib/types/validation-instance.d.ts +0 -28
- package/build/lib/types/validation-instance.js +0 -2
- package/build/lib/types/yargs-instance.d.ts +0 -44
- package/build/lib/types/yargs-instance.js +0 -2
- package/lib/command.js +0 -435
- package/lib/middleware.js +0 -64
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Arguments } from 'yargs-parser';
|
|
2
|
-
export declare type CompletionFunction = SyncCompletionFunction | AsyncCompletionFunction;
|
|
3
|
-
export interface SyncCompletionFunction {
|
|
4
|
-
(current: string, argv: Arguments): string[] | Promise<string[]>;
|
|
5
|
-
}
|
|
6
|
-
export interface AsyncCompletionFunction {
|
|
7
|
-
(current: string, argv: Arguments, done: (completions: string[]) => any): any;
|
|
8
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CompletionFunction } from './completion-function';
|
|
2
|
-
import { DetailedArguments } from 'yargs-parser';
|
|
3
|
-
/** Instance of the completion module. */
|
|
4
|
-
export interface CompletionInstance {
|
|
5
|
-
completionKey: string;
|
|
6
|
-
generateCompletionScript($0: string, cmd: string): string;
|
|
7
|
-
getCompletion(args: string[], done: (completions: string[]) => any): any;
|
|
8
|
-
registerFunction(fn: CompletionFunction): void;
|
|
9
|
-
setParsed(parsed: DetailedArguments): void;
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Dictionary } from './dictionary';
|
|
2
|
-
export interface FrozenUsageInstance {
|
|
3
|
-
failMessage: string | undefined | null;
|
|
4
|
-
failureOutput: boolean;
|
|
5
|
-
usages: [string, string][];
|
|
6
|
-
usageDisabled: boolean;
|
|
7
|
-
epilogs: string[];
|
|
8
|
-
examples: [string, string][];
|
|
9
|
-
commands: [string, string, boolean, string[]][];
|
|
10
|
-
descriptions: Dictionary<string | undefined>;
|
|
11
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CustomCheck } from './custom-check';
|
|
2
|
-
import { Dictionary } from './dictionary';
|
|
3
|
-
import { KeyOrPos } from './key-or-pos';
|
|
4
|
-
export interface FrozenValidationInstance {
|
|
5
|
-
implied: Dictionary<KeyOrPos[]>;
|
|
6
|
-
checks: CustomCheck[];
|
|
7
|
-
conflicting: Dictionary<(string | undefined)[]>;
|
|
8
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from './command-builder';
|
|
2
|
-
export * from './command-handler';
|
|
3
|
-
export * from './command-instance';
|
|
4
|
-
export * from './completion-function';
|
|
5
|
-
export * from './completion-instance';
|
|
6
|
-
export * from './custom-check';
|
|
7
|
-
export * from './context';
|
|
8
|
-
export * from './dictionary';
|
|
9
|
-
export * from './electron-process';
|
|
10
|
-
export * from './failure-function';
|
|
11
|
-
export * from './frozen-usage-instance';
|
|
12
|
-
export * from './frozen-validation-instance';
|
|
13
|
-
export * from './key-or-pos';
|
|
14
|
-
export * from './logger-instance';
|
|
15
|
-
export * from './options';
|
|
16
|
-
export * from './parsed-command';
|
|
17
|
-
export * from './parser-configuration';
|
|
18
|
-
export * from './usage-instance';
|
|
19
|
-
export * from './validation-instance';
|
|
20
|
-
export * from './yargs-instance';
|
package/build/lib/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type KeyOrPos = string | number | undefined;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Dictionary } from './dictionary';
|
|
2
|
-
import { ParserConfiguration } from './parser-configuration';
|
|
3
|
-
export interface Options {
|
|
4
|
-
array: string[];
|
|
5
|
-
alias: Dictionary<string[]>;
|
|
6
|
-
boolean: string[];
|
|
7
|
-
choices: Dictionary<string[]>;
|
|
8
|
-
configuration: ParserConfiguration;
|
|
9
|
-
count: string[];
|
|
10
|
-
default: Dictionary;
|
|
11
|
-
defaultDescription: Dictionary<string | undefined>;
|
|
12
|
-
hiddenOptions: string[];
|
|
13
|
-
/** Manually set keys */
|
|
14
|
-
key: Dictionary<boolean>;
|
|
15
|
-
normalize: string[];
|
|
16
|
-
number: string[];
|
|
17
|
-
showHiddenOpt: string;
|
|
18
|
-
string: string[];
|
|
19
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Dictionary } from './dictionary';
|
|
2
|
-
import { FailureFunction } from './failure-function';
|
|
3
|
-
import { YError } from '../yerror';
|
|
4
|
-
/** Instance of the usage module. */
|
|
5
|
-
export interface UsageInstance {
|
|
6
|
-
cacheHelpMessage(): void;
|
|
7
|
-
clearCachedHelpMessage(): void;
|
|
8
|
-
command(cmd: string, description: string | undefined, isDefault: boolean, aliases: string[]): void;
|
|
9
|
-
deferY18nLookup(str: string): string;
|
|
10
|
-
describe(key: string, desc?: string): void;
|
|
11
|
-
describe(keys: Dictionary<string>): void;
|
|
12
|
-
epilog(msg: string): void;
|
|
13
|
-
example(cmd: string, description?: string): void;
|
|
14
|
-
fail(msg?: string | null, err?: YError | string): void;
|
|
15
|
-
failFn(f: FailureFunction): void;
|
|
16
|
-
freeze(): void;
|
|
17
|
-
functionDescription(fn: {
|
|
18
|
-
name?: string;
|
|
19
|
-
}): string;
|
|
20
|
-
getCommands(): [string, string, boolean, string[]][];
|
|
21
|
-
getDescriptions(): Dictionary<string | undefined>;
|
|
22
|
-
getPositionalGroupName(): string;
|
|
23
|
-
getUsage(): [string, string][];
|
|
24
|
-
getUsageDisabled(): boolean;
|
|
25
|
-
help(): string;
|
|
26
|
-
reset(localLookup: Dictionary<boolean>): UsageInstance;
|
|
27
|
-
showHelp(level: 'error' | 'log'): void;
|
|
28
|
-
showHelp(level: (message: string) => void): void;
|
|
29
|
-
showHelpOnFail(message?: string): UsageInstance;
|
|
30
|
-
showHelpOnFail(enabled: boolean, message: string): UsageInstance;
|
|
31
|
-
showVersion(): void;
|
|
32
|
-
stringifiedValues(values?: any[], separator?: string): string;
|
|
33
|
-
unfreeze(): void;
|
|
34
|
-
usage(msg: string | null, description?: string): UsageInstance;
|
|
35
|
-
version(ver: any): void;
|
|
36
|
-
wrap(cols: number): void;
|
|
37
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { CustomCheck } from './custom-check';
|
|
2
|
-
import { Dictionary } from './dictionary';
|
|
3
|
-
import { KeyOrPos } from './key-or-pos';
|
|
4
|
-
import { Arguments, DetailedArguments } from 'yargs-parser';
|
|
5
|
-
/** Instance of the validation module. */
|
|
6
|
-
export interface ValidationInstance {
|
|
7
|
-
check(f: CustomCheck['func'], global: boolean): void;
|
|
8
|
-
conflicting(argv: Arguments): void;
|
|
9
|
-
conflicts(key: string, value: string | string[]): void;
|
|
10
|
-
conflicts(key: Dictionary<string | string[]>): void;
|
|
11
|
-
customChecks(argv: Arguments, aliases: DetailedArguments['aliases']): void;
|
|
12
|
-
freeze(): void;
|
|
13
|
-
getConflicting(): Dictionary<(string | undefined)[]>;
|
|
14
|
-
getImplied(): Dictionary<KeyOrPos[]>;
|
|
15
|
-
implications(argv: Arguments): void;
|
|
16
|
-
implies(key: string, value: KeyOrPos | KeyOrPos[]): void;
|
|
17
|
-
implies(key: Dictionary<KeyOrPos | KeyOrPos[]>): void;
|
|
18
|
-
isValidAndSomeAliasIsNotNew(key: string, aliases: DetailedArguments['aliases']): boolean;
|
|
19
|
-
limitedChoices(argv: Arguments): void;
|
|
20
|
-
nonOptionCount(argv: Arguments): void;
|
|
21
|
-
positionalCount(required: number, observed: number): void;
|
|
22
|
-
recommendCommands(cmd: string, potentialCommands: string[]): void;
|
|
23
|
-
requiredArguments(argv: Arguments): void;
|
|
24
|
-
reset(localLookup: Dictionary): ValidationInstance;
|
|
25
|
-
unfreeze(): void;
|
|
26
|
-
unknownArguments(argv: Arguments, aliases: DetailedArguments['aliases'], positionalMap: Dictionary): void;
|
|
27
|
-
unknownCommands(argv: Arguments): boolean;
|
|
28
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { CommandInstance } from './command-instance';
|
|
2
|
-
import { Context } from './context';
|
|
3
|
-
import { Dictionary } from './dictionary';
|
|
4
|
-
import { LoggerInstance } from './logger-instance';
|
|
5
|
-
import { Options } from './options';
|
|
6
|
-
import { ParserConfiguration } from './parser-configuration';
|
|
7
|
-
import { YError } from '../yerror';
|
|
8
|
-
import { Arguments, DetailedArguments } from 'yargs-parser';
|
|
9
|
-
/** Instance of the yargs module. */
|
|
10
|
-
export interface YargsInstance {
|
|
11
|
-
$0: string;
|
|
12
|
-
argv: Arguments;
|
|
13
|
-
customScriptName: boolean;
|
|
14
|
-
parsed: DetailedArguments;
|
|
15
|
-
_getLoggerInstance(): LoggerInstance;
|
|
16
|
-
_getParseContext(): Object;
|
|
17
|
-
_hasParseCallback(): boolean;
|
|
18
|
-
array(key: string): YargsInstance;
|
|
19
|
-
boolean(key: string): YargsInstance;
|
|
20
|
-
count(key: string): YargsInstance;
|
|
21
|
-
demandOption(key: string, msg: string): YargsInstance;
|
|
22
|
-
exit(code: number, err?: YError | string): void;
|
|
23
|
-
getCommandInstance(): CommandInstance;
|
|
24
|
-
getContext(): Context;
|
|
25
|
-
getDemandedOptions(): Dictionary<string>;
|
|
26
|
-
getDemandedCommands(): Dictionary<{
|
|
27
|
-
min: number;
|
|
28
|
-
max: number;
|
|
29
|
-
minMsg?: string | null;
|
|
30
|
-
maxMsg?: string | null;
|
|
31
|
-
}>;
|
|
32
|
-
getDeprecatedOptions(): Dictionary<string | boolean>;
|
|
33
|
-
getExitProcess(): boolean;
|
|
34
|
-
getGroups(): Dictionary<string[]>;
|
|
35
|
-
getOptions(): Options;
|
|
36
|
-
getParserConfiguration(): ParserConfiguration;
|
|
37
|
-
global(globals: string | string[], global?: boolean): YargsInstance;
|
|
38
|
-
normalize(key: string): YargsInstance;
|
|
39
|
-
number(key: string): YargsInstance;
|
|
40
|
-
parse(args: string[], shortCircuit: boolean): Arguments;
|
|
41
|
-
reset(): YargsInstance;
|
|
42
|
-
showHelp(level: string): YargsInstance;
|
|
43
|
-
string(key: string): YargsInstance;
|
|
44
|
-
}
|