clerc 1.0.2 → 1.1.0
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 +3 -1
- package/dist/{chunk-CYeTv9WL.js → chunk-BwXVQOgl.mjs} +3 -9
- package/dist/index.d.mts +18 -0
- package/dist/{index.js → index.mjs} +4 -2
- package/package.json +14 -20
- package/dist/index.d.ts +0 -249
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/clerc)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Documenation
|
|
6
|
+
|
|
7
|
+
Read the [documentation](https://clerc.so1ve.dev) for more details.
|
|
6
8
|
|
|
7
9
|
## 📝 License
|
|
8
10
|
|
|
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var
|
|
6
|
+
var __exportAll = (all, symbols) => {
|
|
7
7
|
let target = {};
|
|
8
8
|
for (var name in all) {
|
|
9
9
|
__defProp(target, name, {
|
|
@@ -30,13 +30,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
30
30
|
}
|
|
31
31
|
return to;
|
|
32
32
|
};
|
|
33
|
-
var __reExport = (target, mod, secondTarget,
|
|
34
|
-
if (symbols) {
|
|
35
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
36
|
-
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
37
|
-
}
|
|
38
|
-
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
39
|
-
};
|
|
33
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
40
34
|
|
|
41
35
|
//#endregion
|
|
42
|
-
export { __reExport as n,
|
|
36
|
+
export { __reExport as n, __exportAll as t };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-BwXVQOgl.mjs";
|
|
2
|
+
import { Clerc, CreateOptions } from "@clerc/core";
|
|
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";
|
|
10
|
+
export * from "@clerc/plugin-update-notifier";
|
|
11
|
+
|
|
12
|
+
//#region src/index.d.ts
|
|
13
|
+
declare namespace index_d_exports {
|
|
14
|
+
export { Cli };
|
|
15
|
+
}
|
|
16
|
+
declare const Cli: (options?: CreateOptions) => Clerc;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Cli };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __reExport, t as
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-BwXVQOgl.mjs";
|
|
2
2
|
import { Clerc } from "@clerc/core";
|
|
3
3
|
import { helpPlugin } from "@clerc/plugin-help";
|
|
4
4
|
import { versionPlugin } from "@clerc/plugin-version";
|
|
@@ -17,8 +17,10 @@ export * from "@clerc/plugin-not-found"
|
|
|
17
17
|
|
|
18
18
|
export * from "@clerc/plugin-strict-flags"
|
|
19
19
|
|
|
20
|
+
export * from "@clerc/plugin-update-notifier"
|
|
21
|
+
|
|
20
22
|
//#region src/index.ts
|
|
21
|
-
var src_exports = /* @__PURE__ */
|
|
23
|
+
var src_exports = /* @__PURE__ */ __exportAll({ Cli: () => Cli });
|
|
22
24
|
const Cli = (options) => Clerc.create(options).use(versionPlugin()).use(helpPlugin());
|
|
23
25
|
|
|
24
26
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clerc",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Clerc: The full-featured cli library.",
|
|
@@ -24,19 +24,12 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"exports": {
|
|
27
|
-
".": "./dist/index.
|
|
28
|
-
|
|
29
|
-
"main": "./dist/index.js",
|
|
30
|
-
"module": "./dist/index.js",
|
|
31
|
-
"types": "dist/index.d.ts",
|
|
32
|
-
"typesVersions": {
|
|
33
|
-
"*": {
|
|
34
|
-
"*": [
|
|
35
|
-
"./dist/*",
|
|
36
|
-
"./dist/index.d.ts"
|
|
37
|
-
]
|
|
38
|
-
}
|
|
27
|
+
".": "./dist/index.mjs",
|
|
28
|
+
"./package.json": "./package.json"
|
|
39
29
|
},
|
|
30
|
+
"main": "./dist/index.mjs",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
40
33
|
"files": [
|
|
41
34
|
"dist"
|
|
42
35
|
],
|
|
@@ -44,12 +37,13 @@
|
|
|
44
37
|
"access": "public"
|
|
45
38
|
},
|
|
46
39
|
"dependencies": {
|
|
47
|
-
"@clerc/
|
|
48
|
-
"@clerc/
|
|
49
|
-
"@clerc/plugin-
|
|
50
|
-
"@clerc/plugin-
|
|
51
|
-
"@clerc/plugin-
|
|
52
|
-
"@clerc/plugin-
|
|
53
|
-
"@clerc/plugin-
|
|
40
|
+
"@clerc/core": "1.1.0",
|
|
41
|
+
"@clerc/plugin-completions": "1.1.0",
|
|
42
|
+
"@clerc/plugin-help": "1.1.0",
|
|
43
|
+
"@clerc/plugin-strict-flags": "1.1.0",
|
|
44
|
+
"@clerc/plugin-friendly-error": "1.1.0",
|
|
45
|
+
"@clerc/plugin-not-found": "1.1.0",
|
|
46
|
+
"@clerc/plugin-version": "1.1.0",
|
|
47
|
+
"@clerc/plugin-update-notifier": "1.1.0"
|
|
54
48
|
}
|
|
55
49
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
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";
|
|
4
|
-
export * from "@clerc/core";
|
|
5
|
-
|
|
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;
|
|
244
|
-
declare namespace index_d_exports {
|
|
245
|
-
export { Cli, CommandHelpOptions, FriendlyErrorPluginOptions, GroupDefinition, GroupsOptions, HelpOptions, HelpPluginOptions, completionsPlugin, defaultFormatters, friendlyErrorPlugin, helpPlugin, notFoundPlugin, strictFlagsPlugin, versionPlugin };
|
|
246
|
-
}
|
|
247
|
-
declare const Cli: (options?: CreateOptions) => Clerc;
|
|
248
|
-
//#endregion
|
|
249
|
-
export { Cli, CommandHelpOptions, FriendlyErrorPluginOptions, type GroupDefinition, type GroupsOptions, HelpOptions, HelpPluginOptions, completionsPlugin, defaultFormatters, friendlyErrorPlugin, helpPlugin, notFoundPlugin, strictFlagsPlugin, versionPlugin };
|