politty 0.3.0 → 0.3.2
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/README.md +84 -2
- package/dist/{arg-registry-w5mMKJkZ.d.ts → arg-registry-B4a4Fj7f.d.cts} +51 -2
- package/dist/arg-registry-B4a4Fj7f.d.cts.map +1 -0
- package/dist/{arg-registry-i6SA4l-E.d.cts → arg-registry-C3GP-5C9.d.ts} +51 -2
- package/dist/arg-registry-C3GP-5C9.d.ts.map +1 -0
- package/dist/augment.d.cts +1 -1
- package/dist/augment.d.ts +1 -1
- package/dist/completion/index.cjs +23 -462
- package/dist/completion/index.cjs.map +1 -1
- package/dist/completion/index.d.cts +13 -91
- package/dist/completion/index.d.cts.map +1 -1
- package/dist/completion/index.d.ts +13 -91
- package/dist/completion/index.d.ts.map +1 -1
- package/dist/completion/index.js +12 -457
- package/dist/completion/index.js.map +1 -1
- package/dist/docs/index.cjs +718 -280
- package/dist/docs/index.cjs.map +1 -1
- package/dist/docs/index.d.cts +102 -47
- package/dist/docs/index.d.cts.map +1 -1
- package/dist/docs/index.d.ts +102 -47
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +713 -281
- package/dist/docs/index.js.map +1 -1
- package/dist/extractor-B7bOwpvP.cjs +970 -0
- package/dist/extractor-B7bOwpvP.cjs.map +1 -0
- package/dist/extractor-CCi4rjSI.d.ts +238 -0
- package/dist/extractor-CCi4rjSI.d.ts.map +1 -0
- package/dist/extractor-DsJ6hYqQ.d.cts +238 -0
- package/dist/extractor-DsJ6hYqQ.d.cts.map +1 -0
- package/dist/extractor-JfoYSoMk.js +898 -0
- package/dist/extractor-JfoYSoMk.js.map +1 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +5 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/{runner-B38UBqhv.cjs → runner-BFKk3Arg.cjs} +25 -13
- package/dist/runner-BFKk3Arg.cjs.map +1 -0
- package/dist/{runner-CUN50BqK.js → runner-ElQbBn1U.js} +25 -13
- package/dist/runner-ElQbBn1U.js.map +1 -0
- package/dist/{schema-extractor-B9D3Rf22.cjs → schema-extractor-BU705qpC.cjs} +43 -4
- package/dist/schema-extractor-BU705qpC.cjs.map +1 -0
- package/dist/{schema-extractor-CXeUTW_Z.d.cts → schema-extractor-CHiBRT39.d.ts} +6 -1
- package/dist/schema-extractor-CHiBRT39.d.ts.map +1 -0
- package/dist/{schema-extractor-1YXqFSDT.js → schema-extractor-CP3ar0Wi.js} +43 -4
- package/dist/schema-extractor-CP3ar0Wi.js.map +1 -0
- package/dist/{schema-extractor-Cl_D04BX.d.ts → schema-extractor-DyfK21m_.d.cts} +6 -1
- package/dist/schema-extractor-DyfK21m_.d.cts.map +1 -0
- package/package.json +6 -6
- package/dist/arg-registry-i6SA4l-E.d.cts.map +0 -1
- package/dist/arg-registry-w5mMKJkZ.d.ts.map +0 -1
- package/dist/command-Bgd-yIwv.cjs +0 -25
- package/dist/command-Bgd-yIwv.cjs.map +0 -1
- package/dist/command-D-P2Pc3J.js +0 -20
- package/dist/command-D-P2Pc3J.js.map +0 -1
- package/dist/runner-B38UBqhv.cjs.map +0 -1
- package/dist/runner-CUN50BqK.js.map +0 -1
- package/dist/schema-extractor-1YXqFSDT.js.map +0 -1
- package/dist/schema-extractor-B9D3Rf22.cjs.map +0 -1
- package/dist/schema-extractor-CXeUTW_Z.d.cts.map +0 -1
- package/dist/schema-extractor-Cl_D04BX.d.ts.map +0 -1
|
@@ -1,93 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../arg-registry-B4a4Fj7f.cjs";
|
|
2
|
+
import { d as Command, s as AnyCommand } from "../schema-extractor-DyfK21m_.cjs";
|
|
3
|
+
import { _ as CompletionOptions, a as CandidateResult, c as formatOutput, d as CompletionType, f as parseCompletionContext, g as CompletionGenerator, h as CompletionData, i as hasCompleteCommand, l as generateCandidates, m as CompletableSubcommand, n as extractPositionals, o as CompletionCandidate, p as CompletableOption, r as createDynamicCompleteCommand, s as CompletionDirective, t as extractCompletionData, u as CompletionContext, v as CompletionResult, y as ShellType } from "../extractor-DsJ6hYqQ.cjs";
|
|
2
4
|
import { z } from "zod";
|
|
3
5
|
|
|
4
|
-
//#region src/completion/types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Supported shell types for completion
|
|
7
|
-
*/
|
|
8
|
-
type ShellType = "bash" | "zsh" | "fish";
|
|
9
|
-
/**
|
|
10
|
-
* Options for completion generation
|
|
11
|
-
*/
|
|
12
|
-
interface CompletionOptions {
|
|
13
|
-
/** The shell type to generate completion for */
|
|
14
|
-
shell: ShellType;
|
|
15
|
-
/** The command name as it will be invoked */
|
|
16
|
-
programName: string;
|
|
17
|
-
/** Include subcommand completions (default: true) */
|
|
18
|
-
includeSubcommands?: boolean;
|
|
19
|
-
/** Include description in completions where supported (default: true) */
|
|
20
|
-
includeDescriptions?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Information about a completable option
|
|
24
|
-
*/
|
|
25
|
-
interface CompletableOption {
|
|
26
|
-
/** Long option name (e.g., "verbose") */
|
|
27
|
-
name: string;
|
|
28
|
-
/** CLI name (kebab-case, e.g., "dry-run") */
|
|
29
|
-
cliName: string;
|
|
30
|
-
/** Short alias (e.g., "v") */
|
|
31
|
-
alias?: string | undefined;
|
|
32
|
-
/** Description for completion */
|
|
33
|
-
description?: string | undefined;
|
|
34
|
-
/** Whether this option takes a value */
|
|
35
|
-
takesValue: boolean;
|
|
36
|
-
/** Type of value expected */
|
|
37
|
-
valueType: "string" | "number" | "boolean" | "array" | "unknown";
|
|
38
|
-
/** Whether the option is required */
|
|
39
|
-
required: boolean;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Information about a subcommand for completion
|
|
43
|
-
*/
|
|
44
|
-
interface CompletableSubcommand {
|
|
45
|
-
/** Subcommand name */
|
|
46
|
-
name: string;
|
|
47
|
-
/** Subcommand description */
|
|
48
|
-
description?: string | undefined;
|
|
49
|
-
/** Nested subcommands */
|
|
50
|
-
subcommands: CompletableSubcommand[];
|
|
51
|
-
/** Options for this subcommand */
|
|
52
|
-
options: CompletableOption[];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Extracted completion data from a command
|
|
56
|
-
*/
|
|
57
|
-
interface CompletionData {
|
|
58
|
-
/** The root command */
|
|
59
|
-
command: CompletableSubcommand;
|
|
60
|
-
/** Program name */
|
|
61
|
-
programName: string;
|
|
62
|
-
/** Global options (available to all subcommands) */
|
|
63
|
-
globalOptions: CompletableOption[];
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Result of completion generation
|
|
67
|
-
*/
|
|
68
|
-
interface CompletionResult {
|
|
69
|
-
/** The generated completion script */
|
|
70
|
-
script: string;
|
|
71
|
-
/** The shell type this script is for */
|
|
72
|
-
shell: ShellType;
|
|
73
|
-
/** Instructions for installing the completion */
|
|
74
|
-
installInstructions: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Generator function type for shell completions
|
|
78
|
-
*/
|
|
79
|
-
type CompletionGenerator = (command: AnyCommand, options: CompletionOptions) => CompletionResult;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/completion/extractor.d.ts
|
|
82
|
-
/**
|
|
83
|
-
* Extract positional arguments from a command
|
|
84
|
-
*/
|
|
85
|
-
declare function extractPositionals(command: AnyCommand): ResolvedFieldMeta[];
|
|
86
|
-
/**
|
|
87
|
-
* Extract completion data from a command tree
|
|
88
|
-
*/
|
|
89
|
-
declare function extractCompletionData(command: AnyCommand, programName: string): CompletionData;
|
|
90
|
-
//#endregion
|
|
91
6
|
//#region src/completion/index.d.ts
|
|
92
7
|
/**
|
|
93
8
|
* Generate completion script for the specified shell
|
|
@@ -129,6 +44,13 @@ type CompletionArgs = z.infer<typeof completionArgsSchema>;
|
|
|
129
44
|
* ```
|
|
130
45
|
*/
|
|
131
46
|
declare function createCompletionCommand(rootCommand: AnyCommand, programName?: string): Command<typeof completionArgsSchema, CompletionArgs, any>;
|
|
47
|
+
/**
|
|
48
|
+
* Options for withCompletionCommand
|
|
49
|
+
*/
|
|
50
|
+
interface WithCompletionOptions {
|
|
51
|
+
/** Override the program name (defaults to command.name) */
|
|
52
|
+
programName?: string;
|
|
53
|
+
}
|
|
132
54
|
/**
|
|
133
55
|
* Wrap a command with a completion subcommand
|
|
134
56
|
*
|
|
@@ -136,7 +58,7 @@ declare function createCompletionCommand(rootCommand: AnyCommand, programName?:
|
|
|
136
58
|
* in its subCommands (e.g., for completion generation).
|
|
137
59
|
*
|
|
138
60
|
* @param command - The command to wrap
|
|
139
|
-
* @param
|
|
61
|
+
* @param options - Options including programName
|
|
140
62
|
* @returns A new command with the completion subcommand added
|
|
141
63
|
*
|
|
142
64
|
* @example
|
|
@@ -149,7 +71,7 @@ declare function createCompletionCommand(rootCommand: AnyCommand, programName?:
|
|
|
149
71
|
* );
|
|
150
72
|
* ```
|
|
151
73
|
*/
|
|
152
|
-
declare function withCompletionCommand<T extends AnyCommand>(command: T,
|
|
74
|
+
declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
|
|
153
75
|
//#endregion
|
|
154
|
-
export { type CompletableOption, type CompletableSubcommand, type CompletionData, type CompletionGenerator, type CompletionOptions, type CompletionResult, type ShellType, createCompletionCommand, detectShell, extractCompletionData, extractPositionals, generateCompletion, getSupportedShells, withCompletionCommand };
|
|
76
|
+
export { type CandidateResult, type CompletableOption, type CompletableSubcommand, type CompletionCandidate, type CompletionContext, type CompletionData, CompletionDirective, type CompletionGenerator, type CompletionOptions, type CompletionResult, type CompletionType, type ShellType, WithCompletionOptions, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatOutput, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, withCompletionCommand };
|
|
155
77
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/completion/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/completion/index.ts"],"mappings":";;;;;;AA0GC;;;AAAA,iBAzCe,kBAAA,CACd,OAAA,EAAS,UAAA,EACT,OAAA,EAAS,iBAAA,GACR,gBAAA;;;;iBAgBa,kBAAA,CAAA,GAAsB,SAAA;;;;iBAOtB,WAAA,CAAA,GAAe,SAAA;;;;cAoBzB,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;KAkBrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;;;;;;;;;;;;;;;;iBAiBrB,uBAAA,CACd,WAAA,EAAa,UAAA,EACb,WAAA,YAEC,OAAA,QAAe,oBAAA,EAAsB,cAAA;AAJxC;;;AAAA,UA8CiB,qBAAA;EA1CC;EA4ChB,WAAA;AAAA;;;;;;;;;;;AAFF;;;;;AAyBA;;;;;iBAAgB,qBAAA,WAAgC,UAAA,CAAA,CAC9C,OAAA,EAAS,CAAA,EACT,OAAA,YAAmB,qBAAA,GAClB,CAAA"}
|
|
@@ -1,93 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../arg-registry-C3GP-5C9.js";
|
|
2
|
+
import { d as Command, s as AnyCommand } from "../schema-extractor-CHiBRT39.js";
|
|
3
|
+
import { _ as CompletionOptions, a as CandidateResult, c as formatOutput, d as CompletionType, f as parseCompletionContext, g as CompletionGenerator, h as CompletionData, i as hasCompleteCommand, l as generateCandidates, m as CompletableSubcommand, n as extractPositionals, o as CompletionCandidate, p as CompletableOption, r as createDynamicCompleteCommand, s as CompletionDirective, t as extractCompletionData, u as CompletionContext, v as CompletionResult, y as ShellType } from "../extractor-CCi4rjSI.js";
|
|
2
4
|
import { z } from "zod";
|
|
3
5
|
|
|
4
|
-
//#region src/completion/types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Supported shell types for completion
|
|
7
|
-
*/
|
|
8
|
-
type ShellType = "bash" | "zsh" | "fish";
|
|
9
|
-
/**
|
|
10
|
-
* Options for completion generation
|
|
11
|
-
*/
|
|
12
|
-
interface CompletionOptions {
|
|
13
|
-
/** The shell type to generate completion for */
|
|
14
|
-
shell: ShellType;
|
|
15
|
-
/** The command name as it will be invoked */
|
|
16
|
-
programName: string;
|
|
17
|
-
/** Include subcommand completions (default: true) */
|
|
18
|
-
includeSubcommands?: boolean;
|
|
19
|
-
/** Include description in completions where supported (default: true) */
|
|
20
|
-
includeDescriptions?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Information about a completable option
|
|
24
|
-
*/
|
|
25
|
-
interface CompletableOption {
|
|
26
|
-
/** Long option name (e.g., "verbose") */
|
|
27
|
-
name: string;
|
|
28
|
-
/** CLI name (kebab-case, e.g., "dry-run") */
|
|
29
|
-
cliName: string;
|
|
30
|
-
/** Short alias (e.g., "v") */
|
|
31
|
-
alias?: string | undefined;
|
|
32
|
-
/** Description for completion */
|
|
33
|
-
description?: string | undefined;
|
|
34
|
-
/** Whether this option takes a value */
|
|
35
|
-
takesValue: boolean;
|
|
36
|
-
/** Type of value expected */
|
|
37
|
-
valueType: "string" | "number" | "boolean" | "array" | "unknown";
|
|
38
|
-
/** Whether the option is required */
|
|
39
|
-
required: boolean;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Information about a subcommand for completion
|
|
43
|
-
*/
|
|
44
|
-
interface CompletableSubcommand {
|
|
45
|
-
/** Subcommand name */
|
|
46
|
-
name: string;
|
|
47
|
-
/** Subcommand description */
|
|
48
|
-
description?: string | undefined;
|
|
49
|
-
/** Nested subcommands */
|
|
50
|
-
subcommands: CompletableSubcommand[];
|
|
51
|
-
/** Options for this subcommand */
|
|
52
|
-
options: CompletableOption[];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Extracted completion data from a command
|
|
56
|
-
*/
|
|
57
|
-
interface CompletionData {
|
|
58
|
-
/** The root command */
|
|
59
|
-
command: CompletableSubcommand;
|
|
60
|
-
/** Program name */
|
|
61
|
-
programName: string;
|
|
62
|
-
/** Global options (available to all subcommands) */
|
|
63
|
-
globalOptions: CompletableOption[];
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Result of completion generation
|
|
67
|
-
*/
|
|
68
|
-
interface CompletionResult {
|
|
69
|
-
/** The generated completion script */
|
|
70
|
-
script: string;
|
|
71
|
-
/** The shell type this script is for */
|
|
72
|
-
shell: ShellType;
|
|
73
|
-
/** Instructions for installing the completion */
|
|
74
|
-
installInstructions: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Generator function type for shell completions
|
|
78
|
-
*/
|
|
79
|
-
type CompletionGenerator = (command: AnyCommand, options: CompletionOptions) => CompletionResult;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/completion/extractor.d.ts
|
|
82
|
-
/**
|
|
83
|
-
* Extract positional arguments from a command
|
|
84
|
-
*/
|
|
85
|
-
declare function extractPositionals(command: AnyCommand): ResolvedFieldMeta[];
|
|
86
|
-
/**
|
|
87
|
-
* Extract completion data from a command tree
|
|
88
|
-
*/
|
|
89
|
-
declare function extractCompletionData(command: AnyCommand, programName: string): CompletionData;
|
|
90
|
-
//#endregion
|
|
91
6
|
//#region src/completion/index.d.ts
|
|
92
7
|
/**
|
|
93
8
|
* Generate completion script for the specified shell
|
|
@@ -129,6 +44,13 @@ type CompletionArgs = z.infer<typeof completionArgsSchema>;
|
|
|
129
44
|
* ```
|
|
130
45
|
*/
|
|
131
46
|
declare function createCompletionCommand(rootCommand: AnyCommand, programName?: string): Command<typeof completionArgsSchema, CompletionArgs, any>;
|
|
47
|
+
/**
|
|
48
|
+
* Options for withCompletionCommand
|
|
49
|
+
*/
|
|
50
|
+
interface WithCompletionOptions {
|
|
51
|
+
/** Override the program name (defaults to command.name) */
|
|
52
|
+
programName?: string;
|
|
53
|
+
}
|
|
132
54
|
/**
|
|
133
55
|
* Wrap a command with a completion subcommand
|
|
134
56
|
*
|
|
@@ -136,7 +58,7 @@ declare function createCompletionCommand(rootCommand: AnyCommand, programName?:
|
|
|
136
58
|
* in its subCommands (e.g., for completion generation).
|
|
137
59
|
*
|
|
138
60
|
* @param command - The command to wrap
|
|
139
|
-
* @param
|
|
61
|
+
* @param options - Options including programName
|
|
140
62
|
* @returns A new command with the completion subcommand added
|
|
141
63
|
*
|
|
142
64
|
* @example
|
|
@@ -149,7 +71,7 @@ declare function createCompletionCommand(rootCommand: AnyCommand, programName?:
|
|
|
149
71
|
* );
|
|
150
72
|
* ```
|
|
151
73
|
*/
|
|
152
|
-
declare function withCompletionCommand<T extends AnyCommand>(command: T,
|
|
74
|
+
declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
|
|
153
75
|
//#endregion
|
|
154
|
-
export { type CompletableOption, type CompletableSubcommand, type CompletionData, type CompletionGenerator, type CompletionOptions, type CompletionResult, type ShellType, createCompletionCommand, detectShell, extractCompletionData, extractPositionals, generateCompletion, getSupportedShells, withCompletionCommand };
|
|
76
|
+
export { type CandidateResult, type CompletableOption, type CompletableSubcommand, type CompletionCandidate, type CompletionContext, type CompletionData, CompletionDirective, type CompletionGenerator, type CompletionOptions, type CompletionResult, type CompletionType, type ShellType, WithCompletionOptions, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatOutput, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, withCompletionCommand };
|
|
155
77
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/completion/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/completion/index.ts"],"mappings":";;;;;;AA0GC;;;AAAA,iBAzCe,kBAAA,CACd,OAAA,EAAS,UAAA,EACT,OAAA,EAAS,iBAAA,GACR,gBAAA;;;;iBAgBa,kBAAA,CAAA,GAAsB,SAAA;;;;iBAOtB,WAAA,CAAA,GAAe,SAAA;;;;cAoBzB,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;KAkBrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;;;;;;;;;;;;;;;;iBAiBrB,uBAAA,CACd,WAAA,EAAa,UAAA,EACb,WAAA,YAEC,OAAA,QAAe,oBAAA,EAAsB,cAAA;AAJxC;;;AAAA,UA8CiB,qBAAA;EA1CC;EA4ChB,WAAA;AAAA;;;;;;;;;;;AAFF;;;;;AAyBA;;;;;iBAAgB,qBAAA,WAAgC,UAAA,CAAA,CAC9C,OAAA,EAAS,CAAA,EACT,OAAA,YAAmB,qBAAA,GAClB,CAAA"}
|