cli-kiss 0.2.5 → 0.2.7

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 CHANGED
@@ -1,6 +1,14 @@
1
- # CLI - Keep It Simple, Stupid
1
+ # cli-kiss
2
2
 
3
- Full-featured CLI builder for TypeScript. No bloat, no dependency.
3
+ Type-safe CLI builder for TypeScript. No dependencies, no supply-chain attacks.
4
+
5
+ Small API, standard compliance, polished help output, zero runtime dependencies.
6
+
7
+ ## Why
8
+
9
+ - Compose commands, subcommands, options, and positionals with strong types
10
+ - Get built-in `--help`, `--version`, and color-aware error messages
11
+ - Ship a real CLI parser without pulling in a dependency tree
4
12
 
5
13
  ## Install
6
14
 
@@ -8,6 +16,56 @@ Full-featured CLI builder for TypeScript. No bloat, no dependency.
8
16
  npm install cli-kiss
9
17
  ```
10
18
 
11
- ## Cookbook
19
+ ## Example
20
+
21
+ ```ts
22
+ import {
23
+ command,
24
+ operation,
25
+ optionFlag,
26
+ positionalRequired,
27
+ runAndExit,
28
+ type,
29
+ } from "cli-kiss";
30
+
31
+ const greet = command(
32
+ { description: "Greet someone" },
33
+ operation(
34
+ {
35
+ options: {
36
+ loud: optionFlag({ long: "loud", description: "Print in uppercase" }),
37
+ },
38
+ positionals: [positionalRequired({ type: type("name") })],
39
+ },
40
+ async (_ctx, { options: { loud }, positionals: [name] }) => {
41
+ const text = `Hello, ${name}!`;
42
+ console.log(loud ? text.toUpperCase() : text);
43
+ },
44
+ ),
45
+ );
46
+
47
+ await runAndExit("greet", process.argv.slice(2), {}, greet, {
48
+ buildVersion: "1.0.0",
49
+ });
50
+ ```
51
+
52
+ ```sh
53
+ greet --help
54
+ ```
55
+
56
+ ```text
57
+ Usage: greet <name>
58
+
59
+ Greet someone
60
+
61
+ Positionals:
62
+ <name>
63
+
64
+ Options:
65
+ --loud[=no] Print in uppercase
66
+ ```
67
+
68
+ ## Docs
12
69
 
13
- Documentation and examples: **<https://crypto-vincent.github.io/cli-kiss/>** 💋
70
+ Guides, examples, and API usage:
71
+ [crypto-vincent.github.io/cli-kiss](https://crypto-vincent.github.io/cli-kiss/)
package/dist/index.d.ts CHANGED
@@ -142,6 +142,8 @@ type Type<Value> = {
142
142
  * ```
143
143
  */
144
144
  declare function typeBoolean(name?: string): Type<boolean>;
145
+ declare const typeBooleanValuesTrue: Set<string>;
146
+ declare const typeBooleanValuesFalse: Set<string>;
145
147
  /**
146
148
  * Parses a date/time string via `Date.parse`.
147
149
  * Accepts any format supported by `Date.parse`, including ISO 8601.
@@ -161,7 +163,7 @@ declare function typeDatetime(name?: string): Type<Date>;
161
163
  * ```ts
162
164
  * typeNumber("my-number").decoder("3.14") // → 3.14
163
165
  * typeNumber("my-number").decoder("-1") // → -1
164
- * typeNumber("my-number").decoder("hello") // throws TypoError
166
+ * typeNumber("my-number").decoder("hello") // throws
165
167
  * ```
166
168
  */
167
169
  declare function typeNumber(name?: string): Type<number>;
@@ -172,8 +174,8 @@ declare function typeNumber(name?: string): Type<number>;
172
174
  * @example
173
175
  * ```ts
174
176
  * typeInteger("my-integer").decoder("42") // → 42n
175
- * typeInteger("my-integer").decoder("3.14") // throws TypoError
176
- * typeInteger("my-integer").decoder("abc") // throws TypoError
177
+ * typeInteger("my-integer").decoder("3.14") // throws
178
+ * typeInteger("my-integer").decoder("abc") // throws
177
179
  * ```
178
180
  */
179
181
  declare function typeInteger(name?: string): Type<bigint>;
@@ -184,7 +186,7 @@ declare function typeInteger(name?: string): Type<bigint>;
184
186
  * @example
185
187
  * ```ts
186
188
  * typeUrl("my-url").decoder("https://example.com") // → URL { href: "https://example.com/", ... }
187
- * typeUrl("my-url").decoder("not-a-url") // throws TypoError
189
+ * typeUrl("my-url").decoder("not-a-url") // throws
188
190
  * ```
189
191
  */
190
192
  declare function typeUrl(name?: string): Type<URL>;
@@ -379,7 +381,7 @@ declare class TypoString {
379
381
  #private;
380
382
  /**
381
383
  * @param value - Raw text content.
382
- * @param typoStyle - Style to apply when rendering. Defaults to `{}` (no style).
384
+ * @param typoStyle - Style to apply when rendering. Defaults to `undefined` (no style).
383
385
  */
384
386
  constructor(value: string, typoStyle?: TypoStyle);
385
387
  /**
@@ -393,6 +395,10 @@ declare class TypoString {
393
395
  */
394
396
  getRawString(): string;
395
397
  }
398
+ /**
399
+ * A segment of styled text, a string, or an array of segments.
400
+ */
401
+ type TypoSegment = TypoText | TypoString | string | Array<TypoSegment>;
396
402
  /**
397
403
  * Mutable sequence of {@link TypoString} segments.
398
404
  */
@@ -401,13 +407,13 @@ declare class TypoText {
401
407
  /**
402
408
  * @param segments - Initial text segments
403
409
  */
404
- constructor(...segments: Array<TypoText | Array<TypoString> | TypoString | string>);
410
+ constructor(...segments: TypoSegment[]);
405
411
  /**
406
412
  * Appends new text segment(s).
407
413
  *
408
414
  * @param segment - Text segment(s) to append.
409
415
  */
410
- push(segment: TypoText | Array<TypoString> | TypoString | string): void;
416
+ push(segment: TypoSegment): void;
411
417
  /**
412
418
  * Renders all segments into a single styled string.
413
419
  *
@@ -423,6 +429,11 @@ declare class TypoText {
423
429
  * Returns the total raw character count.
424
430
  */
425
431
  computeRawLength(): number;
432
+ /**
433
+ * Joins multiple segments with a separator.
434
+ * @returns A new {@link TypoText} containing the joined segments.
435
+ */
436
+ static join(segments: Array<TypoSegment>, separator: TypoSegment): TypoText;
426
437
  }
427
438
  /**
428
439
  * Column-aligned grid of {@link TypoText} cells.
@@ -503,7 +514,7 @@ declare class TypoSupport {
503
514
  * @param typoStyle - Style to apply.
504
515
  * @returns Styled string.
505
516
  */
506
- computeStyledString(value: string, typoStyle: TypoStyle): string;
517
+ computeStyledString(value: string, typoStyle: TypoStyle | undefined): string;
507
518
  /**
508
519
  * Formats any thrown value as `"Error: <message>"` with {@link typoStyleFailure} on the prefix.
509
520
  *
@@ -617,16 +628,16 @@ type UsageOption = {
617
628
  * <detail lines...>
618
629
  *
619
630
  * Positionals:
620
- * <LABEL> <description> (<hint>)
631
+ * <label> <description> (<hint>)
621
632
  *
622
633
  * Subcommands:
623
634
  * <name> <description> (<hint>)
624
635
  *
625
636
  * Options:
626
- * -s, --long <LABEL><annotation> <description> (<hint>)
637
+ * -s, --long <label><annotation> <description> (<hint>)
627
638
  *
628
639
  * Examples:
629
- * <description>
640
+ * <explanation>
630
641
  * <command line>
631
642
  *
632
643
  * ```
@@ -737,8 +748,8 @@ declare function optionFlag(definition: {
737
748
  * @param definition.hint - Short note shown in parentheses.
738
749
  * @param definition.aliases - Additional names.
739
750
  * @param definition.type - Decoder for the raw string value.
740
- * @param definition.valueWhenNotDefined - Default value when the option is not specified at all.
741
- * @param definition.valueWhenNotInlined - Default value when the option is specified without an inline value (e.g. `--option` or `-o`).
751
+ * @param definition.defaultIfNotSpecified - Default value when the option is not specified at all.
752
+ * @param definition.valueIfNothingInlined - Default value when the option is specified without an inline value (e.g. `--option` or `-o`).
742
753
  * @returns An {@link Option}`<Value>`.
743
754
  *
744
755
  * @example
@@ -748,7 +759,7 @@ declare function optionFlag(definition: {
748
759
  * short: "o",
749
760
  * type: typePath(),
750
761
  * description: "Output directory",
751
- * valueWhenNotDefined: () => "dist",
762
+ * defaultIfNotSpecified: () => "dist",
752
763
  * });
753
764
  * // Usage:
754
765
  * // my-cli → "dist"
@@ -766,8 +777,8 @@ declare function optionSingleValue<Value>(definition: {
766
777
  shorts?: Array<string>;
767
778
  };
768
779
  type: Type<Value>;
769
- defaultWhenNotDefined: () => Value;
770
- defaultWhenNotInlined?: () => Value;
780
+ defaultIfNotSpecified: () => Value;
781
+ valueIfNothingInlined?: () => Value;
771
782
  }): Option<Value>;
772
783
  /**
773
784
  * Creates an option that collects every occurrence into an array (e.g. `--file a.ts --file b.ts`).
@@ -879,7 +890,8 @@ declare function positionalRequired<Value>(definition: {
879
890
  * ```ts
880
891
  * const greeteePositional = positionalOptional({
881
892
  * type: type("name"),
882
- * description: "Name to greet (default: world)",
893
+ * description: "Name to greet",
894
+ * hint: "Defaults to \"world\"",
883
895
  * default: () => "world",
884
896
  * });
885
897
  * // Usage:
@@ -998,7 +1010,7 @@ type OperationInterpreter<Context, Result> = {
998
1010
  * const greetOperation = operation(
999
1011
  * {
1000
1012
  * options: {
1001
- * loud: optionFlag({ long: "loud", description: "Print in uppercase", default: false }),
1013
+ * loud: optionFlag({ long: "loud", description: "Print in uppercase" }),
1002
1014
  * },
1003
1015
  * positionals: [
1004
1016
  * positionalRequired({ type: type("name"), description: "Name to greet" }),
@@ -1179,6 +1191,10 @@ declare function commandWithSubcommands<Context, Payload, Result>(information: C
1179
1191
  */
1180
1192
  declare function commandChained<Context, Payload, Result>(information: CommandInformation, operation: Operation<Context, Payload>, subcommand: Command<Payload, Result>): Command<Context, Result>;
1181
1193
 
1194
+ /**
1195
+ * Color selection modes availables
1196
+ */
1197
+ type RunColorMode = "env" | "always" | "never" | "mock";
1182
1198
  /**
1183
1199
  * Main entry point: parses CLI arguments, executes the matched command, and exits.
1184
1200
  * Handles `--help`, `--version`, usage-on-error, and exit codes.
@@ -1222,7 +1238,7 @@ declare function commandChained<Context, Payload, Result>(information: CommandIn
1222
1238
  * ```
1223
1239
  */
1224
1240
  declare function runAndExit<Context>(cliName: string, cliArgs: ReadonlyArray<string>, context: Context, command: Command<Context, void>, options?: {
1225
- colorSetup?: "flag" | "env" | "always" | "never" | "mock" | undefined;
1241
+ colorSetup?: "flag" | RunColorMode | undefined;
1226
1242
  usageOnHelp?: boolean | undefined;
1227
1243
  usageOnError?: boolean | undefined;
1228
1244
  buildVersion?: string | undefined;
@@ -1230,4 +1246,11 @@ declare function runAndExit<Context>(cliName: string, cliArgs: ReadonlyArray<str
1230
1246
  onExit?: ((code: number) => never) | undefined;
1231
1247
  }): Promise<never>;
1232
1248
 
1233
- export { type Command, type CommandDecoder, type CommandInformation, type CommandInterpreter, type Operation, type OperationDecoder, type OperationInterpreter, type Option, type OptionDecoder, type Positional, type PositionalDecoder, ReaderArgs, type ReaderOptionKey, type ReaderOptionParsing, type ReaderOptionValue, type ReaderOptions, type ReaderPositionals, type Type, type TypoColor, TypoError, TypoGrid, TypoString, type TypoStyle, TypoSupport, TypoText, type UsageCommand, type UsageOption, type UsagePositional, type UsageSubcommand, command, commandChained, commandWithSubcommands, operation, optionFlag, optionRepeatable, optionSingleValue, positionalOptional, positionalRequired, positionalVariadics, runAndExit, type, typeBoolean, typeChoice, typeConverted, typeDatetime, typeInteger, typeList, typeNumber, typePath, typeRenamed, typeTuple, typeUrl, typoStyleConstants, typoStyleFailure, typoStyleLogic, typoStyleQuote, typoStyleRegularStrong, typoStyleRegularWeaker, typoStyleTitle, typoStyleUserInput, usageToStyledLines };
1249
+ declare function similaritySort<Value>(reference: string, candidates: {
1250
+ [key: string]: Value;
1251
+ } | Array<{
1252
+ key: string;
1253
+ value: Value;
1254
+ }>): Array<Value>;
1255
+
1256
+ export { type Command, type CommandDecoder, type CommandInformation, type CommandInterpreter, type Operation, type OperationDecoder, type OperationInterpreter, type Option, type OptionDecoder, type Positional, type PositionalDecoder, ReaderArgs, type ReaderOptionKey, type ReaderOptionParsing, type ReaderOptionValue, type ReaderOptions, type ReaderPositionals, type RunColorMode, type Type, type TypoColor, TypoError, TypoGrid, type TypoSegment, TypoString, type TypoStyle, TypoSupport, TypoText, type UsageCommand, type UsageOption, type UsagePositional, type UsageSubcommand, command, commandChained, commandWithSubcommands, operation, optionFlag, optionRepeatable, optionSingleValue, positionalOptional, positionalRequired, positionalVariadics, runAndExit, similaritySort, type, typeBoolean, typeBooleanValuesFalse, typeBooleanValuesTrue, typeChoice, typeConverted, typeDatetime, typeInteger, typeList, typeNumber, typePath, typeRenamed, typeTuple, typeUrl, typoStyleConstants, typoStyleFailure, typoStyleLogic, typoStyleQuote, typoStyleRegularStrong, typoStyleRegularWeaker, typoStyleTitle, typoStyleUserInput, usageToStyledLines };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var _=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Ve=Object.prototype.hasOwnProperty;var he=n=>{throw TypeError(n)};var Ue=(n,e)=>{for(var t in e)_(n,t,{get:e[t],enumerable:!0})},De=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Oe(e))!Ve.call(n,o)&&o!==t&&_(n,o,{get:()=>e[o],enumerable:!(r=ke(e,o))||r.enumerable});return n};var $e=n=>De(_({},"__esModule",{value:!0}),n);var ee=(n,e,t)=>e.has(n)||he("Cannot "+t);var c=(n,e,t)=>(ee(n,e,"read from private field"),t?t.call(n):e.get(n)),b=(n,e,t)=>e.has(n)?he("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),w=(n,e,t,r)=>(ee(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),x=(n,e,t)=>(ee(n,e,"access private method"),t);var me=(n,e,t,r)=>({set _(o){w(n,e,o,t)},get _(){return c(n,e,r)}});var dt={};Ue(dt,{ReaderArgs:()=>Q,TypoError:()=>g,TypoGrid:()=>E,TypoString:()=>i,TypoSupport:()=>O,TypoText:()=>d,command:()=>Ne,commandChained:()=>Ke,commandWithSubcommands:()=>Be,operation:()=>Fe,optionFlag:()=>J,optionRepeatable:()=>nt,optionSingleValue:()=>ae,positionalOptional:()=>rt,positionalRequired:()=>ot,positionalVariadics:()=>st,runAndExit:()=>lt,type:()=>Je,typeBoolean:()=>se,typeChoice:()=>ie,typeConverted:()=>Xe,typeDatetime:()=>qe,typeInteger:()=>He,typeList:()=>tt,typeNumber:()=>Qe,typePath:()=>_e,typeRenamed:()=>Ze,typeTuple:()=>et,typeUrl:()=>ze,typoStyleConstants:()=>R,typoStyleFailure:()=>ye,typoStyleLogic:()=>V,typoStyleQuote:()=>f,typoStyleRegularStrong:()=>ne,typoStyleRegularWeaker:()=>oe,typoStyleTitle:()=>te,typoStyleUserInput:()=>T,usageToStyledLines:()=>ge});module.exports=$e(dt);var te={fgColor:"darkGreen",bold:!0},V={fgColor:"darkMagenta",bold:!0},f={fgColor:"darkYellow",bold:!0},ye={fgColor:"darkRed",bold:!0},R={fgColor:"darkCyan",bold:!0},T={fgColor:"darkBlue",bold:!0},ne={bold:!0},oe={italic:!0,dim:!0},L,q,i=class{constructor(e,t={}){b(this,L);b(this,q);w(this,L,e),w(this,q,t)}computeStyledString(e){return e.computeStyledString(c(this,L),c(this,q))}getRawString(){return c(this,L)}};L=new WeakMap,q=new WeakMap;var A,re=class re{constructor(...e){b(this,A);w(this,A,[]);for(let t of e)this.push(t)}push(e){if(typeof e=="string")c(this,A).push(new i(e));else if(e instanceof re)c(this,A).push(...c(e,A));else if(Array.isArray(e))for(let t of e)c(this,A).push(t);else c(this,A).push(e)}computeStyledString(e){return c(this,A).map(t=>t.computeStyledString(e)).join("")}computeRawString(){return c(this,A).map(e=>e.getRawString()).join("")}computeRawLength(){let e=0;for(let t of c(this,A))e+=t.getRawString().length;return e}};A=new WeakMap;var d=re,M,E=class{constructor(){b(this,M);w(this,M,[])}pushRow(e){c(this,M).push(e)}computeStyledLines(e){let t=new Array,r=new Array;for(let o of c(this,M))for(let s=0;s<o.length;s++){let a=o[s].computeRawLength();(t[s]===void 0||a>t[s])&&(t[s]=a)}for(let o of c(this,M)){let s=new Array;for(let u=0;u<o.length;u++){let a=o[u];if(s.push(a.computeStyledString(e)),u<o.length-1){let p=a.computeRawLength(),l=" ".repeat(t[u]-p);s.push(l)}}r.push(s.join(""))}return r}};M=new WeakMap;var G,H=class H extends Error{constructor(t,r){let o=new d;o.push(t),r instanceof H?(o.push(new i(": ")),o.push(c(r,G))):r instanceof Error?o.push(new i(`: ${r.message}`)):r!==void 0&&o.push(new i(`: ${String(r)}`));super(o.computeRawString());b(this,G);w(this,G,o)}computeStyledString(t){return c(this,G).computeStyledString(t)}static tryWithContext(t,r){try{return t()}catch(o){throw new H(r(),o)}}};G=new WeakMap;var g=H,I,k=class k{constructor(e){b(this,I);w(this,I,e)}static none(){return new k("none")}static tty(){return new k("tty")}static mock(){return new k("mock")}static inferFromEnv(){if(!process||!process.env)return k.none();function e(r){if(r in process.env)return process.env[r]}let t=e("FORCE_COLOR");return t==="0"||(t!==void 0&&k.tty(),e("NO_COLOR")!==void 0)?k.none():e("MOCK_COLOR")!==void 0?k.mock():k.tty()}computeStyledString(e,t){let r=e;if(t.case==="upper"&&(r=r.toUpperCase()),t.case==="lower"&&(r=r.toLowerCase()),c(this,I)==="none")return r;if(c(this,I)==="tty"){let o=t.fgColor?Le[t.fgColor]:"",s=t.bgColor?Ge[t.bgColor]:"",u=t.bold?Pe:"",a=t.dim?Me:"",p=t.italic?Ee:"",l=t.underline?ve:"",h=t.strikethrough?We:"";return`${o}${s}${u}${a}${p}${l}${h}${r}${Ie}`}if(c(this,I)==="mock"){let o=t.fgColor?`{${r}}@${t.fgColor}`:r,s=t.bgColor?`{${o}}#${t.bgColor}`:o,u=t.bold?`{${s}}+`:s,a=t.dim?`{${u}}-`:u,p=t.italic?`{${a}}*`:a,l=t.underline?`{${p}}_`:p;return t.strikethrough?`{${l}}~`:l}throw new Error(`Unknown TypoSupport kind: ${c(this,I)}`)}computeStyledErrorMessage(e){return[this.computeStyledString("Error:",ye),e instanceof g?e.computeStyledString(this):e instanceof Error?e.message:String(e)].join(" ")}};I=new WeakMap;var O=k,Ie="\x1B[0m",Pe="\x1B[1m",Me="\x1B[2m",Ee="\x1B[3m",ve="\x1B[4m",We="\x1B[9m",Le={darkBlack:"\x1B[30m",darkRed:"\x1B[31m",darkGreen:"\x1B[32m",darkYellow:"\x1B[33m",darkBlue:"\x1B[34m",darkMagenta:"\x1B[35m",darkCyan:"\x1B[36m",darkWhite:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},Ge={darkBlack:"\x1B[40m",darkRed:"\x1B[41m",darkGreen:"\x1B[42m",darkYellow:"\x1B[43m",darkBlue:"\x1B[44m",darkMagenta:"\x1B[45m",darkCyan:"\x1B[46m",darkWhite:"\x1B[47m",brightBlack:"\x1B[100m",brightRed:"\x1B[101m",brightGreen:"\x1B[102m",brightYellow:"\x1B[103m",brightBlue:"\x1B[104m",brightMagenta:"\x1B[105m",brightCyan:"\x1B[106m",brightWhite:"\x1B[107m"};function Ne(n,e){return{getInformation(){return n},consumeAndMakeDecoder(t){try{let r=e.consumeAndMakeDecoder(t),o=t.consumePositional();if(o!==void 0)throw new g(new d(new i("Unexpected argument: "),new i(`"${o}"`,f)));return{generateUsage:()=>N(n,e),decodeAndMakeInterpreter(){let s=r.decodeAndMakeInterpreter();return{async executeWithContext(u){return await s.executeWithContext(u)}}}}}catch(r){return{generateUsage:()=>N(n,e),decodeAndMakeInterpreter(){throw r}}}}}}function Be(n,e,t){return{getInformation(){return n},consumeAndMakeDecoder(r){try{let o=e.consumeAndMakeDecoder(r),s=r.consumePositional();if(s===void 0)throw new g(new d(new i("<subcommand>",T),new i(": Is required, but was not provided")));let u=t[s];if(u===void 0)throw new g(new d(new i("<subcommand>",T),new i(": Invalid value: "),new i(`"${s}"`,f)));let a=u.consumeAndMakeDecoder(r);return{generateUsage(){let p=a.generateUsage(),l=N(n,e);return l.segments.push({subcommand:s}),l.segments.push(...p.segments),l.information=p.information,l.positionals.push(...p.positionals),l.subcommands=p.subcommands,l.options.push(...p.options),l},decodeAndMakeInterpreter(){let p=o.decodeAndMakeInterpreter(),l=a.decodeAndMakeInterpreter();return{async executeWithContext(h){return await l.executeWithContext(await p.executeWithContext(h))}}}}}catch(o){return{generateUsage(){let s=N(n,e);s.segments.push({positional:"<subcommand>"});for(let[u,a]of Object.entries(t)){let{description:p,hint:l}=a.getInformation();s.subcommands.push({name:u,description:p,hint:l})}return s},decodeAndMakeInterpreter(){throw o}}}}}}function Ke(n,e,t){return{getInformation(){return n},consumeAndMakeDecoder(r){try{let o=e.consumeAndMakeDecoder(r),s=t.consumeAndMakeDecoder(r);return{generateUsage(){let u=s.generateUsage(),a=N(n,e);return a.segments.push(...u.segments),a.information=u.information,a.positionals.push(...u.positionals),a.subcommands=u.subcommands,a.options.push(...u.options),a},decodeAndMakeInterpreter(){let u=o.decodeAndMakeInterpreter(),a=s.decodeAndMakeInterpreter();return{async executeWithContext(p){return await a.executeWithContext(await u.executeWithContext(p))}}}}}catch(o){return{generateUsage(){let s=N(n,e);return s.segments.push({positional:"[REST]..."}),s},decodeAndMakeInterpreter(){throw o}}}}}}function N(n,e){let{positionals:t,options:r}=e.generateUsage();return{segments:t.map(o=>({positional:o.label})),information:n,positionals:t,subcommands:[],options:r}}function Fe(n,e){return{generateUsage(){let t=new Array;for(let o in n.options){let s=n.options[o];t.push(s.generateUsage())}let r=new Array;for(let o of n.positionals)r.push(o.generateUsage());return{options:t,positionals:r}},consumeAndMakeDecoder(t){let r={};for(let s in n.options){let u=n.options[s];r[s]=u.registerAndMakeDecoder(t)}let o=[];for(let s of n.positionals)o.push(s.consumeAndMakeDecoder(t));return{decodeAndMakeInterpreter(){let s={};for(let a in r)s[a]=r[a].getAndDecodeValue();let u=[];for(let a of o)u.push(a.decodeValue());return{executeWithContext(a){return e(a,{options:s,positionals:u})}}}}}}}var fe=require("fs");function se(n){return{content:n??"boolean",decoder(e){let t=e.toLowerCase();if(je.has(t))return!0;if(Ye.has(t))return!1;throw new g(new d(new i("Not a boolean: "),new i(`"${e}"`,f)))}}}var je=new Set(["true","yes","on","1","y","t"]),Ye=new Set(["false","no","off","0","n","f"]);function qe(n){return{content:n??"datetime",decoder(e){try{let t=Date.parse(e);if(isNaN(t))throw new Error;return new Date(t)}catch{throw new g(new d(new i("Not a valid ISO_8601 datetime: "),new i(`"${e}"`,f)))}}}}function Qe(n){return{content:n??"number",decoder(e){try{let t=Number(e);if(isNaN(t))throw new Error;return t}catch{throw new g(new d(new i("Not a number: "),new i(`"${e}"`,f)))}}}}function He(n){return{content:n??"integer",decoder(e){try{return BigInt(e)}catch{throw new g(new d(new i("Not an integer: "),new i(`"${e}"`,f)))}}}}function ze(n){return{content:n??"url",decoder(e){try{return new URL(e)}catch{throw new g(new d(new i("Not an URL: "),new i(`"${e}"`,f)))}}}}function Je(n){return{content:n??"string",decoder:e=>e}}function Xe(n,e,t){return{content:n,decoder:r=>t(g.tryWithContext(()=>e.decoder(r),()=>new d(new i("from: "),new i(e.content,V))))}}function Ze(n,e){return{content:e,decoder:t=>g.tryWithContext(()=>n.decoder(t),()=>new d(new i("from: "),new i(n.content,V)))}}function _e(n,e){return{content:n??"path",decoder(t){if(t.length===0)throw new Error("Path cannot be empty");if(t.includes("\0"))throw new Error("Path cannot contain null characters");if(e?.checkSyncExistAs!==void 0){let r=(0,fe.statSync)(t),o=r.isDirectory()?"directory":r.isFile()?"file":"unknown";if(e.checkSyncExistAs==="file"&&!r.isFile())throw new g(new d(new i(`Expected a 'file' but found '${o}': `),new i(`"${t}"`,f)));if(e.checkSyncExistAs==="directory"&&!r.isDirectory())throw new g(new d(new i(`Expected a 'directory' but found '${o}': `),new i(`"${t}"`,f)))}return t}}}function ie(n,e,t=!1){let r=t?s=>s:s=>s.toLowerCase(),o=new Map(e.map(s=>[r(s),s]));return{content:n,decoder(s){let u=r(s),a=o.get(u);if(a!==void 0)return a;let p=[];for(let l of e){if(p.length>=5){p.push(new i("..."));break}p.length>0&&p.push(new i(" | ")),p.push(new i(`"${l}"`,f))}throw new g(new d(new i("Invalid value: "),new i(`"${s}"`,f),new i(" (expected one of: "),...p,new i(")")))}}}function et(n,e=","){return{content:n.map(t=>t.content).join(e),decoder(t){let r=t.split(e,n.length);if(r.length!==n.length)throw new g(new d(new i(`Found ${r.length} splits: `),new i(`Expected ${n.length} splits from: `),new i(`"${t}"`,f)));return r.map((o,s)=>{let u=n[s];return g.tryWithContext(()=>u.decoder(o),()=>new d(new i(`at ${s}: `),new i(u.content,V)))})}}}function tt(n,e=","){return{content:`${n.content}[${e}${n.content}]...`,decoder(t){return t.split(e).map((o,s)=>g.tryWithContext(()=>n.decoder(o),()=>new d(new i(`at ${s}: `),new i(n.content,V))))}}}function J(n){let e=se("value"),{long:t,short:r,description:o,hint:s,aliases:u}=n;return{generateUsage(){return{short:r,long:t,annotation:"[=no]",description:o,hint:s}},registerAndMakeDecoder(a){let p=ue(a,{long:t,short:r,aliasesLongs:u?.longs,aliasesShorts:u?.shorts,parsing:{consumeShortGroup:!1,consumeNextArg:()=>!1}});return{getAndDecodeValue(){let l=a.getOptionValues(p);if(l.length>1&&xe(t),l.length===0)return n.default===void 0?!1:n.default;let h=l[0],m=h.inlined===null?"true":h.inlined;return z({long:t,short:r,type:e,input:m})}}}}}function ae(n){let{long:e,short:t,description:r,hint:o,aliases:s,type:u}=n,a=`<${u.content}>`;return{generateUsage(){return{short:t,long:e,label:a,description:r,hint:o}},registerAndMakeDecoder(p){let l=ue(p,{long:e,short:t,aliasesLongs:s?.longs,aliasesShorts:s?.shorts,parsing:{consumeShortGroup:!0,consumeNextArg(h,m){return n.defaultWhenNotInlined!==void 0?!1:h===null&&m.length===0}}});return{getAndDecodeValue(){let h=p.getOptionValues(l);h.length>1&&xe(e);let m=h[0];if(m===void 0)try{return n.defaultWhenNotDefined()}catch($){we(e,$,"not set")}if(m.inlined){let $=m.inlined;return z({long:e,short:t,label:a,type:u,input:$})}if(n.defaultWhenNotInlined!==void 0)try{return n.defaultWhenNotInlined()}catch($){we(e,$,"not inlined")}let S=m.separated[0];return z({long:e,short:t,label:a,type:u,input:S})}}}}}function nt(n){let{long:e,short:t,description:r,hint:o,aliases:s,type:u}=n,a=`<${u.content}>`;return{generateUsage(){return{short:t,long:e,label:a,annotation:" [*]",description:r,hint:o}},registerAndMakeDecoder(p){let l=ue(p,{long:e,short:t,aliasesLongs:s?.longs,aliasesShorts:s?.shorts,parsing:{consumeShortGroup:!0,consumeNextArg:(h,m)=>h===null&&m.length===0}});return{getAndDecodeValue(){return p.getOptionValues(l).map(m=>{let S=m.inlined??m.separated[0];return z({long:e,short:t,label:a,type:u,input:S})})}}}}}function z(n){return g.tryWithContext(()=>n.type.decoder(n.input),()=>{let e=new d;return n.short&&(e.push(new i(`-${n.short}`,R)),e.push(new i(", "))),e.push(new i(`--${n.long}`,R)),n.label?(e.push(new i(": ")),e.push(new i(n.label,T))):(e.push(new i(": ")),e.push(new i(n.type.content,V))),e})}function ue(n,e){let{long:t,short:r,aliasesLongs:o,aliasesShorts:s,parsing:u}=e,a=t?[t]:[];o&&a.push(...o);let p=r?[r]:[];return s&&p.push(...s),n.registerOption({longs:a,shorts:p,parsing:u})}function xe(n){throw new g(new d(new i(`--${n}`,R),new i(": Must not be set multiple times")))}function we(n,e,t){throw new g(new d(new i(`--${n}`,R),new i(`: Failed to get default value (${t})`)),e)}function ot(n){let{description:e,hint:t,type:r}=n,o=`<${r.content}>`;return{generateUsage(){return{description:e,hint:t,label:o}},consumeAndMakeDecoder(s){let u=s.consumePositional();if(u===void 0)throw new g(new d(new i(o,T),new i(": Is required, but was not provided")));return{decodeValue(){return pe(o,n.type,u)}}}}}function rt(n){let{description:e,hint:t,type:r}=n,o=`[${r.content}]`;return{generateUsage(){return{description:e,hint:t,label:o}},consumeAndMakeDecoder(s){let u=s.consumePositional();return{decodeValue(){if(u===void 0)try{return n.default()}catch{it(o)}return pe(o,n.type,u)}}}}}function st(n){let{description:e,hint:t,type:r}=n,o=`[${r.content}]`,s=`${o}...`+(n.endDelimiter?` ["${n.endDelimiter}"]`:"");return{generateUsage(){return{description:e,hint:t,label:s}},consumeAndMakeDecoder(u){let a=new Array;for(;;){let p=u.consumePositional();if(p===void 0||p===n.endDelimiter)break;a.push(p)}return{decodeValue(){return a.map(p=>pe(o,n.type,p))}}}}}function pe(n,e,t){return g.tryWithContext(()=>e.decoder(t),()=>new d(new i(n,T)))}function it(n){throw new g(new d(new i(n,T),new i(": Failed to get default value")))}var K,v,P,W,U,F,y,X,be,le,Ce,B,Se,de,Q=class{constructor(e){b(this,y);b(this,K);b(this,v);b(this,P);b(this,W);b(this,U);b(this,F);w(this,K,e),w(this,v,0),w(this,P,!1),w(this,W,new Map),w(this,U,new Map),w(this,F,new Map)}registerOption(e){let t=[...e.longs.map(o=>`--${o}`),...e.shorts.map(o=>`-${o}`)].join(", ");for(let o of e.longs){if(!x(this,y,de).call(this,o))throw new Error(`Invalid option name: --${o}`);if(c(this,W).has(o))throw new Error(`Option already registered: --${o}`)}for(let o of e.shorts){if(!x(this,y,de).call(this,o))throw new Error(`Invalid option name: -${o}`);if(c(this,U).has(o))throw new Error(`Option already registered: -${o}`);for(let s=0;s<o.length;s++){let u=o.slice(0,s);if(c(this,U).has(u))throw new Error(`Option -${o} overlap with shorter option: -${u}`)}for(let s of c(this,U).keys())if(s.startsWith(o))throw new Error(`Option -${o} overlap with longer option: -${s}`)}let r={parsing:e.parsing,results:new Array};for(let o of e.longs)c(this,W).set(o,r);for(let o of e.shorts)c(this,U).set(o,r);return c(this,F).set(t,r),t}getOptionValues(e){let t=c(this,F).get(e);if(t===void 0)throw new Error(`Unregistered option: ${e}`);return t.results}consumePositional(){for(;;){let e=x(this,y,X).call(this);if(e===void 0)return;if(!x(this,y,be).call(this,e))return e}}};K=new WeakMap,v=new WeakMap,P=new WeakMap,W=new WeakMap,U=new WeakMap,F=new WeakMap,y=new WeakSet,X=function(){let e=c(this,K)[c(this,v)];if(e!==void 0)return me(this,v)._++,!c(this,P)&&e==="--"?(w(this,P,!0),x(this,y,X).call(this)):e},be=function(e){if(c(this,P))return!1;if(e.startsWith("--")){let t=e.indexOf("=");return t===-1?x(this,y,le).call(this,e.slice(2),null):x(this,y,le).call(this,e.slice(2,t),e.slice(t+1)),!0}if(e.startsWith("-")){let t=1,r=2;for(;r<=e.length;){let o=e.slice(t,r),s=c(this,U).get(o);if(s!==void 0){let u=e.slice(r);if(x(this,y,Ce).call(this,s,o,u))return!0;t=r}r++}throw new g(new d(new i("Unexpected unknown option(s): "),new i(`-${e.slice(t)}`,f)))}return!1},le=function(e,t){let r=`--${e}`,o=c(this,W).get(e);if(o!==void 0)return x(this,y,B).call(this,o,r,t);throw new g(new d(new i("Unexpected unknown option: "),new i(r,f)))},Ce=function(e,t,r){let o=`-${t}`;return r.startsWith("=")?(x(this,y,B).call(this,e,o,r.slice(1)),!0):r.length===0?(x(this,y,B).call(this,e,o,null),!0):e.parsing.consumeShortGroup?(x(this,y,B).call(this,e,o,r),!0):(x(this,y,B).call(this,e,o,null),!1)},B=function(e,t,r){let o=new Array;for(;e.parsing.consumeNextArg(r,o,c(this,K)[c(this,v)]);)o.push(x(this,y,Se).call(this,t));e.results.push({inlined:r,separated:o})},Se=function(e){let t=x(this,y,X).call(this);if(t===void 0)throw new g(new d(new i(e,R),new i(": Requires a value, but got end of input")));if(c(this,P))throw new g(new d(new i(e,R),new i(": Requires a value before "),new i('"--"',f)));if(t.startsWith("-"))throw new g(new d(new i(e,R),new i(": Requires a value, but got: "),new i(`"${t}"`,f)));return t},de=function(e){return e.length>0&&!e.includes("=")&&!e.includes("\0")};function ge(n){let{cliName:e,usage:t,typoSupport:r}=n,o=new Array,s=new d;s.push(at("Usage:")),s.push(C(" ")),s.push(D(e));for(let a of t.segments)s.push(C(" ")),"positional"in a&&s.push(j(a.positional)),"subcommand"in a&&s.push(D(a.subcommand));o.push(s.computeStyledString(r)),o.push("");let u=new d;u.push(ut(t.information.description)),t.information.hint&&(u.push(C(" ")),u.push(Y(`(${t.information.hint})`))),o.push(u.computeStyledString(r));for(let a of t.information.details??[]){let p=new d;p.push(Y(a)),o.push(p.computeStyledString(r))}if(t.positionals.length>0){o.push(""),o.push(Z("Positionals:").computeStyledString(r));let a=new E;for(let p of t.positionals){let l=new Array;l.push(new d(C(" "))),l.push(new d(j(p.label))),l.push(...ce(p)),a.pushRow(l)}o.push(...a.computeStyledLines(r))}if(t.subcommands.length>0){o.push(""),o.push(Z("Subcommands:").computeStyledString(r));let a=new E;for(let p of t.subcommands){let l=new Array;l.push(new d(C(" "))),l.push(new d(D(p.name))),l.push(...ce(p)),a.pushRow(l)}o.push(...a.computeStyledLines(r))}if(t.options.length>0){o.push(""),o.push(Z("Options:").computeStyledString(r));let a=new E;for(let p of t.options){let l=new Array;l.push(new d(C(" "))),p.short?l.push(new d(D(`-${p.short}`),C(", "))):l.push(new d);let h=new d(D(`--${p.long}`));p.label&&(h.push(C(" ")),h.push(j(p.label))),p.annotation&&h.push(Y(p.annotation)),l.push(h),l.push(...ce(p)),a.pushRow(l)}o.push(...a.computeStyledLines(r))}if(t.information.examples){o.push(""),o.push(Z("Examples:").computeStyledString(r));for(let a of t.information.examples){let p=new d;p.push(C(" ")),p.push(Y(`# ${a.explanation}`)),o.push(p.computeStyledString(r));let l=new d;l.push(C(" ")),l.push(D(e));for(let h of a.commandArgs)if(l.push(C(" ")),typeof h=="string")l.push(h);else if("positional"in h)l.push(j(h.positional));else if("subcommand"in h)l.push(D(h.subcommand));else if("option"in h){let m=h.option;if("short"in m?l.push(D(`-${m.short}`)):l.push(D(`--${m.long}`)),m.inlined!==void 0&&(l.push(Y("=")),l.push(j(m.inlined))),m.separated!==void 0)for(let S of m.separated)l.push(C(" ")),l.push(j(S))}o.push(l.computeStyledString(r))}}return o.push(""),o}function ce(n){let e=[];return n.description&&(e.push(C(" ")),e.push(pt(n.description))),n.hint&&(e.push(C(" ")),e.push(Y(`(${n.hint})`))),e.length>0?[new d(C(" "),...e)]:[]}function at(n){return new i(n,V)}function ut(n){return new i(n,ne)}function pt(n){return new i(n)}function Z(n){return new i(n,te)}function Y(n){return new i(n,oe)}function D(n){return new i(n,R)}function j(n){return new i(n,T)}function C(n){return new i(n)}async function lt(n,e,t,r,o){let s=new Q(e),u=new Array,a=O.none(),p=o?.colorSetup??"flag";if(p==="flag"){let m=ae({long:"color",type:ie("color-mode",["auto","always","never","mock"]),defaultWhenNotDefined:()=>"auto",defaultWhenNotInlined:()=>"always"}).registerAndMakeDecoder(s);u.push(()=>{try{a=Te(m.getAndDecodeValue())}catch(S){throw a=O.inferFromEnv(),S}})}else p==="env"?a=O.inferFromEnv():a=Te(p);if(o?.usageOnHelp??!0){let m=J({long:"help"}).registerAndMakeDecoder(s);u.push(S=>{if(m.getAndDecodeValue())return console.log(Re(n,S,a)),0})}if(o?.buildVersion){let m=J({long:"version"}).registerAndMakeDecoder(s);u.push(()=>{if(m.getAndDecodeValue())return console.log([n,o.buildVersion].join(" ")),0})}let l=r.consumeAndMakeDecoder(s);for(;;)try{if(s.consumePositional()===void 0)break}catch{}let h=o?.onExit??process.exit;try{for(let S of u){let $=S(l);if($!==void 0)return h($)}let m=l.decodeAndMakeInterpreter();try{return await m.executeWithContext(t),h(0)}catch(S){return Ae(o?.onError,S,a),h(1)}}catch(m){return(o?.usageOnError??!0)&&console.error(Re(n,l,a)),Ae(o?.onError,m,a),h(1)}}function Ae(n,e,t){n!==void 0?n(e):console.error(t.computeStyledErrorMessage(e))}function Re(n,e,t){return ge({cliName:n,usage:e.generateUsage(),typoSupport:t}).join(`
2
- `)}function Te(n){switch(n){case"auto":return O.inferFromEnv();case"always":return O.tty();case"never":return O.none();case"mock":return O.mock()}}0&&(module.exports={ReaderArgs,TypoError,TypoGrid,TypoString,TypoSupport,TypoText,command,commandChained,commandWithSubcommands,operation,optionFlag,optionRepeatable,optionSingleValue,positionalOptional,positionalRequired,positionalVariadics,runAndExit,type,typeBoolean,typeChoice,typeConverted,typeDatetime,typeInteger,typeList,typeNumber,typePath,typeRenamed,typeTuple,typeUrl,typoStyleConstants,typoStyleFailure,typoStyleLogic,typoStyleQuote,typoStyleRegularStrong,typoStyleRegularWeaker,typoStyleTitle,typoStyleUserInput,usageToStyledLines});
1
+ "use strict";var re=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var xe=o=>{throw TypeError(o)};var Ee=(o,e)=>{for(var t in e)re(o,t,{get:e[t],enumerable:!0})},Le=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Pe(e))!ve.call(o,n)&&n!==t&&re(o,n,{get:()=>e[n],enumerable:!(s=Me(e,n))||s.enumerable});return o};var We=o=>Le(re({},"__esModule",{value:!0}),o);var se=(o,e,t)=>e.has(o)||xe("Cannot "+t);var g=(o,e,t)=>(se(o,e,"read from private field"),t?t.call(o):e.get(o)),b=(o,e,t)=>e.has(o)?xe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),w=(o,e,t,s)=>(se(o,e,"write to private field"),s?s.call(o,t):e.set(o,t),t),f=(o,e,t)=>(se(o,e,"access private method"),t);var be=(o,e,t,s)=>({set _(n){w(o,e,n,t)},get _(){return g(o,e,s)}});var ft={};Ee(ft,{ReaderArgs:()=>H,TypoError:()=>m,TypoGrid:()=>L,TypoString:()=>a,TypoSupport:()=>O,TypoText:()=>d,command:()=>rt,commandChained:()=>it,commandWithSubcommands:()=>st,operation:()=>at,optionFlag:()=>te,optionRepeatable:()=>ut,optionSingleValue:()=>de,positionalOptional:()=>lt,positionalRequired:()=>pt,positionalVariadics:()=>dt,runAndExit:()=>yt,similaritySort:()=>v,type:()=>je,typeBoolean:()=>ie,typeBooleanValuesFalse:()=>J,typeBooleanValuesTrue:()=>Se,typeChoice:()=>ae,typeConverted:()=>qe,typeDatetime:()=>Ge,typeInteger:()=>Ke,typeList:()=>He,typeNumber:()=>Ne,typePath:()=>Qe,typeRenamed:()=>Ye,typeTuple:()=>ze,typeUrl:()=>Fe,typoStyleConstants:()=>S,typoStyleFailure:()=>Ae,typoStyleLogic:()=>V,typoStyleQuote:()=>x,typoStyleRegularStrong:()=>pe,typoStyleRegularWeaker:()=>le,typoStyleTitle:()=>ue,typoStyleUserInput:()=>T,usageToStyledLines:()=>we});module.exports=We(ft);function v(o,e){return(Array.isArray(e)?e.map(({key:n,value:r})=>[n,r]):Object.entries(e)).map(([n,r])=>{let i=Be(o,n)/Math.max(o.length,n.length);return{key:n,value:r,score:i}}).sort((n,r)=>n.score-r.score).map(n=>n.value)}function Be(o,e){let t=o.length,s=e.length,n=Array.from({length:t+1},()=>Array(s+1).fill(0));for(let r=0;r<=t;r++)n[r][0]=r;for(let r=0;r<=s;r++)n[0][r]=r;for(let r=1;r<=t;r++)for(let i=1;i<=s;i++){let u=o[r-1]===e[i-1]?0:1;n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+u),r>1&&i>1&&o[r-1]===e[i-2]&&o[r-2]===e[i-1]&&(n[r][i]=Math.min(n[r][i],n[r-2][i-2]+u))}return n[t][s]}var Ce=require("fs");function ie(o){return{content:o??"boolean",decoder(e){let t=e.toLowerCase();if(Se.has(t))return!0;if(J.has(t))return!1;Q("a boolean",e)}}}var Se=new Set(["true","yes","on","y"]),J=new Set(["false","no","off","n"]);function Ge(o){return{content:o??"datetime",decoder(e){try{let t=Date.parse(e);if(isNaN(t))throw new Error;return new Date(t)}catch{Q("a valid ISO_8601 datetime",e)}}}}function Ne(o){return{content:o??"number",decoder(e){try{let t=Number(e);if(isNaN(t))throw new Error;return t}catch{Q("a number",e)}}}}function Ke(o){return{content:o??"integer",decoder(e){try{return BigInt(e)}catch{Q("an integer",e)}}}}function Fe(o){return{content:o??"url",decoder(e){try{return new URL(e)}catch{Q("an URL",e)}}}}function je(o){return{content:o??"string",decoder:e=>e}}function qe(o,e,t){return{content:o,decoder:s=>t(m.tryWithContext(()=>e.decoder(s),()=>new d(new a("from: "),new a(e.content,V))))}}function Ye(o,e){return{content:e,decoder:t=>m.tryWithContext(()=>o.decoder(t),()=>new d(new a("from: "),new a(o.content,V)))}}function Qe(o,e){return{content:o??"path",decoder(t){if(t.length===0)throw new Error("Path cannot be empty");if(t.includes("\0"))throw new Error("Path cannot contain null characters");if(e?.checkSyncExistAs!==void 0){let n=function(u){try{return(0,Ce.statSync)(u)}catch(l){throw new m(new d(new a("Path does not exist: "),new a(`"${u}"`,x)),l)}};var s=n;let r=n(t),i=r.isDirectory()?"directory":r.isFile()?"file":"unknown";if(e.checkSyncExistAs==="file"&&!r.isFile())throw new m(new d(new a(`Expected a file but found: ${i}: `),new a(`"${t}"`,x)));if(e.checkSyncExistAs==="directory"&&!r.isDirectory())throw new m(new d(new a(`Expected a directory but found: ${i}: `),new a(`"${t}"`,x)))}return t}}}function ae(o,e,t=!1){if(e.length===0)throw new Error("At least one value is required");let s=t?r=>r:r=>r.toLowerCase(),n=new Map(e.map(r=>[s(r),r]));return{content:o,decoder(r){let i=s(r),u=n.get(i);if(u!==void 0)return u;let l=new d;l.push(new a("Unknown value: ")),l.push(new a(`"${r}"`,x));let p=v(i,[...n.entries()].map(([c,h])=>({key:c,value:new a(`"${h}"`,x)}))).slice(0,3);throw l.push(new a(": did you mean: ")),l.push(d.join(p,new a(", "))),l.push(new a(" ?")),new m(l)}}}function ze(o,e=","){return{content:o.map(t=>t.content).join(e),decoder(t){let s=t.split(e,o.length);if(s.length!==o.length)throw new m(new d(new a(`Found ${s.length} splits: `),new a(`Expected ${o.length} splits from: `),new a(`"${t}"`,x)));return s.map((n,r)=>{let i=o[r];return m.tryWithContext(()=>i.decoder(n),()=>new d(new a(`at ${r}: `),new a(i.content,V)))})}}}function He(o,e=","){return{content:`${o.content}[${e}${o.content}]...`,decoder(t){return t.split(e).map((n,r)=>m.tryWithContext(()=>o.decoder(n),()=>new d(new a(`at ${r}: `),new a(o.content,V))))}}}function Q(o,e){throw new m(new d(new a(`Not ${o}: `),new a(`"${e}"`,x)))}var ue={fgColor:"darkGreen",bold:!0},V={fgColor:"darkMagenta",bold:!0},x={fgColor:"darkYellow",bold:!0},Ae={fgColor:"darkRed",bold:!0},S={fgColor:"darkCyan",bold:!0},T={fgColor:"darkBlue",bold:!0},pe={bold:!0},le={italic:!0,dim:!0},B,z,a=class{constructor(e,t){b(this,B);b(this,z);w(this,B,e),w(this,z,t)}computeStyledString(e){return e.computeStyledString(g(this,B),g(this,z))}getRawString(){return g(this,B)}};B=new WeakMap,z=new WeakMap;var k,Z=class Z{constructor(...e){b(this,k);w(this,k,[]);for(let t of e)this.push(t)}push(e){if(typeof e=="string")g(this,k).push(new a(e));else if(e instanceof Z)g(this,k).push(...g(e,k));else if(Array.isArray(e))for(let t of e)this.push(t);else g(this,k).push(e)}computeStyledString(e){return g(this,k).map(t=>t.computeStyledString(e)).join("")}computeRawString(){return g(this,k).map(e=>e.getRawString()).join("")}computeRawLength(){let e=0;for(let t of g(this,k))e+=t.getRawString().length;return e}static join(e,t){let s=new Z;for(let n=0;n<e.length;n++)n>0&&s.push(t),s.push(e[n]);return s}};k=new WeakMap;var d=Z,E,L=class{constructor(){b(this,E);w(this,E,[])}pushRow(e){g(this,E).push(e)}computeStyledLines(e){let t=new Array,s=new Array;for(let n of g(this,E))for(let r=0;r<n.length;r++){let u=n[r].computeRawLength();(t[r]===void 0||u>t[r])&&(t[r]=u)}for(let n of g(this,E)){let r=new Array;for(let i=0;i<n.length;i++){let u=n[i];if(r.push(u.computeStyledString(e)),i<n.length-1){let l=u.computeRawLength(),p=" ".repeat(t[i]-l);r.push(p)}}s.push(r.join(""))}return s}};E=new WeakMap;var G,_=class _ extends Error{constructor(t,s){let n=new d;n.push(t),s instanceof _?(n.push(new a(": ")),n.push(g(s,G))):s instanceof Error?n.push(new a(`: ${s.message}`)):s!==void 0&&n.push(new a(`: ${String(s)}`));super(n.computeRawString());b(this,G);w(this,G,n)}computeStyledString(t){return g(this,G).computeStyledString(t)}static tryWithContext(t,s){try{return t()}catch(n){throw new _(s(),n)}}};G=new WeakMap;var m=_,D,R=class R{constructor(e){b(this,D);w(this,D,e)}static none(){return new R("none")}static tty(){return new R("tty")}static mock(){return new R("mock")}static inferFromEnv(){if(!process||!process.env||!process.stdout||X("NO_COLOR"))return R.none();let e=X("FORCE_COLOR");return e==="0"?R.none():e!==void 0&&!J.has(e.toLowerCase())?R.tty():X("MOCK_COLOR")?R.mock():!process.stdout.isTTY||X("TERM")?.toLowerCase()==="dumb"?R.none():R.tty()}computeStyledString(e,t){if(t===void 0)return e;let s=e;if(t.case==="upper"&&(s=s.toUpperCase()),t.case==="lower"&&(s=s.toLowerCase()),g(this,D)==="none")return s;if(g(this,D)==="tty"){let n=t.fgColor?nt[t.fgColor]:"",r=t.bgColor?ot[t.bgColor]:"",i=t.bold?Xe:"",u=t.dim?Ze:"",l=t.italic?_e:"",p=t.underline?et:"",c=t.strikethrough?tt:"";return`${n}${r}${i}${u}${l}${p}${c}${s}${Je}`}if(g(this,D)==="mock"){let n=t.fgColor?`{${s}}@${t.fgColor}`:s,r=t.bgColor?`{${n}}#${t.bgColor}`:n,i=t.bold?`{${r}}+`:r,u=t.dim?`{${i}}-`:i,l=t.italic?`{${u}}*`:u,p=t.underline?`{${l}}_`:l;return t.strikethrough?`{${p}}~`:p}throw new Error(`Unknown TypoSupport kind: ${g(this,D)}`)}computeStyledErrorMessage(e){return[this.computeStyledString("Error:",Ae),e instanceof m?e.computeStyledString(this):e instanceof Error?e.message:String(e)].join(" ")}};D=new WeakMap;var O=R,Je="\x1B[0m",Xe="\x1B[1m",Ze="\x1B[2m",_e="\x1B[3m",et="\x1B[4m",tt="\x1B[9m",nt={darkBlack:"\x1B[30m",darkRed:"\x1B[31m",darkGreen:"\x1B[32m",darkYellow:"\x1B[33m",darkBlue:"\x1B[34m",darkMagenta:"\x1B[35m",darkCyan:"\x1B[36m",darkWhite:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},ot={darkBlack:"\x1B[40m",darkRed:"\x1B[41m",darkGreen:"\x1B[42m",darkYellow:"\x1B[43m",darkBlue:"\x1B[44m",darkMagenta:"\x1B[45m",darkCyan:"\x1B[46m",darkWhite:"\x1B[47m",brightBlack:"\x1B[100m",brightRed:"\x1B[101m",brightGreen:"\x1B[102m",brightYellow:"\x1B[103m",brightBlue:"\x1B[104m",brightMagenta:"\x1B[105m",brightCyan:"\x1B[106m",brightWhite:"\x1B[107m"};function X(o){if(o in process.env)return process.env[o]}function rt(o,e){return{getInformation(){return o},consumeAndMakeDecoder(t){try{let s=e.consumeAndMakeDecoder(t),n=t.consumePositional();if(n!==void 0)throw new m(new d(new a("Unexpected argument: "),new a(`"${n}"`,x)));return{generateUsage:()=>N(o,e),decodeAndMakeInterpreter(){let r=s.decodeAndMakeInterpreter();return{async executeWithContext(i){return await r.executeWithContext(i)}}}}}catch(s){return{generateUsage:()=>N(o,e),decodeAndMakeInterpreter(){throw s}}}}}}function st(o,e,t){let s=Object.keys(t);if(s.length===0)throw new Error("At least one subcommand is required");return{getInformation(){return o},consumeAndMakeDecoder(n){try{let r=e.consumeAndMakeDecoder(n),i=n.consumePositional();if(i===void 0)throw new m(new d(new a("<subcommand>",T),new a(": Is required, but was not provided")));let u=t[i];if(u===void 0){let p=new d;p.push(new a("<subcommand>",T)),p.push(new a(": Unknown name: ")),p.push(new a(`"${i}"`,x));let c=v(i,s.map(h=>({key:h,value:new a(h,S)}))).slice(0,3);throw p.push(new a(": did you mean: ")),p.push(d.join(c,new a(", "))),p.push(new a(" ?")),new m(p)}let l=u.consumeAndMakeDecoder(n);return{generateUsage(){let p=l.generateUsage(),c=N(o,e);return c.segments.push({subcommand:i}),c.segments.push(...p.segments),c.information=p.information,c.positionals.push(...p.positionals),c.subcommands=p.subcommands,c.options.push(...p.options),c},decodeAndMakeInterpreter(){let p=r.decodeAndMakeInterpreter(),c=l.decodeAndMakeInterpreter();return{async executeWithContext(h){return await c.executeWithContext(await p.executeWithContext(h))}}}}}catch(r){return{generateUsage(){let i=N(o,e);i.segments.push({positional:"<subcommand>"});for(let[u,l]of Object.entries(t)){let{description:p,hint:c}=l.getInformation();i.subcommands.push({name:u,description:p,hint:c})}return i},decodeAndMakeInterpreter(){throw r}}}}}}function it(o,e,t){return{getInformation(){return o},consumeAndMakeDecoder(s){try{let n=e.consumeAndMakeDecoder(s),r=t.consumeAndMakeDecoder(s);return{generateUsage(){let i=r.generateUsage(),u=N(o,e);return u.segments.push(...i.segments),u.information=i.information,u.positionals.push(...i.positionals),u.subcommands=i.subcommands,u.options.push(...i.options),u},decodeAndMakeInterpreter(){let i=n.decodeAndMakeInterpreter(),u=r.decodeAndMakeInterpreter();return{async executeWithContext(l){return await u.executeWithContext(await i.executeWithContext(l))}}}}}catch(n){return{generateUsage(){let r=N(o,e);return r.segments.push({positional:"[REST]..."}),r},decodeAndMakeInterpreter(){throw n}}}}}}function N(o,e){let{positionals:t,options:s}=e.generateUsage();return{segments:t.map(n=>({positional:n.label})),information:o,positionals:t,subcommands:[],options:s}}function at(o,e){return{generateUsage(){let t=new Array;for(let n in o.options){let r=o.options[n];t.push(r.generateUsage())}let s=new Array;for(let n of o.positionals)s.push(n.generateUsage());return{options:t,positionals:s}},consumeAndMakeDecoder(t){let s={};for(let r in o.options){let i=o.options[r];s[r]=i.registerAndMakeDecoder(t)}let n=[];for(let r of o.positionals)n.push(r.consumeAndMakeDecoder(t));return{decodeAndMakeInterpreter(){let r={};for(let u in s)r[u]=s[u].getAndDecodeValue();let i=[];for(let u of n)i.push(u.decodeValue());return{executeWithContext(u){return e(u,{options:r,positionals:i})}}}}}}}function te(o){let e=ie("value"),{long:t,short:s,description:n,hint:r,aliases:i}=o;return{generateUsage(){return{short:s,long:t,annotation:"[=no]",description:n,hint:r}},registerAndMakeDecoder(u){let l=ce(u,{long:t,short:s,aliasesLongs:i?.longs,aliasesShorts:i?.shorts,parsing:{consumeShortGroup:!1,consumeNextArg:()=>!1}});return{getAndDecodeValue(){let p=u.getOptionValues(l);if(p.length>1&&Te(t),p.length===0)return o.default===void 0?!1:o.default;let c=p[0],h=c.inlined===null?"true":c.inlined;return ee({long:t,type:e,input:h})}}}}}function de(o){let{long:e,short:t,description:s,hint:n,aliases:r,type:i}=o,u=`<${i.content}>`;return{generateUsage(){return{short:t,long:e,label:u,description:s,hint:n}},registerAndMakeDecoder(l){let p=ce(l,{long:e,short:t,aliasesLongs:r?.longs,aliasesShorts:r?.shorts,parsing:{consumeShortGroup:!0,consumeNextArg(c,h){return o.valueIfNothingInlined!==void 0?!1:c===null&&h.length===0}}});return{getAndDecodeValue(){let c=l.getOptionValues(p);c.length>1&&Te(e);let h=c[0];if(h===void 0)try{return o.defaultIfNotSpecified()}catch($){Re({long:e,error:$,context:"Not specified"})}if(h.inlined){let $=h.inlined;return ee({long:e,label:u,type:i,input:$})}if(o.valueIfNothingInlined!==void 0)try{return o.valueIfNothingInlined()}catch($){Re({long:e,error:$,context:"Nothing inlined"})}let A=h.separated[0];return ee({long:e,label:u,type:i,input:A})}}}}}function ut(o){let{long:e,short:t,description:s,hint:n,aliases:r,type:i}=o,u=`<${i.content}>`;return{generateUsage(){return{short:t,long:e,label:u,annotation:" [*]",description:s,hint:n}},registerAndMakeDecoder(l){let p=ce(l,{long:e,short:t,aliasesLongs:r?.longs,aliasesShorts:r?.shorts,parsing:{consumeShortGroup:!0,consumeNextArg:(c,h)=>c===null&&h.length===0}});return{getAndDecodeValue(){return l.getOptionValues(p).map(h=>{let A=h.inlined??h.separated[0];return ee({long:e,label:u,type:i,input:A})})}}}}}function ee(o){return m.tryWithContext(()=>o.type.decoder(o.input),()=>{let e=new d;return e.push(new a(`--${o.long}`,S)),o.label?(e.push(new a(": ")),e.push(new a(o.label,T))):(e.push(new a(": ")),e.push(new a(o.type.content,V))),e})}function ce(o,e){let{long:t,short:s,aliasesLongs:n,aliasesShorts:r,parsing:i}=e,u=t?[t]:[];n&&u.push(...n);let l=s?[s]:[];return r&&l.push(...r),o.registerOption({longs:u,shorts:l,parsing:i})}function Te(o){throw new m(new d(new a(`--${o}`,S),new a(": Must not be set multiple times")))}function Re(o){let e=new d;throw e.push(new a(`--${o.long}`,S)),e.push(new a(`: ${o.context}: Failed to generate default value`)),new m(e,o.error)}function pt(o){let{description:e,hint:t,type:s}=o,n=`<${s.content}>`;return{generateUsage(){return{description:e,hint:t,label:n}},consumeAndMakeDecoder(r){let i=r.consumePositional();if(i===void 0)throw new m(new d(new a(n,T),new a(": Is required, but was not provided")));return{decodeValue(){return ge(n,o.type,i)}}}}}function lt(o){let{description:e,hint:t,type:s}=o,n=`[${s.content}]`;return{generateUsage(){return{description:e,hint:t,label:n}},consumeAndMakeDecoder(r){let i=r.consumePositional();return{decodeValue(){if(i===void 0)try{return o.default()}catch{ct(n)}return ge(n,o.type,i)}}}}}function dt(o){let{description:e,hint:t,type:s}=o,n=`[${s.content}]`,r=`${n}...`+(o.endDelimiter?` ["${o.endDelimiter}"]`:"");return{generateUsage(){return{description:e,hint:t,label:r}},consumeAndMakeDecoder(i){let u=new Array;for(;;){let l=i.consumePositional();if(l===void 0||l===o.endDelimiter)break;u.push(l)}return{decodeValue(){return u.map(l=>ge(n,o.type,l))}}}}}function ge(o,e,t){return m.tryWithContext(()=>e.decoder(t),()=>new d(new a(o,T)))}function ct(o){throw new m(new d(new a(o,T),new a(": Failed to get default value")))}var F,W,M,P,I,j,y,ne,ke,he,Oe,K,Ve,me,ye,H=class{constructor(e){b(this,y);b(this,F);b(this,W);b(this,M);b(this,P);b(this,I);b(this,j);w(this,F,e),w(this,W,0),w(this,M,!1),w(this,P,new Map),w(this,I,new Map),w(this,j,new Map)}registerOption(e){let t=[...e.longs.map(n=>`--${n}`),...e.shorts.map(n=>`-${n}`)].join(", ");for(let n of e.longs){if(!f(this,y,me).call(this,n))throw new Error(`Invalid option name: --${n}`);if(g(this,P).has(n))throw new Error(`Option already registered: --${n}`)}for(let n of e.shorts){if(!f(this,y,me).call(this,n))throw new Error(`Invalid option name: -${n}`);if(g(this,I).has(n))throw new Error(`Option already registered: -${n}`);for(let r=0;r<n.length;r++){let i=n.slice(0,r);if(g(this,I).has(i))throw new Error(`Option -${n} overlap with shorter option: -${i}`)}for(let r of g(this,I).keys())if(r.startsWith(n))throw new Error(`Option -${n} overlap with longer option: -${r}`)}let s={parsing:e.parsing,results:new Array};for(let n of e.longs)g(this,P).set(n,s);for(let n of e.shorts)g(this,I).set(n,s);return g(this,j).set(t,s),t}getOptionValues(e){let t=g(this,j).get(e);if(t===void 0)throw new Error(`Unregistered option: ${e}`);return t.results}consumePositional(){for(;;){let e=f(this,y,ne).call(this);if(e===void 0)return;if(!f(this,y,ke).call(this,e))return e}}};F=new WeakMap,W=new WeakMap,M=new WeakMap,P=new WeakMap,I=new WeakMap,j=new WeakMap,y=new WeakSet,ne=function(){let e=g(this,F)[g(this,W)];if(e!==void 0)return be(this,W)._++,!g(this,M)&&e==="--"?(w(this,M,!0),f(this,y,ne).call(this)):e},ke=function(e){if(g(this,M))return!1;if(e.startsWith("--")){let t=e.indexOf("=");return t===-1?f(this,y,he).call(this,e.slice(2),null):f(this,y,he).call(this,e.slice(2,t),e.slice(t+1)),!0}if(e.startsWith("-")){let t=1,s=2;for(;s<=e.length;){let n=e.slice(t,s),r=g(this,I).get(n);if(r!==void 0){let i=e.slice(s);if(f(this,y,Oe).call(this,r,n,i))return!0;t=s}s++}f(this,y,ye).call(this,`-${e.slice(t)}`)}return!1},he=function(e,t){let s=`--${e}`,n=g(this,P).get(e);if(n!==void 0)return f(this,y,K).call(this,n,s,t);f(this,y,ye).call(this,s)},Oe=function(e,t,s){let n=`-${t}`;return s.startsWith("=")?(f(this,y,K).call(this,e,n,s.slice(1)),!0):s.length===0?(f(this,y,K).call(this,e,n,null),!0):e.parsing.consumeShortGroup?(f(this,y,K).call(this,e,n,s),!0):(f(this,y,K).call(this,e,n,null),!1)},K=function(e,t,s){let n=new Array;for(;e.parsing.consumeNextArg(s,n,g(this,F)[g(this,W)]);)n.push(f(this,y,Ve).call(this,t));e.results.push({inlined:s,separated:n})},Ve=function(e){let t=f(this,y,ne).call(this);if(t===void 0)throw new m(new d(new a(e,S),new a(": Requires a value, but got end of input")));if(g(this,M))throw new m(new d(new a(e,S),new a(": Requires a value before "),new a('"--"',x)));if(t.startsWith("-"))throw new m(new d(new a(e,S),new a(": Requires a value, but got: "),new a(`"${t}"`,x)));return t},me=function(e){return e.length>0&&!e.includes("=")&&!e.includes("\0")},ye=function(e){let t=[];for(let n of g(this,P).keys())t.push(`--${n}`);for(let n of g(this,I).keys())t.push(`-${n}`);let s=new d;if(s.push(new a("Unknown option: ")),s.push(new a(`"${e}"`,x)),t.length>0){let n=v(e,t.map(r=>({key:r,value:new a(r,S)}))).slice(0,3);s.push(new a(": did you mean: ")),s.push(d.join(n,new a(", "))),s.push(new a(" ?"))}else s.push(new a(", no options are registered"));throw new m(s)};function we(o){let{cliName:e,usage:t,typoSupport:s}=o,n=new Array,r=new d;r.push(gt("Usage:")),r.push(C(" ")),r.push(U(e));for(let u of t.segments)r.push(C(" ")),"positional"in u&&r.push(q(u.positional)),"subcommand"in u&&r.push(U(u.subcommand));n.push(r.computeStyledString(s)),n.push("");let i=new d;i.push(ht(t.information.description)),t.information.hint&&(i.push(C(" ")),i.push(Y(`(${t.information.hint})`))),n.push(i.computeStyledString(s));for(let u of t.information.details??[]){let l=new d;l.push(Y(u)),n.push(l.computeStyledString(s))}if(t.positionals.length>0){n.push(""),n.push(oe("Positionals:").computeStyledString(s));let u=new L;for(let l of t.positionals){let p=new Array;p.push(new d(C(" "))),p.push(new d(q(l.label))),p.push(...fe(l)),u.pushRow(p)}n.push(...u.computeStyledLines(s))}if(t.subcommands.length>0){n.push(""),n.push(oe("Subcommands:").computeStyledString(s));let u=new L;for(let l of t.subcommands){let p=new Array;p.push(new d(C(" "))),p.push(new d(U(l.name))),p.push(...fe(l)),u.pushRow(p)}n.push(...u.computeStyledLines(s))}if(t.options.length>0){n.push(""),n.push(oe("Options:").computeStyledString(s));let u=new L;for(let l of t.options){let p=new Array;p.push(new d(C(" "))),l.short?p.push(new d(U(`-${l.short}`),C(", "))):p.push(new d);let c=new d(U(`--${l.long}`));l.label&&(c.push(C(" ")),c.push(q(l.label))),l.annotation&&c.push(Y(l.annotation)),p.push(c),p.push(...fe(l)),u.pushRow(p)}n.push(...u.computeStyledLines(s))}if(t.information.examples){n.push(""),n.push(oe("Examples:").computeStyledString(s));for(let u of t.information.examples){let l=new d;l.push(C(" ")),l.push(Y(`# ${u.explanation}`)),n.push(l.computeStyledString(s));let p=new d;p.push(C(" ")),p.push(U(e));for(let c of u.commandArgs)if(p.push(C(" ")),typeof c=="string")p.push(new a(c));else if("positional"in c)p.push(q(c.positional));else if("subcommand"in c)p.push(U(c.subcommand));else if("option"in c){let h=c.option;if("short"in h?p.push(U(`-${h.short}`)):p.push(U(`--${h.long}`)),h.inlined!==void 0&&(p.push(Y("=")),p.push(q(h.inlined))),h.separated!==void 0)for(let A of h.separated)p.push(C(" ")),p.push(q(A))}n.push(p.computeStyledString(s))}}return n.push(""),n}function fe(o){let e=[];return o.description&&(e.push(C(" ")),e.push(mt(o.description))),o.hint&&(e.push(C(" ")),e.push(Y(`(${o.hint})`))),e.length>0?[new d(C(" "),...e)]:[]}function gt(o){return new a(o,V)}function ht(o){return new a(o,pe)}function mt(o){return new a(o)}function oe(o){return new a(o,ue)}function Y(o){return new a(o,le)}function U(o){return new a(o,S)}function q(o){return new a(o,T)}function C(o){return new a(o)}async function yt(o,e,t,s,n){let r=new H(e),i=new Array,u=O.none(),l=n?.colorSetup??"flag";if(l==="flag"){let h=de({long:"color",type:ae("color-mode",["auto","always","never","mock"]),defaultIfNotSpecified:()=>"auto",valueIfNothingInlined:()=>"always"}).registerAndMakeDecoder(r);i.push(()=>{try{u=$e(h.getAndDecodeValue())}catch(A){throw u=O.inferFromEnv(),A}})}else u=$e(l);if(n?.usageOnHelp??!0){let h=te({long:"help"}).registerAndMakeDecoder(r);i.push(A=>{if(h.getAndDecodeValue())return console.log(Ue(o,A,u)),0})}if(n?.buildVersion){let h=te({long:"version"}).registerAndMakeDecoder(r);i.push(()=>{if(h.getAndDecodeValue())return console.log([o,n.buildVersion].join(" ")),0})}let p=s.consumeAndMakeDecoder(r);for(;;)try{if(r.consumePositional()===void 0)break}catch{}let c=n?.onExit??process.exit;try{for(let A of i){let $=A(p);if($!==void 0)return c($)}let h=p.decodeAndMakeInterpreter();try{return await h.executeWithContext(t),c(0)}catch(A){return Ie(n?.onError,A,u),c(1)}}catch(h){return(n?.usageOnError??!0)&&console.error(Ue(o,p,u)),Ie(n?.onError,h,u),c(1)}}function Ie(o,e,t){o!==void 0?o(e):console.error(t.computeStyledErrorMessage(e))}function Ue(o,e,t){return we({cliName:o,usage:e.generateUsage(),typoSupport:t}).join(`
2
+ `)}function $e(o){switch(o){case"auto":return O.inferFromEnv();case"env":return O.inferFromEnv();case"always":return O.tty();case"never":return O.none();case"mock":return O.mock()}}0&&(module.exports={ReaderArgs,TypoError,TypoGrid,TypoString,TypoSupport,TypoText,command,commandChained,commandWithSubcommands,operation,optionFlag,optionRepeatable,optionSingleValue,positionalOptional,positionalRequired,positionalVariadics,runAndExit,similaritySort,type,typeBoolean,typeBooleanValuesFalse,typeBooleanValuesTrue,typeChoice,typeConverted,typeDatetime,typeInteger,typeList,typeNumber,typePath,typeRenamed,typeTuple,typeUrl,typoStyleConstants,typoStyleFailure,typoStyleLogic,typoStyleQuote,typoStyleRegularStrong,typoStyleRegularWeaker,typoStyleTitle,typoStyleUserInput,usageToStyledLines});
3
3
  //# sourceMappingURL=index.js.map