@boneskull/bargs 0.1.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/LICENSE +55 -0
- package/README.md +483 -0
- package/dist/bargs.cjs +167 -0
- package/dist/bargs.cjs.map +1 -0
- package/dist/bargs.d.cts +31 -0
- package/dist/bargs.d.cts.map +1 -0
- package/dist/bargs.d.ts +31 -0
- package/dist/bargs.d.ts.map +1 -0
- package/dist/bargs.js +163 -0
- package/dist/bargs.js.map +1 -0
- package/dist/errors.cjs +57 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +40 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.ts +40 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +51 -0
- package/dist/errors.js.map +1 -0
- package/dist/help.cjs +309 -0
- package/dist/help.cjs.map +1 -0
- package/dist/help.d.cts +21 -0
- package/dist/help.d.cts.map +1 -0
- package/dist/help.d.ts +21 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +304 -0
- package/dist/help.js.map +1 -0
- package/dist/index.cjs +63 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +96 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/opt.cjs +205 -0
- package/dist/opt.cjs.map +1 -0
- package/dist/opt.d.cts +145 -0
- package/dist/opt.d.cts.map +1 -0
- package/dist/opt.d.ts +145 -0
- package/dist/opt.d.ts.map +1 -0
- package/dist/opt.js +202 -0
- package/dist/opt.js.map +1 -0
- package/dist/osc.cjs +190 -0
- package/dist/osc.cjs.map +1 -0
- package/dist/osc.d.cts +30 -0
- package/dist/osc.d.cts.map +1 -0
- package/dist/osc.d.ts +30 -0
- package/dist/osc.d.ts.map +1 -0
- package/dist/osc.js +181 -0
- package/dist/osc.js.map +1 -0
- package/dist/parser.cjs +293 -0
- package/dist/parser.cjs.map +1 -0
- package/dist/parser.d.cts +47 -0
- package/dist/parser.d.cts.map +1 -0
- package/dist/parser.d.ts +47 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +285 -0
- package/dist/parser.js.map +1 -0
- package/dist/theme.cjs +203 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +227 -0
- package/dist/theme.d.cts.map +1 -0
- package/dist/theme.d.ts +227 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +198 -0
- package/dist/theme.js.map +1 -0
- package/dist/types.cjs +18 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +244 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +244 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.cjs +452 -0
- package/dist/validate.cjs.map +1 -0
- package/dist/validate.d.cts +28 -0
- package/dist/validate.d.cts.map +1 -0
- package/dist/validate.d.ts +28 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +448 -0
- package/dist/validate.js.map +1 -0
- package/dist/version.cjs +134 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.d.cts +27 -0
- package/dist/version.d.cts.map +1 -0
- package/dist/version.d.ts +27 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +129 -0
- package/dist/version.js.map +1 -0
- package/package.json +149 -0
package/dist/help.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help text generation for CLI applications.
|
|
3
|
+
*
|
|
4
|
+
* Generates formatted, colorized help output for both simple CLIs and
|
|
5
|
+
* command-based CLIs. Supports customizable themes, automatic URL linkification
|
|
6
|
+
* in terminals that support hyperlinks, option grouping, and automatic epilog
|
|
7
|
+
* generation from `package.json` metadata.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
import { link, supportsHyperlinks } from "./osc.js";
|
|
12
|
+
import { createStyler, defaultTheme, } from "./theme.js";
|
|
13
|
+
import { readPackageInfoSync } from "./version.js";
|
|
14
|
+
/**
|
|
15
|
+
* URL regex pattern for matching URLs in text.
|
|
16
|
+
*/
|
|
17
|
+
const URL_PATTERN = /https?:\/\/[^\s<>"\])}]+/g;
|
|
18
|
+
/**
|
|
19
|
+
* Linkify URLs in text if terminal supports hyperlinks. Applies URL styling.
|
|
20
|
+
*/
|
|
21
|
+
const linkifyText = (text, styler, stream = process.stdout) => {
|
|
22
|
+
const canLink = supportsHyperlinks(stream);
|
|
23
|
+
return text.replace(URL_PATTERN, (url) => {
|
|
24
|
+
const styledUrl = styler.url(url);
|
|
25
|
+
return canLink ? link(styledUrl, url) : styledUrl;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Generate default epilog from package.json (homepage and repository).
|
|
30
|
+
*/
|
|
31
|
+
const generateDefaultEpilog = (styler) => {
|
|
32
|
+
const pkgInfo = readPackageInfoSync();
|
|
33
|
+
const lines = [];
|
|
34
|
+
if (pkgInfo.homepage) {
|
|
35
|
+
const styledUrl = styler.url(pkgInfo.homepage);
|
|
36
|
+
const linkedUrl = supportsHyperlinks()
|
|
37
|
+
? link(styledUrl, pkgInfo.homepage)
|
|
38
|
+
: styledUrl;
|
|
39
|
+
lines.push(styler.epilog(`Homepage: ${linkedUrl}`));
|
|
40
|
+
}
|
|
41
|
+
if (pkgInfo.repository) {
|
|
42
|
+
const styledUrl = styler.url(pkgInfo.repository);
|
|
43
|
+
const linkedUrl = supportsHyperlinks()
|
|
44
|
+
? link(styledUrl, pkgInfo.repository)
|
|
45
|
+
: styledUrl;
|
|
46
|
+
lines.push(styler.epilog(`Repository: ${linkedUrl}`));
|
|
47
|
+
}
|
|
48
|
+
return lines;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Format epilog based on config. Returns empty array if epilog is disabled,
|
|
52
|
+
* custom epilog lines if provided, or default epilog from package.json.
|
|
53
|
+
*/
|
|
54
|
+
const formatEpilog = (config, styler) => {
|
|
55
|
+
// Explicitly disabled
|
|
56
|
+
if (config.epilog === false || config.epilog === '') {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
// Custom epilog provided
|
|
60
|
+
if (typeof config.epilog === 'string') {
|
|
61
|
+
const linkified = linkifyText(config.epilog, styler);
|
|
62
|
+
return [styler.epilog(linkified)];
|
|
63
|
+
}
|
|
64
|
+
// Default: generate from package.json
|
|
65
|
+
return generateDefaultEpilog(styler);
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Format a single positional for help usage line. Required positionals use
|
|
69
|
+
* <name>, optional use [name]. Variadic positionals append "...".
|
|
70
|
+
*/
|
|
71
|
+
const formatPositionalUsage = (def, index) => {
|
|
72
|
+
const name = def.name ?? `arg${index}`;
|
|
73
|
+
const isRequired = def.required || 'default' in def;
|
|
74
|
+
const isVariadic = def.type === 'variadic';
|
|
75
|
+
const displayName = isVariadic ? `${name}...` : name;
|
|
76
|
+
return isRequired ? `<${displayName}>` : `[${displayName}]`;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Build the positionals usage string from a schema.
|
|
80
|
+
*/
|
|
81
|
+
const buildPositionalsUsage = (schema) => {
|
|
82
|
+
if (!schema || schema.length === 0) {
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
return schema
|
|
86
|
+
.map((def, index) => formatPositionalUsage(def, index))
|
|
87
|
+
.join(' ');
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Get type label for help display.
|
|
91
|
+
*/
|
|
92
|
+
const getTypeLabel = (def) => {
|
|
93
|
+
switch (def.type) {
|
|
94
|
+
case 'array':
|
|
95
|
+
return `${def.items}[]`;
|
|
96
|
+
case 'boolean':
|
|
97
|
+
return 'boolean';
|
|
98
|
+
case 'count':
|
|
99
|
+
return 'count';
|
|
100
|
+
case 'enum':
|
|
101
|
+
return def.choices.join(' | ');
|
|
102
|
+
case 'number':
|
|
103
|
+
return 'number';
|
|
104
|
+
case 'string':
|
|
105
|
+
return 'string';
|
|
106
|
+
default:
|
|
107
|
+
return 'string';
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Format a single option for help output.
|
|
112
|
+
*/
|
|
113
|
+
const formatOptionHelp = (name, def, styler) => {
|
|
114
|
+
const parts = [];
|
|
115
|
+
// Build flag string: -v, --verbose
|
|
116
|
+
const shortAlias = def.aliases?.find((a) => a.length === 1);
|
|
117
|
+
const flagText = shortAlias ? `-${shortAlias}, --${name}` : ` --${name}`;
|
|
118
|
+
parts.push(` ${styler.flag(flagText)}`);
|
|
119
|
+
// Pad to align descriptions
|
|
120
|
+
const padding = Math.max(0, 24 - flagText.length - 2);
|
|
121
|
+
parts.push(' '.repeat(padding));
|
|
122
|
+
// Description
|
|
123
|
+
if (def.description) {
|
|
124
|
+
parts.push(styler.description(def.description));
|
|
125
|
+
}
|
|
126
|
+
// Type and default
|
|
127
|
+
const typeLabel = getTypeLabel(def);
|
|
128
|
+
const suffixParts = [styler.type(`[${typeLabel}]`)];
|
|
129
|
+
if ('default' in def && def.default !== undefined) {
|
|
130
|
+
suffixParts.push(`${styler.defaultText('default:')} ${styler.defaultValue(JSON.stringify(def.default))}`);
|
|
131
|
+
}
|
|
132
|
+
parts.push(' ', suffixParts.join(' '));
|
|
133
|
+
return parts.join('');
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Check if config has commands.
|
|
137
|
+
*/
|
|
138
|
+
const hasCommands = (config) => config.commands !== undefined && Object.keys(config.commands).length > 0;
|
|
139
|
+
/**
|
|
140
|
+
* Generate help text for a bargs config.
|
|
141
|
+
*/
|
|
142
|
+
export const generateHelp = (config, theme = defaultTheme) => {
|
|
143
|
+
const styler = createStyler(theme);
|
|
144
|
+
const lines = [];
|
|
145
|
+
// Header
|
|
146
|
+
const version = config.version ? ` v${config.version}` : '';
|
|
147
|
+
lines.push('');
|
|
148
|
+
lines.push(`${styler.scriptName(config.name)}${styler.defaultValue(version)}`);
|
|
149
|
+
if (config.description) {
|
|
150
|
+
const linkifiedDesc = linkifyText(config.description, styler);
|
|
151
|
+
lines.push(` ${styler.description(linkifiedDesc)}`);
|
|
152
|
+
}
|
|
153
|
+
lines.push('');
|
|
154
|
+
// Build positional names for usage line
|
|
155
|
+
const posNames = [];
|
|
156
|
+
if (config.positionals && config.positionals.length > 0) {
|
|
157
|
+
for (let i = 0; i < config.positionals.length; i++) {
|
|
158
|
+
const pos = config.positionals[i];
|
|
159
|
+
const formatted = formatPositionalUsage(pos, i);
|
|
160
|
+
posNames.push(styler.positional(formatted));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Usage
|
|
164
|
+
lines.push(styler.sectionHeader('USAGE'));
|
|
165
|
+
if (hasCommands(config)) {
|
|
166
|
+
const posStr = posNames.length > 0 ? ` ${posNames.join(' ')}` : '';
|
|
167
|
+
lines.push(styler.usage(` $ ${config.name} <command> [options]${posStr}`));
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
const posStr = posNames.length > 0 ? ` ${posNames.join(' ')}` : '';
|
|
171
|
+
lines.push(styler.usage(` $ ${config.name} [options]${posStr}`));
|
|
172
|
+
}
|
|
173
|
+
lines.push('');
|
|
174
|
+
// Commands
|
|
175
|
+
if (hasCommands(config)) {
|
|
176
|
+
lines.push(styler.sectionHeader('COMMANDS'));
|
|
177
|
+
for (const [name, cmd] of Object.entries(config.commands)) {
|
|
178
|
+
const padding = Math.max(0, 14 - name.length);
|
|
179
|
+
lines.push(` ${styler.command(name)}${' '.repeat(padding)}${styler.description(cmd.description)}`);
|
|
180
|
+
}
|
|
181
|
+
lines.push('');
|
|
182
|
+
}
|
|
183
|
+
// Options
|
|
184
|
+
if (config.options && Object.keys(config.options).length > 0) {
|
|
185
|
+
// Group options
|
|
186
|
+
const groups = new Map();
|
|
187
|
+
const ungrouped = [];
|
|
188
|
+
for (const [name, def] of Object.entries(config.options)) {
|
|
189
|
+
if (def.hidden) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (def.group) {
|
|
193
|
+
const group = groups.get(def.group) ?? [];
|
|
194
|
+
group.push({ def, name });
|
|
195
|
+
groups.set(def.group, group);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
ungrouped.push({ def, name });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Print grouped options
|
|
202
|
+
for (const [groupName, options] of Array.from(groups.entries())) {
|
|
203
|
+
lines.push(styler.sectionHeader(groupName.toUpperCase()));
|
|
204
|
+
for (const opt of options) {
|
|
205
|
+
lines.push(formatOptionHelp(opt.name, opt.def, styler));
|
|
206
|
+
}
|
|
207
|
+
lines.push('');
|
|
208
|
+
}
|
|
209
|
+
// Print ungrouped
|
|
210
|
+
if (ungrouped.length > 0) {
|
|
211
|
+
const label = hasCommands(config) ? 'GLOBAL OPTIONS' : 'OPTIONS';
|
|
212
|
+
lines.push(styler.sectionHeader(label));
|
|
213
|
+
for (const opt of ungrouped) {
|
|
214
|
+
lines.push(formatOptionHelp(opt.name, opt.def, styler));
|
|
215
|
+
}
|
|
216
|
+
lines.push('');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Positionals
|
|
220
|
+
if (config.positionals && config.positionals.length > 0) {
|
|
221
|
+
lines.push(styler.sectionHeader('POSITIONALS'));
|
|
222
|
+
for (let i = 0; i < config.positionals.length; i++) {
|
|
223
|
+
const pos = config.positionals[i];
|
|
224
|
+
const name = pos.name ?? `arg${i}`;
|
|
225
|
+
const formatted = pos.required ? `<${name}>` : `[${name}]`;
|
|
226
|
+
const padding = Math.max(0, 20 - formatted.length);
|
|
227
|
+
const desc = pos.description ?? '';
|
|
228
|
+
lines.push(` ${styler.positional(formatted)}${' '.repeat(padding)}${styler.description(desc)}`);
|
|
229
|
+
}
|
|
230
|
+
lines.push('');
|
|
231
|
+
}
|
|
232
|
+
// Footer
|
|
233
|
+
if (hasCommands(config)) {
|
|
234
|
+
lines.push(styler.example(`Run '${config.name} <command> --help' for command-specific help.`));
|
|
235
|
+
lines.push('');
|
|
236
|
+
}
|
|
237
|
+
// Epilog
|
|
238
|
+
const epilogLines = formatEpilog(config, styler);
|
|
239
|
+
if (epilogLines.length > 0) {
|
|
240
|
+
lines.push(...epilogLines);
|
|
241
|
+
lines.push('');
|
|
242
|
+
}
|
|
243
|
+
return lines.join('\n');
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Generate help text for a specific command.
|
|
247
|
+
*/
|
|
248
|
+
export const generateCommandHelp = (config, commandName, theme = defaultTheme) => {
|
|
249
|
+
const styler = createStyler(theme);
|
|
250
|
+
const commandsRecord = config.commands;
|
|
251
|
+
const command = commandsRecord[commandName];
|
|
252
|
+
if (!command) {
|
|
253
|
+
return `Unknown command: ${commandName}`;
|
|
254
|
+
}
|
|
255
|
+
const lines = [];
|
|
256
|
+
// Header
|
|
257
|
+
lines.push('');
|
|
258
|
+
lines.push(` ${styler.scriptName(config.name)} ${styler.command(commandName)}`);
|
|
259
|
+
const linkifiedDesc = linkifyText(command.description, styler);
|
|
260
|
+
lines.push(` ${styler.description(linkifiedDesc)}`);
|
|
261
|
+
lines.push('');
|
|
262
|
+
// Usage
|
|
263
|
+
lines.push(styler.sectionHeader('USAGE'));
|
|
264
|
+
const positionalsPart = buildPositionalsUsage(command.positionals);
|
|
265
|
+
const usageParts = [
|
|
266
|
+
`$ ${config.name} ${commandName}`,
|
|
267
|
+
'[options]',
|
|
268
|
+
positionalsPart,
|
|
269
|
+
]
|
|
270
|
+
.filter(Boolean)
|
|
271
|
+
.join(' ');
|
|
272
|
+
lines.push(styler.usage(` ${usageParts}`));
|
|
273
|
+
lines.push('');
|
|
274
|
+
// Command options
|
|
275
|
+
if (command.options && Object.keys(command.options).length > 0) {
|
|
276
|
+
lines.push(styler.sectionHeader('OPTIONS'));
|
|
277
|
+
for (const [name, def] of Object.entries(command.options)) {
|
|
278
|
+
if (def.hidden) {
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
lines.push(formatOptionHelp(name, def, styler));
|
|
282
|
+
}
|
|
283
|
+
lines.push('');
|
|
284
|
+
}
|
|
285
|
+
// Global options
|
|
286
|
+
if (config.options && Object.keys(config.options).length > 0) {
|
|
287
|
+
lines.push(styler.sectionHeader('GLOBAL OPTIONS'));
|
|
288
|
+
for (const [name, def] of Object.entries(config.options)) {
|
|
289
|
+
if (def.hidden) {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
lines.push(formatOptionHelp(name, def, styler));
|
|
293
|
+
}
|
|
294
|
+
lines.push('');
|
|
295
|
+
}
|
|
296
|
+
// Epilog
|
|
297
|
+
const epilogLines = formatEpilog(config, styler);
|
|
298
|
+
if (epilogLines.length > 0) {
|
|
299
|
+
lines.push(...epilogLines);
|
|
300
|
+
lines.push('');
|
|
301
|
+
}
|
|
302
|
+
return lines.join('\n');
|
|
303
|
+
};
|
|
304
|
+
//# sourceMappingURL=help.js.map
|
package/dist/help.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB;AACpD,OAAO,EACL,YAAY,EACZ,YAAY,GAGb,mBAAmB;AACpB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB;AAEnD;;GAEG;AACH,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,GAAG,CAClB,IAAY,EACZ,MAAc,EACd,SAA6B,OAAO,CAAC,MAAM,EACnC,EAAE;IACV,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3C,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE;QACvC,MAAM,SAAS,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AAiB;IACjB,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7D,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACnD,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YACzD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;gBACf,SAAS;YACX,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,SAAS;IACT,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Main entry point for the bargs CLI argument parser.
|
|
4
|
+
*
|
|
5
|
+
* This module exports the primary `bargs` and `bargsAsync` functions with
|
|
6
|
+
* attached option builder methods (e.g., `bargs.string()`, `bargs.boolean()`),
|
|
7
|
+
* allowing both function-call and builder-namespace usage patterns. It also
|
|
8
|
+
* re-exports all public types, error classes, help generators, theme utilities,
|
|
9
|
+
* and OSC hyperlink functions.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { bargs } from 'bargs';
|
|
15
|
+
*
|
|
16
|
+
* // Use as function
|
|
17
|
+
* const result = bargs({
|
|
18
|
+
* name: 'myapp',
|
|
19
|
+
* options: { verbose: bargs.boolean({ aliases: ['v'] }) },
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Access builder namespace
|
|
23
|
+
* const opts = bargs.options({ name: bargs.string() });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.themes = exports.stripAnsi = exports.defaultTheme = exports.createStyler = exports.ansi = exports.supportsHyperlinks = exports.linkifyUrls = exports.link = exports.generateHelp = exports.generateCommandHelp = exports.ValidationError = exports.HelpError = exports.BargsError = exports.bargsAsync = exports.bargs = void 0;
|
|
30
|
+
const bargs_js_1 = require("./bargs.cjs");
|
|
31
|
+
const opt_js_1 = require("./opt.cjs");
|
|
32
|
+
/**
|
|
33
|
+
* Main bargs entry point (sync). Also provides access to all opt builders via
|
|
34
|
+
* bargs.string(), bargs.boolean(), etc.
|
|
35
|
+
*/
|
|
36
|
+
exports.bargs = Object.assign(bargs_js_1.bargs, opt_js_1.opt);
|
|
37
|
+
/**
|
|
38
|
+
* Async bargs entry point. Also provides access to all opt builders via
|
|
39
|
+
* bargsAsync.string(), etc.
|
|
40
|
+
*/
|
|
41
|
+
exports.bargsAsync = Object.assign(bargs_js_1.bargsAsync, opt_js_1.opt);
|
|
42
|
+
// Re-export errors
|
|
43
|
+
var errors_js_1 = require("./errors.cjs");
|
|
44
|
+
Object.defineProperty(exports, "BargsError", { enumerable: true, get: function () { return errors_js_1.BargsError; } });
|
|
45
|
+
Object.defineProperty(exports, "HelpError", { enumerable: true, get: function () { return errors_js_1.HelpError; } });
|
|
46
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_js_1.ValidationError; } });
|
|
47
|
+
// Re-export help generators
|
|
48
|
+
var help_js_1 = require("./help.cjs");
|
|
49
|
+
Object.defineProperty(exports, "generateCommandHelp", { enumerable: true, get: function () { return help_js_1.generateCommandHelp; } });
|
|
50
|
+
Object.defineProperty(exports, "generateHelp", { enumerable: true, get: function () { return help_js_1.generateHelp; } });
|
|
51
|
+
// Re-export OSC utilities for terminal hyperlinks
|
|
52
|
+
var osc_js_1 = require("./osc.cjs");
|
|
53
|
+
Object.defineProperty(exports, "link", { enumerable: true, get: function () { return osc_js_1.link; } });
|
|
54
|
+
Object.defineProperty(exports, "linkifyUrls", { enumerable: true, get: function () { return osc_js_1.linkifyUrls; } });
|
|
55
|
+
Object.defineProperty(exports, "supportsHyperlinks", { enumerable: true, get: function () { return osc_js_1.supportsHyperlinks; } });
|
|
56
|
+
// Re-export theme utilities
|
|
57
|
+
var theme_js_1 = require("./theme.cjs");
|
|
58
|
+
Object.defineProperty(exports, "ansi", { enumerable: true, get: function () { return theme_js_1.ansi; } });
|
|
59
|
+
Object.defineProperty(exports, "createStyler", { enumerable: true, get: function () { return theme_js_1.createStyler; } });
|
|
60
|
+
Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return theme_js_1.defaultTheme; } });
|
|
61
|
+
Object.defineProperty(exports, "stripAnsi", { enumerable: true, get: function () { return theme_js_1.stripAnsi; } });
|
|
62
|
+
Object.defineProperty(exports, "themes", { enumerable: true, get: function () { return theme_js_1.themes; } });
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,0CAA8E;AAC9E,sCAA+B;AAE/B;;;GAGG;AACU,QAAA,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAS,EAAE,YAAG,CAAC,CAAC;AAEnD;;;GAGG;AACU,QAAA,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAc,EAAE,YAAG,CAAC,CAAC;AAE7D,mBAAmB;AACnB,0CAAqE;AAA5D,uGAAA,UAAU,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,4GAAA,eAAe,OAAA;AAE/C,4BAA4B;AAC5B,sCAA8D;AAArD,8GAAA,mBAAmB,OAAA;AAAE,uGAAA,YAAY,OAAA;AAE1C,kDAAkD;AAClD,oCAAiE;AAAxD,8FAAA,IAAI,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAE9C,4BAA4B;AAC5B,wCAMoB;AALlB,gGAAA,IAAI,OAAA;AACJ,wGAAA,YAAY,OAAA;AACZ,wGAAA,YAAY,OAAA;AACZ,qGAAA,SAAS,OAAA;AACT,kGAAA,MAAM,OAAA"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main entry point for the bargs CLI argument parser.
|
|
3
|
+
*
|
|
4
|
+
* This module exports the primary `bargs` and `bargsAsync` functions with
|
|
5
|
+
* attached option builder methods (e.g., `bargs.string()`, `bargs.boolean()`),
|
|
6
|
+
* allowing both function-call and builder-namespace usage patterns. It also
|
|
7
|
+
* re-exports all public types, error classes, help generators, theme utilities,
|
|
8
|
+
* and OSC hyperlink functions.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { bargs } from 'bargs';
|
|
14
|
+
*
|
|
15
|
+
* // Use as function
|
|
16
|
+
* const result = bargs({
|
|
17
|
+
* name: 'myapp',
|
|
18
|
+
* options: { verbose: bargs.boolean({ aliases: ['v'] }) },
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Access builder namespace
|
|
22
|
+
* const opts = bargs.options({ name: bargs.string() });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
import { bargsAsync as bargsAsyncBase, bargs as bargsBase } from "./bargs.cjs";
|
|
28
|
+
/**
|
|
29
|
+
* Main bargs entry point (sync). Also provides access to all opt builders via
|
|
30
|
+
* bargs.string(), bargs.boolean(), etc.
|
|
31
|
+
*/
|
|
32
|
+
export declare const bargs: typeof bargsBase & {
|
|
33
|
+
array: (items: "number" | "string", props?: Omit<import("./types.js").ArrayOption, "items" | "type">) => import("./types.js").ArrayOption;
|
|
34
|
+
boolean: <P extends Omit<import("./types.js").BooleanOption, "type"> = Omit<import("./types.js").BooleanOption, "type">>(props?: P) => import("./types.js").BooleanOption & P;
|
|
35
|
+
command: <TOptions extends import("./types.js").OptionsSchema = import("./types.js").OptionsSchema, TPositionals extends import("./types.js").PositionalsSchema = import("./types.js").PositionalsSchema>(config: import("./types.js").CommandConfig<TOptions, TPositionals>) => import("./types.js").CommandConfig<TOptions, TPositionals>;
|
|
36
|
+
count: (props?: Omit<import("./types.js").CountOption, "type">) => import("./types.js").CountOption;
|
|
37
|
+
enum: <const T extends readonly string[], P extends Omit<import("./types.js").EnumOption<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumOption<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumOption<T[number]> & P;
|
|
38
|
+
enumPos: <const T extends readonly string[], P extends Omit<import("./types.js").EnumPositional<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumPositional<T[number]> & P;
|
|
39
|
+
number: <P extends Omit<import("./types.js").NumberOption, "type"> = Omit<import("./types.js").NumberOption, "type">>(props?: P) => import("./types.js").NumberOption & P;
|
|
40
|
+
numberPos: (props?: Omit<import("./types.js").NumberPositional, "type">) => import("./types.js").NumberPositional;
|
|
41
|
+
options: {
|
|
42
|
+
<A extends import("./types.js").OptionsSchema>(a: A): A;
|
|
43
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema>(a: A, b: B): A & B;
|
|
44
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema>(a: A, b: B, c: C): A & B & C;
|
|
45
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema, D extends import("./types.js").OptionsSchema>(a: A, b: B, c: C, d: D): A & B & C & D;
|
|
46
|
+
(...schemas: import("./types.js").OptionsSchema[]): import("./types.js").OptionsSchema;
|
|
47
|
+
};
|
|
48
|
+
positionals: {
|
|
49
|
+
<A extends import("./types.js").PositionalDef>(a: A): [A];
|
|
50
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef>(a: A, b: B): [A, B];
|
|
51
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef>(a: A, b: B, c: C): [A, B, C];
|
|
52
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef, D extends import("./types.js").PositionalDef>(a: A, b: B, c: C, d: D): [A, B, C, D];
|
|
53
|
+
(...positionals: import("./types.js").PositionalDef[]): import("./types.js").PositionalsSchema;
|
|
54
|
+
};
|
|
55
|
+
string: <P extends Omit<import("./types.js").StringOption, "type"> = Omit<import("./types.js").StringOption, "type">>(props?: P) => P & import("./types.js").StringOption;
|
|
56
|
+
stringPos: (props?: Omit<import("./types.js").StringPositional, "type">) => import("./types.js").StringPositional;
|
|
57
|
+
variadic: (items: "number" | "string", props?: Omit<import("./types.js").VariadicPositional, "items" | "type">) => import("./types.js").VariadicPositional;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Async bargs entry point. Also provides access to all opt builders via
|
|
61
|
+
* bargsAsync.string(), etc.
|
|
62
|
+
*/
|
|
63
|
+
export declare const bargsAsync: typeof bargsAsyncBase & {
|
|
64
|
+
array: (items: "number" | "string", props?: Omit<import("./types.js").ArrayOption, "items" | "type">) => import("./types.js").ArrayOption;
|
|
65
|
+
boolean: <P extends Omit<import("./types.js").BooleanOption, "type"> = Omit<import("./types.js").BooleanOption, "type">>(props?: P) => import("./types.js").BooleanOption & P;
|
|
66
|
+
command: <TOptions extends import("./types.js").OptionsSchema = import("./types.js").OptionsSchema, TPositionals extends import("./types.js").PositionalsSchema = import("./types.js").PositionalsSchema>(config: import("./types.js").CommandConfig<TOptions, TPositionals>) => import("./types.js").CommandConfig<TOptions, TPositionals>;
|
|
67
|
+
count: (props?: Omit<import("./types.js").CountOption, "type">) => import("./types.js").CountOption;
|
|
68
|
+
enum: <const T extends readonly string[], P extends Omit<import("./types.js").EnumOption<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumOption<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumOption<T[number]> & P;
|
|
69
|
+
enumPos: <const T extends readonly string[], P extends Omit<import("./types.js").EnumPositional<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumPositional<T[number]> & P;
|
|
70
|
+
number: <P extends Omit<import("./types.js").NumberOption, "type"> = Omit<import("./types.js").NumberOption, "type">>(props?: P) => import("./types.js").NumberOption & P;
|
|
71
|
+
numberPos: (props?: Omit<import("./types.js").NumberPositional, "type">) => import("./types.js").NumberPositional;
|
|
72
|
+
options: {
|
|
73
|
+
<A extends import("./types.js").OptionsSchema>(a: A): A;
|
|
74
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema>(a: A, b: B): A & B;
|
|
75
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema>(a: A, b: B, c: C): A & B & C;
|
|
76
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema, D extends import("./types.js").OptionsSchema>(a: A, b: B, c: C, d: D): A & B & C & D;
|
|
77
|
+
(...schemas: import("./types.js").OptionsSchema[]): import("./types.js").OptionsSchema;
|
|
78
|
+
};
|
|
79
|
+
positionals: {
|
|
80
|
+
<A extends import("./types.js").PositionalDef>(a: A): [A];
|
|
81
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef>(a: A, b: B): [A, B];
|
|
82
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef>(a: A, b: B, c: C): [A, B, C];
|
|
83
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef, D extends import("./types.js").PositionalDef>(a: A, b: B, c: C, d: D): [A, B, C, D];
|
|
84
|
+
(...positionals: import("./types.js").PositionalDef[]): import("./types.js").PositionalsSchema;
|
|
85
|
+
};
|
|
86
|
+
string: <P extends Omit<import("./types.js").StringOption, "type"> = Omit<import("./types.js").StringOption, "type">>(props?: P) => P & import("./types.js").StringOption;
|
|
87
|
+
stringPos: (props?: Omit<import("./types.js").StringPositional, "type">) => import("./types.js").StringPositional;
|
|
88
|
+
variadic: (items: "number" | "string", props?: Omit<import("./types.js").VariadicPositional, "items" | "type">) => import("./types.js").VariadicPositional;
|
|
89
|
+
};
|
|
90
|
+
export { BargsError, HelpError, ValidationError } from "./errors.cjs";
|
|
91
|
+
export { generateCommandHelp, generateHelp } from "./help.cjs";
|
|
92
|
+
export { link, linkifyUrls, supportsHyperlinks } from "./osc.cjs";
|
|
93
|
+
export { ansi, createStyler, defaultTheme, stripAnsi, themes, } from "./theme.cjs";
|
|
94
|
+
export type { StyleFn, Styler, Theme, ThemeColors, ThemeInput, } from "./theme.cjs";
|
|
95
|
+
export type { AnyCommandConfig, ArrayOption, BargsConfig, BargsConfigWithCommands, BargsOptions, BargsResult, BooleanOption, CommandConfig, CommandConfigInput, CountOption, EnumOption, Handler, HandlerFn, InferOption, InferOptions, InferPositional, InferPositionals, NumberOption, NumberPositional, OptionDef, OptionsSchema, PositionalDef, PositionalsSchema, StringOption, StringPositional, VariadicPositional, } from "./types.cjs";
|
|
96
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,KAAK,IAAI,SAAS,EAAE,oBAAmB;AAG9E;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;SAgE8rI,GAAG;;;;;;;SAAo1B,GAAG;;;;;CAhEx/J,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;SA0DyrI,GAAG;;;;;;;SAAo1B,GAAG;;;;;CA1D9+J,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,qBAAoB;AAGrE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAkB;AAG9D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAiB;AAGjE,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,MAAM,GACP,oBAAmB;AAGpB,YAAY,EACV,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,UAAU,GACX,oBAAmB;AAGpB,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,GACnB,oBAAmB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main entry point for the bargs CLI argument parser.
|
|
3
|
+
*
|
|
4
|
+
* This module exports the primary `bargs` and `bargsAsync` functions with
|
|
5
|
+
* attached option builder methods (e.g., `bargs.string()`, `bargs.boolean()`),
|
|
6
|
+
* allowing both function-call and builder-namespace usage patterns. It also
|
|
7
|
+
* re-exports all public types, error classes, help generators, theme utilities,
|
|
8
|
+
* and OSC hyperlink functions.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { bargs } from 'bargs';
|
|
14
|
+
*
|
|
15
|
+
* // Use as function
|
|
16
|
+
* const result = bargs({
|
|
17
|
+
* name: 'myapp',
|
|
18
|
+
* options: { verbose: bargs.boolean({ aliases: ['v'] }) },
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Access builder namespace
|
|
22
|
+
* const opts = bargs.options({ name: bargs.string() });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
import { bargsAsync as bargsAsyncBase, bargs as bargsBase } from "./bargs.js";
|
|
28
|
+
/**
|
|
29
|
+
* Main bargs entry point (sync). Also provides access to all opt builders via
|
|
30
|
+
* bargs.string(), bargs.boolean(), etc.
|
|
31
|
+
*/
|
|
32
|
+
export declare const bargs: typeof bargsBase & {
|
|
33
|
+
array: (items: "number" | "string", props?: Omit<import("./types.js").ArrayOption, "items" | "type">) => import("./types.js").ArrayOption;
|
|
34
|
+
boolean: <P extends Omit<import("./types.js").BooleanOption, "type"> = Omit<import("./types.js").BooleanOption, "type">>(props?: P) => import("./types.js").BooleanOption & P;
|
|
35
|
+
command: <TOptions extends import("./types.js").OptionsSchema = import("./types.js").OptionsSchema, TPositionals extends import("./types.js").PositionalsSchema = import("./types.js").PositionalsSchema>(config: import("./types.js").CommandConfig<TOptions, TPositionals>) => import("./types.js").CommandConfig<TOptions, TPositionals>;
|
|
36
|
+
count: (props?: Omit<import("./types.js").CountOption, "type">) => import("./types.js").CountOption;
|
|
37
|
+
enum: <const T extends readonly string[], P extends Omit<import("./types.js").EnumOption<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumOption<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumOption<T[number]> & P;
|
|
38
|
+
enumPos: <const T extends readonly string[], P extends Omit<import("./types.js").EnumPositional<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumPositional<T[number]> & P;
|
|
39
|
+
number: <P extends Omit<import("./types.js").NumberOption, "type"> = Omit<import("./types.js").NumberOption, "type">>(props?: P) => import("./types.js").NumberOption & P;
|
|
40
|
+
numberPos: (props?: Omit<import("./types.js").NumberPositional, "type">) => import("./types.js").NumberPositional;
|
|
41
|
+
options: {
|
|
42
|
+
<A extends import("./types.js").OptionsSchema>(a: A): A;
|
|
43
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema>(a: A, b: B): A & B;
|
|
44
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema>(a: A, b: B, c: C): A & B & C;
|
|
45
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema, D extends import("./types.js").OptionsSchema>(a: A, b: B, c: C, d: D): A & B & C & D;
|
|
46
|
+
(...schemas: import("./types.js").OptionsSchema[]): import("./types.js").OptionsSchema;
|
|
47
|
+
};
|
|
48
|
+
positionals: {
|
|
49
|
+
<A extends import("./types.js").PositionalDef>(a: A): [A];
|
|
50
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef>(a: A, b: B): [A, B];
|
|
51
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef>(a: A, b: B, c: C): [A, B, C];
|
|
52
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef, D extends import("./types.js").PositionalDef>(a: A, b: B, c: C, d: D): [A, B, C, D];
|
|
53
|
+
(...positionals: import("./types.js").PositionalDef[]): import("./types.js").PositionalsSchema;
|
|
54
|
+
};
|
|
55
|
+
string: <P extends Omit<import("./types.js").StringOption, "type"> = Omit<import("./types.js").StringOption, "type">>(props?: P) => P & import("./types.js").StringOption;
|
|
56
|
+
stringPos: (props?: Omit<import("./types.js").StringPositional, "type">) => import("./types.js").StringPositional;
|
|
57
|
+
variadic: (items: "number" | "string", props?: Omit<import("./types.js").VariadicPositional, "items" | "type">) => import("./types.js").VariadicPositional;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Async bargs entry point. Also provides access to all opt builders via
|
|
61
|
+
* bargsAsync.string(), etc.
|
|
62
|
+
*/
|
|
63
|
+
export declare const bargsAsync: typeof bargsAsyncBase & {
|
|
64
|
+
array: (items: "number" | "string", props?: Omit<import("./types.js").ArrayOption, "items" | "type">) => import("./types.js").ArrayOption;
|
|
65
|
+
boolean: <P extends Omit<import("./types.js").BooleanOption, "type"> = Omit<import("./types.js").BooleanOption, "type">>(props?: P) => import("./types.js").BooleanOption & P;
|
|
66
|
+
command: <TOptions extends import("./types.js").OptionsSchema = import("./types.js").OptionsSchema, TPositionals extends import("./types.js").PositionalsSchema = import("./types.js").PositionalsSchema>(config: import("./types.js").CommandConfig<TOptions, TPositionals>) => import("./types.js").CommandConfig<TOptions, TPositionals>;
|
|
67
|
+
count: (props?: Omit<import("./types.js").CountOption, "type">) => import("./types.js").CountOption;
|
|
68
|
+
enum: <const T extends readonly string[], P extends Omit<import("./types.js").EnumOption<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumOption<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumOption<T[number]> & P;
|
|
69
|
+
enumPos: <const T extends readonly string[], P extends Omit<import("./types.js").EnumPositional<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumPositional<T[number]> & P;
|
|
70
|
+
number: <P extends Omit<import("./types.js").NumberOption, "type"> = Omit<import("./types.js").NumberOption, "type">>(props?: P) => import("./types.js").NumberOption & P;
|
|
71
|
+
numberPos: (props?: Omit<import("./types.js").NumberPositional, "type">) => import("./types.js").NumberPositional;
|
|
72
|
+
options: {
|
|
73
|
+
<A extends import("./types.js").OptionsSchema>(a: A): A;
|
|
74
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema>(a: A, b: B): A & B;
|
|
75
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema>(a: A, b: B, c: C): A & B & C;
|
|
76
|
+
<A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema, D extends import("./types.js").OptionsSchema>(a: A, b: B, c: C, d: D): A & B & C & D;
|
|
77
|
+
(...schemas: import("./types.js").OptionsSchema[]): import("./types.js").OptionsSchema;
|
|
78
|
+
};
|
|
79
|
+
positionals: {
|
|
80
|
+
<A extends import("./types.js").PositionalDef>(a: A): [A];
|
|
81
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef>(a: A, b: B): [A, B];
|
|
82
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef>(a: A, b: B, c: C): [A, B, C];
|
|
83
|
+
<A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef, D extends import("./types.js").PositionalDef>(a: A, b: B, c: C, d: D): [A, B, C, D];
|
|
84
|
+
(...positionals: import("./types.js").PositionalDef[]): import("./types.js").PositionalsSchema;
|
|
85
|
+
};
|
|
86
|
+
string: <P extends Omit<import("./types.js").StringOption, "type"> = Omit<import("./types.js").StringOption, "type">>(props?: P) => P & import("./types.js").StringOption;
|
|
87
|
+
stringPos: (props?: Omit<import("./types.js").StringPositional, "type">) => import("./types.js").StringPositional;
|
|
88
|
+
variadic: (items: "number" | "string", props?: Omit<import("./types.js").VariadicPositional, "items" | "type">) => import("./types.js").VariadicPositional;
|
|
89
|
+
};
|
|
90
|
+
export { BargsError, HelpError, ValidationError } from "./errors.js";
|
|
91
|
+
export { generateCommandHelp, generateHelp } from "./help.js";
|
|
92
|
+
export { link, linkifyUrls, supportsHyperlinks } from "./osc.js";
|
|
93
|
+
export { ansi, createStyler, defaultTheme, stripAnsi, themes, } from "./theme.js";
|
|
94
|
+
export type { StyleFn, Styler, Theme, ThemeColors, ThemeInput, } from "./theme.js";
|
|
95
|
+
export type { AnyCommandConfig, ArrayOption, BargsConfig, BargsConfigWithCommands, BargsOptions, BargsResult, BooleanOption, CommandConfig, CommandConfigInput, CountOption, EnumOption, Handler, HandlerFn, InferOption, InferOptions, InferPositional, InferPositionals, NumberOption, NumberPositional, OptionDef, OptionsSchema, PositionalDef, PositionalsSchema, StringOption, StringPositional, VariadicPositional, } from "./types.js";
|
|
96
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,KAAK,IAAI,SAAS,EAAE,mBAAmB;AAG9E;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;SAgE8rI,GAAG;;;;;;;SAAo1B,GAAG;;;;;CAhEx/J,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;SA0DyrI,GAAG;;;;;;;SAAo1B,GAAG;;;;;CA1D9+J,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB;AAGrE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,kBAAkB;AAG9D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB;AAGjE,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,MAAM,GACP,mBAAmB;AAGpB,YAAY,EACV,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,UAAU,GACX,mBAAmB;AAGpB,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,GACnB,mBAAmB"}
|