clerc 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +10 -242
  2. package/package.json +8 -8
package/dist/index.d.ts CHANGED
@@ -1,249 +1,17 @@
1
1
  import { n as __reExport, t as __export } from "./chunk-CYeTv9WL.js";
2
- import { Clerc, CreateOptions, Plugin } from "@clerc/core";
3
- import { ArgumentHandler, Command, OptionHandler } from "@bomb.sh/tab";
2
+ import { Clerc, CreateOptions } from "@clerc/core";
4
3
  export * from "@clerc/core";
4
+ export * from "@clerc/plugin-help";
5
+ export * from "@clerc/plugin-version";
6
+ export * from "@clerc/plugin-completions";
7
+ export * from "@clerc/plugin-friendly-error";
8
+ export * from "@clerc/plugin-not-found";
9
+ export * from "@clerc/plugin-strict-flags";
5
10
 
6
- //#region ../plugin-completions/src/index.d.ts
7
- declare module "@clerc/core" {
8
- interface CommandCustomOptions {
9
- /**
10
- * Completions options for the command.
11
- */
12
- completions?: {
13
- /**
14
- * Whether to show the command in completions output.
15
- *
16
- * @default true
17
- */
18
- show?: boolean;
19
- /**
20
- * Handler to provide custom completions for the command.
21
- */
22
- handler?: (command: Command) => void;
23
- };
24
- }
25
- interface FlagCustomOptions {
26
- /**
27
- * Completions options for the flag.
28
- */
29
- completions?: {
30
- /**
31
- * Whether to show the flag in completions output.
32
- *
33
- * @default true
34
- */
35
- show?: boolean;
36
- /**
37
- * Handler to provide custom completions for the flag.
38
- */
39
- handler?: OptionHandler;
40
- };
41
- }
42
- interface ParameterCustomOptions {
43
- /**
44
- * Completions options for the parameter.
45
- */
46
- completions?: {
47
- /**
48
- * Handler to provide custom completions for the parameter.
49
- */
50
- handler?: ArgumentHandler;
51
- };
52
- }
53
- }
54
- declare const completionsPlugin: () => Plugin;
55
- //#endregion
56
- //#region ../plugin-friendly-error/src/index.d.ts
57
- interface FriendlyErrorPluginOptions {
58
- target?: (str: string) => void;
59
- }
60
- declare const friendlyErrorPlugin: ({
61
- target
62
- }?: FriendlyErrorPluginOptions) => Plugin;
63
- //#endregion
64
- //#region ../parser/src/types.d.ts
65
- interface FlagDefaultValueFunction<T> {
66
- (): T;
67
- display?: string;
68
- }
69
- type FlagDefaultValue<T = unknown> = T | FlagDefaultValueFunction<T>;
70
- /**
71
- * Defines how a string input is converted to the target type T.
72
- *
73
- * @template T The target type.
74
- */
75
- interface TypeFunction<T = unknown> {
76
- (value: string): T;
77
- /**
78
- * Optional display name for the type, useful in help output.
79
- * If provided, this will be shown instead of the function name.
80
- */
81
- display?: string;
82
- }
83
- type TypeValue<T = unknown> = TypeFunction<T> | readonly [TypeFunction<T>];
84
- //#endregion
85
- //#region ../plugin-help/src/types.d.ts
86
- interface Formatters {
87
- formatTypeValue: (type: TypeValue) => string;
88
- formatFlagDefault: <T>(value: FlagDefaultValue<T>) => string;
89
- }
90
- /**
91
- * A group definition as a tuple of [key, displayName].
92
- * The key is used in help options to assign items to groups.
93
- * The displayName is shown in the help output.
94
- */
95
- type GroupDefinition = [key: string, name: string];
96
- /**
97
- * Options for defining groups in help output.
98
- */
99
- interface GroupsOptions {
100
- /**
101
- * Groups for commands.
102
- * Each group is defined as `[key, name]`.
103
- */
104
- commands?: GroupDefinition[];
105
- /**
106
- * Groups for command-specific flags.
107
- * Each group is defined as `[key, name]`.
108
- */
109
- flags?: GroupDefinition[];
110
- /**
111
- * Groups for global flags.
112
- * Each group is defined as `[key, name]`.
113
- */
114
- globalFlags?: GroupDefinition[];
115
- }
116
- //#endregion
117
- //#region ../plugin-help/src/formatters.d.ts
118
- declare const defaultFormatters: Formatters;
119
- //#endregion
120
- //#region ../plugin-help/src/index.d.ts
121
- interface HelpOptions {
122
- /**
123
- * The group this item belongs to.
124
- * The group must be defined in the `groups` option of `helpPlugin()`.
125
- */
126
- group?: string;
127
- }
128
- interface CommandHelpOptions extends HelpOptions {
129
- /**
130
- * Whether to show the command in help output.
131
- *
132
- * @default true
133
- */
134
- show?: boolean;
135
- /**
136
- * Notes to show in the help output.
137
- */
138
- notes?: string[];
139
- /**
140
- * Examples to show in the help output.
141
- * Each example is a tuple of `[command, description]`.
142
- */
143
- examples?: [string, string][];
144
- }
145
- declare module "@clerc/core" {
146
- interface CommandCustomOptions {
147
- /**
148
- * Help options for the command.
149
- */
150
- help?: CommandHelpOptions;
151
- }
152
- interface FlagCustomOptions {
153
- /**
154
- * Help options for the flag.
155
- */
156
- help?: HelpOptions;
157
- }
158
- }
159
- interface HelpPluginOptions {
160
- /**
161
- * Whether to register the `help` command.
162
- *
163
- * @default true
164
- */
165
- command?: boolean;
166
- /**
167
- * Whether to register the `--help` global flag.
168
- *
169
- * @default true
170
- */
171
- flag?: boolean;
172
- /**
173
- * Whether to show help when no command is specified.
174
- *
175
- * @default true
176
- */
177
- showHelpWhenNoCommandSpecified?: boolean;
178
- /**
179
- * Notes to show in the help output.
180
- */
181
- notes?: string[];
182
- /**
183
- * Examples to show in the help output.
184
- * Each example is a tuple of `[command, description]`.
185
- */
186
- examples?: [string, string][];
187
- /**
188
- * Header to show before the help output.
189
- */
190
- header?: string;
191
- /**
192
- * Footer to show after the help output.
193
- */
194
- footer?: string;
195
- /**
196
- * Custom formatters for rendering help.
197
- */
198
- formatters?: Partial<Formatters>;
199
- /**
200
- * Group definitions for commands and flags.
201
- * Groups allow organizing commands and flags into logical sections in help output.
202
- * Each group is defined as `[key, name]` where `key` is the identifier used in help options
203
- * and `name` is the display name shown in help output.
204
- */
205
- groups?: GroupsOptions;
206
- }
207
- declare const helpPlugin: ({
208
- command,
209
- flag,
210
- showHelpWhenNoCommandSpecified,
211
- notes,
212
- examples,
213
- header,
214
- footer,
215
- formatters,
216
- groups
217
- }?: HelpPluginOptions) => Plugin;
218
- //#endregion
219
- //#region ../plugin-not-found/src/index.d.ts
220
- declare const notFoundPlugin: () => Plugin;
221
- //#endregion
222
- //#region ../plugin-strict-flags/src/index.d.ts
223
- declare const strictFlagsPlugin: () => Plugin;
224
- //#endregion
225
- //#region ../plugin-version/src/index.d.ts
226
- interface VersionPluginOptions {
227
- /**
228
- * Whether to register the version command.
229
- *
230
- * @default true
231
- */
232
- command?: boolean;
233
- /**
234
- * Whether to register the global version flag.
235
- *
236
- * @default true
237
- */
238
- flag?: boolean;
239
- }
240
- declare const versionPlugin: ({
241
- command,
242
- flag
243
- }?: VersionPluginOptions) => Plugin;
11
+ //#region src/index.d.ts
244
12
  declare namespace index_d_exports {
245
- export { Cli, CommandHelpOptions, FriendlyErrorPluginOptions, GroupDefinition, GroupsOptions, HelpOptions, HelpPluginOptions, completionsPlugin, defaultFormatters, friendlyErrorPlugin, helpPlugin, notFoundPlugin, strictFlagsPlugin, versionPlugin };
13
+ export { Cli };
246
14
  }
247
15
  declare const Cli: (options?: CreateOptions) => Clerc;
248
16
  //#endregion
249
- export { Cli, CommandHelpOptions, FriendlyErrorPluginOptions, type GroupDefinition, type GroupsOptions, HelpOptions, HelpPluginOptions, completionsPlugin, defaultFormatters, friendlyErrorPlugin, helpPlugin, notFoundPlugin, strictFlagsPlugin, versionPlugin };
17
+ export { Cli };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clerc",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc: The full-featured cli library.",
@@ -44,12 +44,12 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@clerc/plugin-completions": "1.0.2",
48
- "@clerc/core": "1.0.2",
49
- "@clerc/plugin-friendly-error": "1.0.2",
50
- "@clerc/plugin-help": "1.0.2",
51
- "@clerc/plugin-strict-flags": "1.0.2",
52
- "@clerc/plugin-version": "1.0.2",
53
- "@clerc/plugin-not-found": "1.0.2"
47
+ "@clerc/core": "1.0.3",
48
+ "@clerc/plugin-completions": "1.0.3",
49
+ "@clerc/plugin-friendly-error": "1.0.3",
50
+ "@clerc/plugin-not-found": "1.0.3",
51
+ "@clerc/plugin-strict-flags": "1.0.3",
52
+ "@clerc/plugin-version": "1.0.3",
53
+ "@clerc/plugin-help": "1.0.3"
54
54
  }
55
55
  }