clerc 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -387,7 +387,7 @@ declare class Clerc<C extends CommandRecord = {}> {
387
387
  version(version: string): this;
388
388
  /**
389
389
  * Set the Locale
390
- * It's recommended to call this method once after you created the Clerc instance.
390
+ * You must call this method once after you created the Clerc instance.
391
391
  * @param locale
392
392
  * @returns
393
393
  * @example
@@ -400,7 +400,7 @@ declare class Clerc<C extends CommandRecord = {}> {
400
400
  locale(locale: string): this;
401
401
  /**
402
402
  * Set the fallback Locale
403
- * It's recommended to call this method once after you created the Clerc instance.
403
+ * You must call this method once after you created the Clerc instance.
404
404
  * @param fallbackLocale
405
405
  * @returns
406
406
  * @example
@@ -411,6 +411,17 @@ declare class Clerc<C extends CommandRecord = {}> {
411
411
  * ```
412
412
  */
413
413
  fallbackLocale(fallbackLocale: string): this;
414
+ /**
415
+ * Register a error handler
416
+ * @param handler
417
+ * @returns
418
+ * @example
419
+ * ```ts
420
+ * Clerc.create()
421
+ * .errorHandler((err) => { console.log(err); })
422
+ * ```
423
+ */
424
+ errorHandler(handler: (err: any) => void): this;
414
425
  /**
415
426
  * Register a command
416
427
  * @param name
@@ -567,6 +578,31 @@ interface CompletionsPluginOptions {
567
578
  }
568
579
  declare const completionsPlugin: (options?: CompletionsPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
569
580
 
581
+ interface BlockSection {
582
+ type?: "block";
583
+ title: string;
584
+ body: string[];
585
+ }
586
+ interface InlineSection {
587
+ type: "inline";
588
+ items: {
589
+ title: string;
590
+ body: string;
591
+ }[];
592
+ }
593
+ type Section = BlockSection | InlineSection;
594
+ interface Renderers {
595
+ renderSections?: (sections: Section[]) => Section[];
596
+ renderFlagName?: (name: string) => string;
597
+ renderType?: (type: any, hasDefault: boolean) => string;
598
+ renderDefault?: (default_: any) => string;
599
+ }
600
+
601
+ declare module "@clerc/core" {
602
+ interface CommandCustomProperties {
603
+ help?: Renderers;
604
+ }
605
+ }
570
606
  interface HelpPluginOptions {
571
607
  /**
572
608
  * Whether to registr the help command.
@@ -590,12 +626,8 @@ interface HelpPluginOptions {
590
626
  * Banner
591
627
  */
592
628
  banner?: string;
593
- /**
594
- * Render type
595
- */
596
- renderer?: "cliffy";
597
629
  }
598
- declare const helpPlugin: ({ command, showHelpWhenNoCommand, notes, examples, banner, renderer, }?: HelpPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
630
+ declare const helpPlugin: ({ command, showHelpWhenNoCommand, notes, examples, banner, }?: HelpPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
599
631
 
600
632
  declare const notFoundPlugin: () => Plugin<Clerc<{}>, Clerc<{}>>;
601
633
 
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import{format as Te}from"node:util";import pe from"tty";class At{constructor(){this.listenerMap={},this.wildcardListeners=new Set}on(t,n){return t==="*"?(this.wildcardListeners.add(n),this):(this.listenerMap[t]||(this.listenerMap[t]=new Set),this.listenerMap[t].add(n),this)}emit(t,...n){return this.listenerMap[t]&&(this.wildcardListeners.forEach(r=>r(t,...n)),this.listenerMap[t].forEach(r=>r(...n))),this}off(t,n){var r,s;return t==="**"?(this.listenerMap={},this.wildcardListeners.clear(),this):t==="*"?(n?this.wildcardListeners.delete(n):this.wildcardListeners.clear(),this):(n?(r=this.listenerMap[t])==null||r.delete(n):(s=this.listenerMap[t])==null||s.clear(),this)}}const Dt="known-flag",Ot="unknown-flag",_t="argument",{stringify:V}=JSON,Tt=/\B([A-Z])/g,Mt=e=>e.replace(Tt,"-$1").toLowerCase(),{hasOwnProperty:Nt}=Object.prototype,Z=(e,t)=>Nt.call(e,t),Lt=e=>Array.isArray(e),Me=e=>typeof e=="function"?[e,!1]:Lt(e)?[e[0],!0]:Me(e.type),It=(e,t)=>e===Boolean?t!=="false":t,kt=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),Rt=/[\s.:=]/,jt=e=>{const t=`Flag name ${V(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const n=e.match(Rt);if(n)throw new Error(`${t} cannot contain ${V(n==null?void 0:n[0])}`)},Wt=e=>{const t={},n=(r,s)=>{if(Z(t,r))throw new Error(`Duplicate flags named ${V(r)}`);t[r]=s};for(const r in e){if(!Z(e,r))continue;jt(r);const s=e[r],o=[[],...Me(s),s];n(r,o);const i=Mt(r);if(r!==i&&n(i,o),"alias"in s&&typeof s.alias=="string"){const{alias:u}=s,a=`Flag alias ${V(u)} for flag ${V(r)}`;if(u.length===0)throw new Error(`${a} cannot be empty`);if(u.length>1)throw new Error(`${a} must be a single character`);n(u,o)}}return t},Pt=(e,t)=>{const n={};for(const r in e){if(!Z(e,r))continue;const[s,,o,i]=t[r];if(s.length===0&&"default"in i){let{default:u}=i;typeof u=="function"&&(u=u()),n[r]=u}else n[r]=o?s:s.pop()}return n},ne="--",Ht=/[.:=]/,Ut=/^-{1,2}\w/,Yt=e=>{if(!Ut.test(e))return;const t=!e.startsWith(ne);let n=e.slice(t?1:2),r;const s=n.match(Ht);if(s){const{index:o}=s;r=n.slice(o+1),n=n.slice(0,o)}return[n,r,t]},Gt=(e,{onFlag:t,onArgument:n})=>{let r;const s=(o,i)=>{if(typeof r!="function")return!0;r(o,i),r=void 0};for(let o=0;o<e.length;o+=1){const i=e[o];if(i===ne){s();const a=e.slice(o+1);n==null||n(a,[o],!0);break}const u=Yt(i);if(u){if(s(),!t)continue;const[a,l,m]=u;if(m)for(let c=0;c<a.length;c+=1){s();const h=c===a.length-1;r=t(a[c],h?l:void 0,[o,c+1,h])}else r=t(a,l,[o])}else s(i,[o])&&(n==null||n([i],[o]))}s()},zt=(e,t)=>{for(const[n,r,s]of t.reverse()){if(r){const o=e[n];let i=o.slice(0,r);if(s||(i+=o.slice(r+1)),i!=="-"){e[n]=i;continue}}e.splice(n,1)}},Vt=(e,t=process.argv.slice(2),{ignore:n}={})=>{const r=[],s=Wt(e),o={},i=[];return i[ne]=[],Gt(t,{onFlag(u,a,l){const m=Z(s,u);if(!(n!=null&&n(m?Dt:Ot,u,a))){if(m){const[c,h]=s[u],d=It(h,a),p=(g,x)=>{r.push(l),x&&r.push(x),c.push(kt(h,g||""))};return d===void 0?p:p(d)}Z(o,u)||(o[u]=[]),o[u].push(a===void 0?!0:a),r.push(l)}},onArgument(u,a,l){n!=null&&n(_t,t[a[0]])||(i.push(...u),l?(i[ne]=u,t.splice(a[0])):r.push(a))}}),zt(t,r),{flags:Pt(e,s),unknownFlags:o,_:i}};function de(e){return e!==null&&typeof e=="object"}function ge(e,t,n=".",r){if(!de(t))return ge(e,{},n,r);const s=Object.assign({},t);for(const o in e){if(o==="__proto__"||o==="constructor")continue;const i=e[o];i!=null&&(r&&r(s,o,i,n)||(Array.isArray(i)&&Array.isArray(s[o])?s[o]=[...i,...s[o]]:de(i)&&de(s[o])?s[o]=ge(i,s[o],(n?`${n}.`:"")+o.toString(),r):s[o]=i))}return s}function Zt(e){return(...t)=>t.reduce((n,r)=>ge(n,r,"",e),{})}const qt=Zt(),re=e=>Array.isArray(e)?e:[e],Jt=e=>e.replace(/[-_ ](\w)/g,(t,n)=>n.toUpperCase()),Ne=(e,t)=>t.length!==e.length?!1:e.every((n,r)=>n===t[r]),Le=(e,t)=>t.length>e.length?!1:Ne(e.slice(0,t.length),t);class Ie extends Error{constructor(t,n){super(n("core.commandExists",t)),this.commandName=t}}class oe extends Error{constructor(t,n){super(n("core.noSuchCommand",t)),this.commandName=t}}class se extends Error{constructor(t){super(t("core.noCommandGiven"))}}class ke extends Error{constructor(t,n,r){super(r("core.commandNameConflict",t,n)),this.n1=t,this.n2=n}}class Re extends Error{constructor(t){super(t("core.nameNotSet"))}}class je extends Error{constructor(t){super(t("core.descriptionNotSet"))}}class We extends Error{constructor(t){super(t("core.versionNotSet"))}}class Pe extends Error{constructor(t,n){super(n("core.badNameFormat",t)),this.commandName=t}}class fe extends Error{constructor(t){super(t("core.localeMustBeCalledFirst"))}}const He=typeof Deno!="undefined",Kt=typeof process!="undefined"&&!He,Qt=process.versions.electron&&!process.defaultApp;function Ue(e,t,n,r){if(n.alias){const s=re(n.alias);for(const o of s){if(o in t)throw new ke(t[o].name,n.name,r);e.set(typeof o=="symbol"?o:o.split(" "),{...n,__isAlias:!0})}}}function xe(e,t){const n=new Map;e[C]&&(n.set(C,e[C]),Ue(n,e,e[C],t));for(const r of Object.values(e))Ue(n,e,r,t),n.set(r.name.split(" "),r);return n}function Ye(e,t,n){if(t===C)return[e[C],C];const r=re(t),s=xe(e,n);let o,i;return s.forEach((u,a)=>{if(a===C){o=e[C],i=C;return}Le(r,a)&&(!i||i===C||a.length>i.length)&&(o=u,i=a)}),[o,i]}function Ge(e,t,n){if(t===C)return[e[C],C];const r=re(t),s=xe(e,n);let o,i;return s.forEach((u,a)=>{a===C||i===C||Ne(r,a)&&(o=u,i=a)}),[o,i]}function ze(e,t,n=1/0){const r=t===""?[]:Array.isArray(t)?t:t.split(" ");return Object.values(e).filter(s=>{const o=s.name.split(" ");return Le(o,r)&&o.length-r.length<=n})}const Xt=e=>ze(e,"",1);function Ve(e){const t=[];for(const n of e){if(n.startsWith("-"))break;t.push(n)}return t}const Ce=()=>Kt?process.argv.slice(Qt?1:2):He?Deno.args:[];function Ze(e){const t={pre:[],normal:[],post:[]};for(const r of e){const s=typeof r=="object"?r:{fn:r},{enforce:o,fn:i}=s;o==="post"||o==="pre"?t[o].push(i):t.normal.push(i)}const n=[...t.pre,...t.normal,...t.post];return r=>{return s(0);function s(o){const i=n[o];return i(r(),s.bind(null,o+1))}}}const qe=e=>typeof e=="string"&&(e.startsWith(" ")||e.endsWith(" ")),Je=(e,t)=>t?`[${e}]`:`<${e}>`,en="<Root>",H=e=>Array.isArray(e)?e.join(" "):typeof e=="string"?e:en,Ke=()=>process.env.CLERC_LOCALE?process.env.CLERC_LOCALE:Intl.DateTimeFormat().resolvedOptions().locale,{stringify:U}=JSON;function Be(e){const t=[];let n,r;for(const s of e){if(r)throw new Error(`Invalid parameter: Spread parameter ${U(r)} must be last`);const o=s[0],i=s[s.length-1];let u;if(o==="<"&&i===">"&&(u=!0,n))throw new Error(`Invalid parameter: Required parameter ${U(s)} cannot come after optional parameter ${U(n)}`);if(o==="["&&i==="]"&&(u=!1,n=s),u===void 0)throw new Error(`Invalid parameter: ${U(s)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let a=s.slice(1,-1);const l=a.slice(-3)==="...";l&&(r=s,a=a.slice(0,-3)),t.push({name:a,required:u,spread:l})}return t}function $e(e,t,n){for(let r=0;r<t.length;r+=1){const{name:s,required:o,spread:i}=t[r],u=Jt(s);if(u in e)return new Error(`Invalid parameter: ${U(s)} is used more than once.`);const a=i?n.slice(r):n[r];if(i&&(r=t.length),o&&(!a||i&&a.length===0))return new Error(`Error: Missing required parameter ${U(s)}`);e[u]=a}}const tn={en:{"core.commandExists":'Command "%s" exists.',"core.noSuchCommand":"No such command: %s.","core.noCommandGiven":"No command given.","core.commandNameConflict":"Command name %s conflicts with %s. Maybe caused by alias.","core.nameNotSet":"Name not set.","core.descriptionNotSet":"Description not set.","core.versionNotSet":"Version not set.","core.badNameFormat":"Bad name format: %s.","core.localeMustBeCalledFirst":"locale() or fallbackLocale() must be called at first."},"zh-CN":{"core.commandExists":'\u547D\u4EE4 "%s" \u5DF2\u5B58\u5728\u3002',"core.noSuchCommand":"\u627E\u4E0D\u5230\u547D\u4EE4: %s\u3002","core.noCommandGiven":"\u6CA1\u6709\u8F93\u5165\u547D\u4EE4\u3002","core.commandNameConflict":"\u547D\u4EE4\u540D\u79F0 %s \u548C %s \u51B2\u7A81\u3002 \u53EF\u80FD\u662F\u7531\u4E8E\u522B\u540D\u5BFC\u81F4\u7684\u3002","core.nameNotSet":"\u672A\u8BBE\u7F6ECLI\u540D\u79F0\u3002","core.descriptionNotSet":"\u672A\u8BBE\u7F6ECLI\u63CF\u8FF0\u3002","core.versionNotSet":"\u672A\u8BBE\u7F6ECLI\u7248\u672C\u3002","core.badNameFormat":"\u9519\u8BEF\u7684\u547D\u4EE4\u540D\u5B57\u683C\u5F0F: %s\u3002","core.localeMustBeCalledFirst":"locale() \u6216 fallbackLocale() \u5FC5\u987B\u5728\u6700\u5F00\u59CB\u8C03\u7528\u3002"}};var Ee=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},f=(e,t,n)=>(Ee(e,t,"read from private field"),n?n.call(e):t.get(e)),w=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},D=(e,t,n,r)=>(Ee(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),_=(e,t,n)=>(Ee(e,t,"access private method"),n),k,R,j,q,J,ie,Y,ae,K,Q,X,W,Se,Qe,we,Xe,ye,et,T,N,be,tt;const C=Symbol("Root"),nt=class{constructor(e,t,n){w(this,Se),w(this,we),w(this,ye),w(this,T),w(this,be),w(this,k,""),w(this,R,""),w(this,j,""),w(this,q,[]),w(this,J,{}),w(this,ie,new At),w(this,Y,new Set),w(this,ae,void 0),w(this,K,!1),w(this,Q,"en"),w(this,X,"en"),w(this,W,{}),this.i18n={add:r=>{D(this,W,qt(f(this,W),r))},t:(r,...s)=>{const o=f(this,W)[f(this,X)]||f(this,W)[f(this,Q)],i=f(this,W)[f(this,Q)];return o[r]?Te(o[r],...s):i[r]?Te(i[r],...s):void 0}},D(this,k,e||f(this,k)),D(this,R,t||f(this,R)),D(this,j,n||f(this,j)),D(this,X,Ke()),_(this,ye,et).call(this)}get _name(){return f(this,k)}get _description(){return f(this,R)}get _version(){return f(this,j)}get _inspectors(){return f(this,q)}get _commands(){return f(this,J)}static create(e,t,n){return new nt(e,t,n)}name(e){return _(this,T,N).call(this),D(this,k,e),this}description(e){return _(this,T,N).call(this),D(this,R,e),this}version(e){return _(this,T,N).call(this),D(this,j,e),this}locale(e){if(f(this,K))throw new fe(this.i18n.t);return D(this,X,e),this}fallbackLocale(e){if(f(this,K))throw new fe(this.i18n.t);return D(this,Q,e),this}command(e,t,n={}){_(this,T,N).call(this);const{t:r}=this.i18n,s=(m=>!(typeof m=="string"||m===C))(e),o=s?e.name:e;if(qe(o))throw new Pe(o,r);const{handler:i=void 0,...u}=s?e:{name:o,description:t,...n},a=[u.name],l=u.alias?re(u.alias):[];u.alias&&a.push(...l);for(const m of a)if(f(this,Y).has(m))throw new Ie(H(m),r);return f(this,J)[o]=u,f(this,Y).add(u.name),l.forEach(m=>f(this,Y).add(m)),s&&i&&this.on(e.name,i),this}on(e,t){return f(this,ie).on(e,t),this}use(e){return _(this,T,N).call(this),e.setup(this)}inspector(e){return _(this,T,N).call(this),f(this,q).push(e),this}parse(e=Ce()){_(this,T,N).call(this);const{argv:t,run:n}=Array.isArray(e)?{argv:e,run:!0}:{argv:Ce(),...e};return D(this,ae,t),_(this,be,tt).call(this),n&&this.runMatchedCommand(),this}runMatchedCommand(){_(this,T,N).call(this);const{t:e}=this.i18n,t=f(this,ae);if(!t)throw new Error("cli.parse() must be called.");const n=Ve(t),r=n.join(" "),s=()=>Ye(f(this,J),n,e),o=[],i=()=>{o.length=0;const[l,m]=s(),c=!!l,h=Vt((l==null?void 0:l.flags)||{},[...t]),{_:d,flags:p,unknownFlags:g}=h;let x=!c||l.name===C?d:d.slice(l.name.split(" ").length),y=(l==null?void 0:l.parameters)||[];const B=y.indexOf("--"),M=y.slice(B+1)||[],b=Object.create(null);if(B>-1&&M.length>0){y=y.slice(0,B);const G=d["--"];x=x.slice(0,-G.length||void 0),o.push($e(b,Be(y),x)),o.push($e(b,Be(M),G))}else o.push($e(b,Be(y),x));const A={...p,...g};return{name:l==null?void 0:l.name,called:Array.isArray(m)?m.join(" "):m,resolved:c,hasRootOrAlias:f(this,Se,Qe),hasRoot:f(this,we,Xe),raw:{...h,parameters:x,mergedFlags:A},parameters:b,flags:p,unknownFlags:g,cli:this}},u={enforce:"post",fn:()=>{const[l]=s(),m=i(),c=o.filter(Boolean);if(c.length>0)throw c[0];if(!l)throw r?new oe(r,e):new se(e);f(this,ie).emit(l.name,m)}},a=[...f(this,q),u];return Ze(a)(i),this}};let nn=nt;k=new WeakMap,R=new WeakMap,j=new WeakMap,q=new WeakMap,J=new WeakMap,ie=new WeakMap,Y=new WeakMap,ae=new WeakMap,K=new WeakMap,Q=new WeakMap,X=new WeakMap,W=new WeakMap,Se=new WeakSet,Qe=function(){return f(this,Y).has(C)},we=new WeakSet,Xe=function(){return Object.prototype.hasOwnProperty.call(this._commands,C)},ye=new WeakSet,et=function(){this.i18n.add(tn)},T=new WeakSet,N=function(){D(this,K,!0)},be=new WeakSet,tt=function(){const{t:e}=this.i18n;if(!f(this,k))throw new Re(e);if(!f(this,R))throw new je(e);if(!f(this,j))throw new We(e)};const P=e=>e,rn=(e,t,n)=>n,on=(e,t)=>t,sn=(e,t)=>({...e,handler:t}),an=e=>`
2
- ${e})
3
- cmd+="__${e}"
4
- ;;`,un=e=>{const{cli:t}=e,{_name:n,_commands:r}=t;return`_${n}() {
1
+ import{format as Ru}from"node:util";import mu from"tty";class RD{constructor(){this.listenerMap={},this.wildcardListeners=new Set}on(D,e){return D==="*"?(this.wildcardListeners.add(e),this):(this.listenerMap[D]||(this.listenerMap[D]=new Set),this.listenerMap[D].add(e),this)}emit(D,...e){return this.listenerMap[D]&&(this.wildcardListeners.forEach(t=>t(D,...e)),this.listenerMap[D].forEach(t=>t(...e))),this}off(D,e){var t,r;return D==="**"?(this.listenerMap={},this.wildcardListeners.clear(),this):D==="*"?(e?this.wildcardListeners.delete(e):this.wildcardListeners.clear(),this):(e?(t=this.listenerMap[D])==null||t.delete(e):(r=this.listenerMap[D])==null||r.clear(),this)}}const jD="known-flag",WD="unknown-flag",PD="argument",{stringify:Z}=JSON,HD=/\B([A-Z])/g,UD=u=>u.replace(HD,"-$1").toLowerCase(),{hasOwnProperty:YD}=Object.prototype,V=(u,D)=>YD.call(u,D),zD=u=>Array.isArray(u),ju=u=>typeof u=="function"?[u,!1]:zD(u)?[u[0],!0]:ju(u.type),GD=(u,D)=>u===Boolean?D!=="false":D,ZD=(u,D)=>typeof D=="boolean"?D:u===Number&&D===""?Number.NaN:u(D),VD=/[\s.:=]/,qD=u=>{const D=`Flag name ${Z(u)}`;if(u.length===0)throw new Error(`${D} cannot be empty`);if(u.length===1)throw new Error(`${D} must be longer than a character`);const e=u.match(VD);if(e)throw new Error(`${D} cannot contain ${Z(e==null?void 0:e[0])}`)},JD=u=>{const D={},e=(t,r)=>{if(V(D,t))throw new Error(`Duplicate flags named ${Z(t)}`);D[t]=r};for(const t in u){if(!V(u,t))continue;qD(t);const r=u[t],n=[[],...ju(r),r];e(t,n);const o=UD(t);if(t!==o&&e(o,n),"alias"in r&&typeof r.alias=="string"){const{alias:i}=r,s=`Flag alias ${Z(i)} for flag ${Z(t)}`;if(i.length===0)throw new Error(`${s} cannot be empty`);if(i.length>1)throw new Error(`${s} must be a single character`);e(i,n)}}return D},KD=(u,D)=>{const e={};for(const t in u){if(!V(u,t))continue;const[r,,n,o]=D[t];if(r.length===0&&"default"in o){let{default:i}=o;typeof i=="function"&&(i=i()),e[t]=i}else e[t]=n?r:r.pop()}return e},nu="--",QD=/[.:=]/,XD=/^-{1,2}\w/,ue=u=>{if(!XD.test(u))return;const D=!u.startsWith(nu);let e=u.slice(D?1:2),t;const r=e.match(QD);if(r){const{index:n}=r;t=e.slice(n+1),e=e.slice(0,n)}return[e,t,D]},De=(u,{onFlag:D,onArgument:e})=>{let t;const r=(n,o)=>{if(typeof t!="function")return!0;t(n,o),t=void 0};for(let n=0;n<u.length;n+=1){const o=u[n];if(o===nu){r();const s=u.slice(n+1);e==null||e(s,[n],!0);break}const i=ue(o);if(i){if(r(),!D)continue;const[s,a,c]=i;if(c)for(let C=0;C<s.length;C+=1){r();const l=C===s.length-1;t=D(s[C],l?a:void 0,[n,C+1,l])}else t=D(s,a,[n])}else r(o,[n])&&(e==null||e([o],[n]))}r()},ee=(u,D)=>{for(const[e,t,r]of D.reverse()){if(t){const n=u[e];let o=n.slice(0,t);if(r||(o+=n.slice(t+1)),o!=="-"){u[e]=o;continue}}u.splice(e,1)}},te=(u,D=process.argv.slice(2),{ignore:e}={})=>{const t=[],r=JD(u),n={},o=[];return o[nu]=[],De(D,{onFlag(i,s,a){const c=V(r,i);if(!(e!=null&&e(c?jD:WD,i,s))){if(c){const[C,l]=r[i],m=GD(l,s),F=(h,d)=>{t.push(a),d&&t.push(d),C.push(ZD(l,h||""))};return m===void 0?F:F(m)}V(n,i)||(n[i]=[]),n[i].push(s===void 0?!0:s),t.push(a)}},onArgument(i,s,a){e!=null&&e(PD,D[s[0]])||(o.push(...i),a?(o[nu]=i,D.splice(s[0])):t.push(s))}}),ee(D,t),{flags:KD(u,r),unknownFlags:n,_:o}};function Eu(u){return u!==null&&typeof u=="object"}function hu(u,D,e=".",t){if(!Eu(D))return hu(u,{},e,t);const r=Object.assign({},D);for(const n in u){if(n==="__proto__"||n==="constructor")continue;const o=u[n];o!=null&&(t&&t(r,n,o,e)||(Array.isArray(o)&&Array.isArray(r[n])?r[n]=[...o,...r[n]]:Eu(o)&&Eu(r[n])?r[n]=hu(o,r[n],(e?`${e}.`:"")+n.toString(),t):r[n]=o))}return r}function ne(u){return(...D)=>D.reduce((e,t)=>hu(e,t,"",u),{})}const re=ne(),ru=u=>Array.isArray(u)?u:[u],oe=u=>u.replace(/[-_ ](\w)/g,(D,e)=>e.toUpperCase()),Wu=(u,D)=>D.length!==u.length?!1:u.every((e,t)=>e===D[t]),Pu=(u,D)=>D.length>u.length?!1:Wu(u.slice(0,D.length),D);class Hu extends Error{constructor(D,e){super(e("core.commandExists",D)),this.commandName=D}}class ou extends Error{constructor(D,e){super(e("core.noSuchCommand",D)),this.commandName=D}}class su extends Error{constructor(D){super(D("core.noCommandGiven"))}}class Uu extends Error{constructor(D,e,t){super(t("core.commandNameConflict",D,e)),this.n1=D,this.n2=e}}class Yu extends Error{constructor(D){super(D("core.nameNotSet"))}}class zu extends Error{constructor(D){super(D("core.descriptionNotSet"))}}class Gu extends Error{constructor(D){super(D("core.versionNotSet"))}}class Zu extends Error{constructor(D,e){super(e("core.badNameFormat",D)),this.commandName=D}}class pu extends Error{constructor(D){super(D("core.localeMustBeCalledFirst"))}}const Vu=typeof Deno!="undefined",se=typeof process!="undefined"&&!Vu,ie=process.versions.electron&&!process.defaultApp;function qu(u,D,e,t){if(e.alias){const r=ru(e.alias);for(const n of r){if(n in D)throw new Uu(D[n].name,e.name,t);u.set(typeof n=="symbol"?n:n.split(" "),{...e,__isAlias:!0})}}}function du(u,D){const e=new Map;u[p]&&(e.set(p,u[p]),qu(e,u,u[p],D));for(const t of Object.values(u))qu(e,u,t,D),e.set(t.name.split(" "),t);return e}function Ju(u,D,e){if(D===p)return[u[p],p];const t=ru(D),r=du(u,e);let n,o;return r.forEach((i,s)=>{if(s===p){n=u[p],o=p;return}Pu(t,s)&&(!o||o===p||s.length>o.length)&&(n=i,o=s)}),[n,o]}function Ku(u,D,e){if(D===p)return[u[p],p];const t=ru(D),r=du(u,e);let n,o;return r.forEach((i,s)=>{s===p||o===p||Wu(t,s)&&(n=i,o=s)}),[n,o]}function Qu(u,D,e=1/0){const t=D===""?[]:Array.isArray(D)?D:D.split(" ");return Object.values(u).filter(r=>{const n=r.name.split(" ");return Pu(n,t)&&n.length-t.length<=e})}const ae=u=>Qu(u,"",1);function Xu(u){const D=[];for(const e of u){if(e.startsWith("-"))break;D.push(e)}return D}const Bu=()=>se?process.argv.slice(ie?1:2):Vu?Deno.args:[];function uD(u){const D={pre:[],normal:[],post:[]};for(const t of u){const r=typeof t=="object"?t:{fn:t},{enforce:n,fn:o}=r;n==="post"||n==="pre"?D[n].push(o):D.normal.push(o)}const e=[...D.pre,...D.normal,...D.post];return t=>{return r(0);function r(n){const o=e[n];return o(t(),r.bind(null,n+1))}}}const DD=u=>typeof u=="string"&&(u.startsWith(" ")||u.endsWith(" ")),eD=(u,D)=>D?`[${u}]`:`<${u}>`,le="<Root>",U=u=>Array.isArray(u)?u.join(" "):typeof u=="string"?u:le,tD=()=>process.env.CLERC_LOCALE?process.env.CLERC_LOCALE:Intl.DateTimeFormat().resolvedOptions().locale,{stringify:Y}=JSON;function gu(u){const D=[];let e,t;for(const r of u){if(t)throw new Error(`Invalid parameter: Spread parameter ${Y(t)} must be last`);const n=r[0],o=r[r.length-1];let i;if(n==="<"&&o===">"&&(i=!0,e))throw new Error(`Invalid parameter: Required parameter ${Y(r)} cannot come after optional parameter ${Y(e)}`);if(n==="["&&o==="]"&&(i=!1,e=r),i===void 0)throw new Error(`Invalid parameter: ${Y(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let s=r.slice(1,-1);const a=s.slice(-3)==="...";a&&(t=r,s=s.slice(0,-3)),D.push({name:s,required:i,spread:a})}return D}function fu(u,D,e){for(let t=0;t<D.length;t+=1){const{name:r,required:n,spread:o}=D[t],i=oe(r);if(i in u)throw new Error(`Invalid parameter: ${Y(r)} is used more than once.`);const s=o?e.slice(t):e[t];if(o&&(t=D.length),n&&(!s||o&&s.length===0))throw new Error(`Missing required parameter ${Y(r)}`);u[i]=s}}const ce={en:{"core.commandExists":'Command "%s" exists.',"core.noSuchCommand":"No such command: %s.","core.noCommandGiven":"No command given.","core.commandNameConflict":"Command name %s conflicts with %s. Maybe caused by alias.","core.nameNotSet":"Name not set.","core.descriptionNotSet":"Description not set.","core.versionNotSet":"Version not set.","core.badNameFormat":"Bad name format: %s.","core.localeMustBeCalledFirst":"locale() or fallbackLocale() must be called at first.","core.cliParseMustBeCalled":"cli.parse() must be called."},"zh-CN":{"core.commandExists":'\u547D\u4EE4 "%s" \u5DF2\u5B58\u5728\u3002',"core.noSuchCommand":"\u627E\u4E0D\u5230\u547D\u4EE4: %s\u3002","core.noCommandGiven":"\u6CA1\u6709\u8F93\u5165\u547D\u4EE4\u3002","core.commandNameConflict":"\u547D\u4EE4\u540D\u79F0 %s \u548C %s \u51B2\u7A81\u3002 \u53EF\u80FD\u662F\u7531\u4E8E\u522B\u540D\u5BFC\u81F4\u7684\u3002","core.nameNotSet":"\u672A\u8BBE\u7F6ECLI\u540D\u79F0\u3002","core.descriptionNotSet":"\u672A\u8BBE\u7F6ECLI\u63CF\u8FF0\u3002","core.versionNotSet":"\u672A\u8BBE\u7F6ECLI\u7248\u672C\u3002","core.badNameFormat":"\u9519\u8BEF\u7684\u547D\u4EE4\u540D\u5B57\u683C\u5F0F: %s\u3002","core.localeMustBeCalledFirst":"locale() \u6216 fallbackLocale() \u5FC5\u987B\u5728\u6700\u5F00\u59CB\u8C03\u7528\u3002","core.cliParseMustBeCalled":"cli.parse() \u5FC5\u987B\u88AB\u8C03\u7528\u3002"}};var Au=(u,D,e)=>{if(!D.has(u))throw TypeError("Cannot "+e)},E=(u,D,e)=>(Au(u,D,"read from private field"),e?e.call(u):D.get(u)),x=(u,D,e)=>{if(D.has(u))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(u):D.set(u,e)},S=(u,D,e,t)=>(Au(u,D,"write to private field"),t?t.call(u,e):D.set(u,e),e),w=(u,D,e)=>(Au(u,D,"access private method"),e),k,I,R,q,J,iu,z,K,Q,X,uu,Du,j,xu,nD,$u,rD,Su,oD,_,T,wu,sD,bu,iD,yu,aD;const p=Symbol.for("Clerc.Root"),lD=class{constructor(u,D,e){x(this,xu),x(this,$u),x(this,Su),x(this,_),x(this,wu),x(this,bu),x(this,yu),x(this,k,""),x(this,I,""),x(this,R,""),x(this,q,[]),x(this,J,{}),x(this,iu,new RD),x(this,z,new Set),x(this,K,void 0),x(this,Q,[]),x(this,X,!1),x(this,uu,"en"),x(this,Du,"en"),x(this,j,{}),this.i18n={add:t=>{S(this,j,re(E(this,j),t))},t:(t,...r)=>{const n=E(this,j)[E(this,Du)]||E(this,j)[E(this,uu)],o=E(this,j)[E(this,uu)];return n[t]?Ru(n[t],...r):o[t]?Ru(o[t],...r):void 0}},S(this,k,u||E(this,k)),S(this,I,D||E(this,I)),S(this,R,e||E(this,R)),S(this,Du,tD()),w(this,Su,oD).call(this)}get _name(){return E(this,k)}get _description(){return E(this,I)}get _version(){return E(this,R)}get _inspectors(){return E(this,q)}get _commands(){return E(this,J)}static create(u,D,e){return new lD(u,D,e)}name(u){return w(this,_,T).call(this),S(this,k,u),this}description(u){return w(this,_,T).call(this),S(this,I,u),this}version(u){return w(this,_,T).call(this),S(this,R,u),this}locale(u){if(E(this,X))throw new pu(this.i18n.t);return S(this,Du,u),this}fallbackLocale(u){if(E(this,X))throw new pu(this.i18n.t);return S(this,uu,u),this}errorHandler(u){return E(this,Q).push(u),this}command(u,D,e={}){w(this,_,T).call(this);const{t}=this.i18n,r=(c=>!(typeof c=="string"||c===p))(u),n=r?u.name:u;if(DD(n))throw new Zu(n,t);const{handler:o=void 0,...i}=r?u:{name:n,description:D,...e},s=[i.name],a=i.alias?ru(i.alias):[];i.alias&&s.push(...a);for(const c of s)if(E(this,z).has(c))throw new Hu(U(c),t);return E(this,J)[n]=i,E(this,z).add(i.name),a.forEach(c=>E(this,z).add(c)),r&&o&&this.on(u.name,o),this}on(u,D){return E(this,iu).on(u,D),this}use(u){return w(this,_,T).call(this),u.setup(this)}inspector(u){return w(this,_,T).call(this),E(this,q).push(u),this}parse(u=Bu()){w(this,_,T).call(this);const{argv:D,run:e}=Array.isArray(u)?{argv:u,run:!0}:{argv:Bu(),...u};return S(this,K,D),w(this,wu,sD).call(this),e&&this.runMatchedCommand(),this}runMatchedCommand(){try{w(this,yu,aD).call(this)}catch(u){if(E(this,Q).length>0)E(this,Q).forEach(D=>D(u));else throw u}return this}};let Fe=lD;k=new WeakMap,I=new WeakMap,R=new WeakMap,q=new WeakMap,J=new WeakMap,iu=new WeakMap,z=new WeakMap,K=new WeakMap,Q=new WeakMap,X=new WeakMap,uu=new WeakMap,Du=new WeakMap,j=new WeakMap,xu=new WeakSet,nD=function(){return E(this,z).has(p)},$u=new WeakSet,rD=function(){return Object.prototype.hasOwnProperty.call(this._commands,p)},Su=new WeakSet,oD=function(){this.i18n.add(ce)},_=new WeakSet,T=function(){S(this,X,!0)},wu=new WeakSet,sD=function(){const{t:u}=this.i18n;if(!E(this,k))throw new Yu(u);if(!E(this,I))throw new zu(u);if(!E(this,R))throw new Gu(u)},bu=new WeakSet,iD=function(u){const D=E(this,K),[e,t]=u(),r=!!e,n=te((e==null?void 0:e.flags)||{},[...D]),{_:o,flags:i,unknownFlags:s}=n;let a=!r||e.name===p?o:o.slice(e.name.split(" ").length),c=(e==null?void 0:e.parameters)||[];const C=c.indexOf("--"),l=c.slice(C+1)||[],m=Object.create(null);if(C>-1&&l.length>0){c=c.slice(0,C);const h=o["--"];a=a.slice(0,-h.length||void 0),fu(m,gu(c),a),fu(m,gu(l),h)}else fu(m,gu(c),a);const F={...i,...s};return{name:e==null?void 0:e.name,called:Array.isArray(t)?t.join(" "):t,resolved:r,hasRootOrAlias:E(this,xu,nD),hasRoot:E(this,$u,rD),raw:{...n,parameters:a,mergedFlags:F},parameters:m,flags:i,unknownFlags:s,cli:this}},yu=new WeakSet,aD=function(){w(this,_,T).call(this);const{t:u}=this.i18n,D=E(this,K);if(!D)throw new Error(u("core.cliParseMustBeCalled"));const e=Xu(D),t=e.join(" "),r=()=>Ju(E(this,J),e,u),n=()=>w(this,bu,iD).call(this,r),o={enforce:"post",fn:()=>{const[s]=r(),a=n();if(!s)throw t?new ou(t,u):new su(u);E(this,iu).emit(s.name,a)}},i=[...E(this,q),o];uD(i)(n)};const W=u=>u,Ce=(u,D,e)=>e,me=(u,D)=>D,Ee=(u,D)=>({...u,handler:D}),he=u=>`
2
+ ${u})
3
+ cmd+="__${u}"
4
+ ;;`,pe=u=>{const{cli:D}=u,{_name:e,_commands:t}=D;return`_${e}() {
5
5
  local i cur prev opts cmds
6
6
  COMPREPLY=()
7
7
  cur="\${COMP_WORDS[COMP_CWORD]}"
@@ -13,27 +13,27 @@ import{format as Te}from"node:util";import pe from"tty";class At{constructor(){t
13
13
  do
14
14
  case "\${i}" in
15
15
  "$1")
16
- cmd="${n}"
16
+ cmd="${e}"
17
17
  ;;
18
- ${Object.keys(r).map(an).join("")}
18
+ ${Object.keys(t).map(he).join("")}
19
19
  *)
20
20
  ;;
21
21
  esac
22
22
  done
23
23
  }
24
24
 
25
- complete -F _${n} -o bashdefault -o default ${n}
26
- `},rt=e=>e.replace(/([A-Z])/g,(t,n)=>`-${n.toLowerCase()}`),ot=e=>e.length<=1?`-${e}`:`--${rt(e)}`,st="(No Description)",ln=e=>`[CompletionResult]::new('${e.name}', '${e.name}', [CompletionResultType]::ParameterValue, '${e.description}')`,cn=e=>Object.entries(e.flags||{}).map(([t,n])=>{const r=[`[CompletionResult]::new('${ot(t)}', '${rt(t)}', [CompletionResultType]::ParameterName, '${e.flags[t].description||st}')`];return n!=null&&n.alias&&r.push(`[CompletionResult]::new('${ot(n.alias)}', '${n.alias}', [CompletionResultType]::ParameterName, '${e.flags[t].description||st}')`),r.join(`
25
+ complete -F _${e} -o bashdefault -o default ${e}
26
+ `},cD=u=>u.replace(/([A-Z])/g,(D,e)=>`-${e.toLowerCase()}`),FD=u=>u.length<=1?`-${u}`:`--${cD(u)}`,CD="(No Description)",de=u=>`[CompletionResult]::new('${u.name}', '${u.name}', [CompletionResultType]::ParameterValue, '${u.description}')`,Be=u=>Object.entries(u.flags||{}).map(([D,e])=>{const t=[`[CompletionResult]::new('${FD(D)}', '${cD(D)}', [CompletionResultType]::ParameterName, '${u.flags[D].description||CD}')`];return e!=null&&e.alias&&t.push(`[CompletionResult]::new('${FD(e.alias)}', '${e.alias}', [CompletionResultType]::ParameterName, '${u.flags[D].description||CD}')`),t.join(`
27
27
  `)}).join(`
28
- `),mn=e=>{const{cli:t}=e,{_name:n,_commands:r}=t;return`using namespace System.Management.Automation
28
+ `),ge=u=>{const{cli:D}=u,{_name:e,_commands:t}=D;return`using namespace System.Management.Automation
29
29
  using namespace System.Management.Automation.Language
30
30
 
31
- Register-ArgumentCompleter -Native -CommandName '${n}' -ScriptBlock {
31
+ Register-ArgumentCompleter -Native -CommandName '${e}' -ScriptBlock {
32
32
  param($wordToComplete, $commandAst, $cursorPosition)
33
33
 
34
34
  $commandElements = $commandAst.CommandElements
35
35
  $command = @(
36
- '${n}'
36
+ '${e}'
37
37
  for ($i = 1; $i -lt $commandElements.Count; $i++) {
38
38
  $element = $commandElements[$i]
39
39
  if ($element -isnot [StringConstantExpressionAst] -or
@@ -46,13 +46,13 @@ Register-ArgumentCompleter -Native -CommandName '${n}' -ScriptBlock {
46
46
  }) -join ';'
47
47
 
48
48
  $completions = @(switch ($command) {
49
- '${n}' {
50
- ${Object.entries(r).map(([s,o])=>ln(o)).join(`
49
+ '${e}' {
50
+ ${Object.entries(t).map(([r,n])=>de(n)).join(`
51
51
  `)}
52
52
  break
53
53
  }
54
- ${Object.entries(r).map(([s,o])=>`'${n};${s.split(" ").join(";")}' {
55
- ${cn(o)}
54
+ ${Object.entries(t).map(([r,n])=>`'${e};${r.split(" ").join(";")}' {
55
+ ${Be(n)}
56
56
  break
57
57
  }`).join(`
58
58
  `)}
@@ -60,18 +60,18 @@ Register-ArgumentCompleter -Native -CommandName '${n}' -ScriptBlock {
60
60
 
61
61
  $completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
62
62
  Sort-Object -Property ListItemText
63
- }`},it={bash:un,pwsh:mn},hn=(e={})=>P({setup:t=>{const{command:n=!0}=e;return n&&(t=t.command("completions","Print shell completions to stdout",{flags:{shell:{description:"Shell type",type:String,default:""}},parameters:["[shell]"]}).on("completions",r=>{if(!t._name)throw new Error("CLI name is not defined!");const s=String(r.parameters.shell||r.flags.shell);if(!s)throw new Error("Missing shell name");if(s in it)process.stdout.write(it[s](r));else throw new Error(`No such shell: ${s}`)})),t}}),pn=e=>Array.isArray(e)?e:[e],dn=e=>e.replace(/([A-Z])/g,(t,n)=>`-${n.toLowerCase()}`),at=e=>e.length<=1?`-${e}`:`--${dn(e)}`;var F={exports:{}};let gn=pe,fn=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||gn.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),$=(e,t,n=e)=>r=>{let s=""+r,o=s.indexOf(t,e.length);return~o?e+ut(s,t,n,o)+t:e+s+t},ut=(e,t,n,r)=>{let s=e.substring(0,r)+n,o=e.substring(r+t.length),i=o.indexOf(t);return~i?s+ut(o,t,n,i):s+o},lt=(e=fn)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?$("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?$("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?$("\x1B[3m","\x1B[23m"):String,underline:e?$("\x1B[4m","\x1B[24m"):String,inverse:e?$("\x1B[7m","\x1B[27m"):String,hidden:e?$("\x1B[8m","\x1B[28m"):String,strikethrough:e?$("\x1B[9m","\x1B[29m"):String,black:e?$("\x1B[30m","\x1B[39m"):String,red:e?$("\x1B[31m","\x1B[39m"):String,green:e?$("\x1B[32m","\x1B[39m"):String,yellow:e?$("\x1B[33m","\x1B[39m"):String,blue:e?$("\x1B[34m","\x1B[39m"):String,magenta:e?$("\x1B[35m","\x1B[39m"):String,cyan:e?$("\x1B[36m","\x1B[39m"):String,white:e?$("\x1B[37m","\x1B[39m"):String,gray:e?$("\x1B[90m","\x1B[39m"):String,bgBlack:e?$("\x1B[40m","\x1B[49m"):String,bgRed:e?$("\x1B[41m","\x1B[49m"):String,bgGreen:e?$("\x1B[42m","\x1B[49m"):String,bgYellow:e?$("\x1B[43m","\x1B[49m"):String,bgBlue:e?$("\x1B[44m","\x1B[49m"):String,bgMagenta:e?$("\x1B[45m","\x1B[49m"):String,bgCyan:e?$("\x1B[46m","\x1B[49m"):String,bgWhite:e?$("\x1B[47m","\x1B[49m"):String});F.exports=lt(),F.exports.createColors=lt;var xn=Function.prototype.toString,Cn=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;function Bn(e){if(typeof e!="function")return null;var t="";if(typeof Function.prototype.name=="undefined"&&typeof e.name=="undefined"){var n=xn.call(e).match(Cn);n&&(t=n[1])}else t=e.name;return t}var ct=Bn,$n=function(e,t){t||(t={});var n=t.hsep===void 0?" ":t.hsep,r=t.align||[],s=t.stringLength||function(a){return String(a).length},o=ht(e,function(a,l){return pt(l,function(m,c){var h=mt(m);(!a[c]||h>a[c])&&(a[c]=h)}),a},[]),i=ue(e,function(a){return ue(a,function(l,m){var c=String(l);if(r[m]==="."){var h=mt(c),d=o[m]+(/\./.test(c)?1:2)-(s(c)-h);return c+Array(d).join(" ")}else return c})}),u=ht(i,function(a,l){return pt(l,function(m,c){var h=s(m);(!a[c]||h>a[c])&&(a[c]=h)}),a},[]);return ue(i,function(a){return ue(a,function(l,m){var c=u[m]-s(l)||0,h=Array(Math.max(c+1,1)).join(" ");return r[m]==="r"||r[m]==="."?h+l:r[m]==="c"?Array(Math.ceil(c/2+1)).join(" ")+l+Array(Math.floor(c/2+1)).join(" "):l+h}).join(n).replace(/\s+$/,"")}).join(`
64
- `)};function mt(e){var t=/\.[^.]*$/.exec(e);return t?t.index+1:e.length}function ht(e,t,n){if(e.reduce)return e.reduce(t,n);for(var r=0,s=arguments.length>=3?n:e[r++];r<e.length;r++)t(s,e[r],r);return s}function pt(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t.call(e,e[n],n)}function ue(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t.call(e,e[r],r));return n}const Fe=(...e)=>$n(e),ve=(...e)=>Fe(...e).toString().split(`
65
- `),En=e=>Array.isArray(e)?`Array<${ct(e[0])}>`:ct(e),Sn=e=>{const t=[];for(const n of e){if(n.type==="block"||!n.type){const r=" ",s=n.body.map(i=>r+i);s.unshift("");const o=s.join(`
66
- `);t.push(Fe([F.exports.bold(`${n.title}:`)],[o]).toString())}else if(n.type==="inline"){const r=n.items.map(o=>[F.exports.bold(`${o.title}:`),o.body]),s=Fe(...r);t.push(s.toString())}t.push("")}return t.join(`
67
- `)},wn={en:{"help.name":"Name","help.version":"Version","help.subcommand":"Subcommand","help.commands":"Commands","help.flags":"Flags","help.description":"Description","help.usage":"Usage","help.examples":"Examples","help.notes":"Notes","help.noDescription":"(No description)","help.notes.1":"If no command is specified, show help for the CLI.","help.notes.2":"If a command is specified, show help for the command.","help.notes.3":"-h is an alias for --help.","help.examples.1":"Show help","help.examples.2":"Show help for a specific command","help.commandDescription":"Show help"},"zh-CN":{"help.name":"\u540D\u79F0","help.version":"\u7248\u672C","help.subcommand":"\u5B50\u547D\u4EE4","help.commands":"\u547D\u4EE4","help.flags":"\u6807\u5FD7","help.description":"\u63CF\u8FF0","help.usage":"\u4F7F\u7528","help.examples":"\u793A\u4F8B","help.notes":"\u5907\u6CE8","help.noDescription":"(\u65E0\u63CF\u8FF0)","help.notes.1":"\u5982\u679C\u6CA1\u6709\u6307\u5B9A\u5C55\u793A\u54EA\u4E2A\u547D\u4EE4\u7684\u5E2E\u52A9\u4FE1\u606F\uFF0C\u9ED8\u8BA4\u5C55\u793ACLI\u7684\u3002","help.notes.2":"\u5982\u679C\u6307\u5B9A\u4E86\u5219\u5C55\u793A\u8BE5\u547D\u4EE4\u5E2E\u52A9\u4FE1\u606F\u3002","help.notes.3":"-h \u662F --help \u7684\u4E00\u4E2A\u522B\u540D\u3002","help.examples.1":"\u5C55\u793A CLI \u7684\u5E2E\u52A9\u4FE1\u606F","help.examples.2":"\u5C55\u793A\u6307\u5B9A\u547D\u4EE4\u7684\u5E2E\u52A9\u4FE1\u606F","help.commandDescription":"\u5C55\u793A\u5E2E\u52A9\u4FE1\u606F"}},Ae=F.exports.yellow("-"),dt=e=>{process.stdout.write(e)},De=(e,t,n)=>{const{t:r}=t.i18n,s=[{title:r("help.name"),body:F.exports.red(t._name)},{title:r("help.version"),body:F.exports.yellow(t._version)}];n&&s.push({title:r("help.subcommand"),body:F.exports.green(`${t._name} ${H(n.name)}`)}),e.push({type:"inline",items:s}),e.push({title:r("help.description"),body:[(n==null?void 0:n.description)||t._description]})},gt=(e,t,n)=>{const r=t.map(([s,o])=>[s,Ae,o]);e.push({title:n("help.examples"),body:ve(...r)})},le=(e,t,n,r)=>{const{cli:s}=t,{t:o}=s.i18n,i=[];De(i,s),i.push({title:o("help.usage"),body:[F.exports.magenta(`$ ${s._name} ${Je("command",t.hasRootOrAlias)} [flags]`)]});const u=[...t.hasRoot?[s._commands[C]]:[],...Object.values(s._commands)].map(a=>{const l=[typeof a.name=="symbol"?"":a.name,...pn(a.alias||[])].sort((m,c)=>m===C?-1:c===C?1:m.length-c.length).map(m=>m===""||typeof m=="symbol"?`${s._name}`:`${s._name} ${m}`).join(", ");return[F.exports.cyan(l),Ae,a.description]});return i.push({title:o("help.commands"),body:ve(...u)}),n&&i.push({title:o("help.notes"),body:n}),r&&gt(i,r,o),e(i)},Oe=(e,t,n)=>{var r;const{cli:s}=t,{t:o}=s.i18n,[i]=Ge(s._commands,n,o);if(!i)throw new oe(H(n),o);const u=[];n===C?De(u,s):De(u,s,{...i,name:H(n)});const a=((r=i.parameters)==null?void 0:r.join(" "))||void 0,l=n===C?"":` ${H(n)}`,m=a?` ${a}`:"",c=i.flags?" [flags]":"";return u.push({title:o("help.usage"),body:[F.exports.magenta(`$ ${s._name}${l}${m}${c}`)]}),i.flags&&u.push({title:o("help.flags"),body:ve(...Object.entries(i.flags).map(([h,d])=>{const p=[at(h)];d.alias&&p.push(at(d.alias));const g=[F.exports.blue(p.join(", "))];if(g.push(Ae,d.description||o("help.noDescription")),d.type){const x=En(d.type);g.push(F.exports.gray(`(${x})`))}return g}))}),i.notes&&u.push({title:o("help.notes"),body:i.notes}),i.examples&&gt(u,i.examples,o),e(u)},yn=({command:e=!0,showHelpWhenNoCommand:t=!0,notes:n,examples:r,banner:s,renderer:o="cliffy"}={})=>P({setup:i=>{const{add:u,t:a}=i.i18n;u(wn);const l=o==="cliffy"?Sn:()=>"",m=c=>{s&&dt(`${s}
68
- `),dt(c)};return e&&(i=i.command("help",a("help.commandDescription"),{parameters:["[command...]"],notes:[a("help.notes.1"),a("help.notes.2"),a("help.notes.3")],examples:[[`$ ${i._name} help`,a("help.examples.1")],[`$ ${i._name} help <command>`,a("help.examples.2")],[`$ ${i._name} <command> --help`,a("help.examples.2")]]}).on("help",c=>{c.parameters.command.length?m(Oe(l,c,c.parameters.command)):m(le(l,c,n,r))})),i.inspector((c,h)=>{const d=c.raw.mergedFlags.h||c.raw.mergedFlags.help;if(!c.hasRootOrAlias&&!c.raw._.length&&t&&!d){let p=`${a("core.noCommandGiven")}
63
+ }`},mD={bash:pe,pwsh:ge},fe=(u={})=>W({setup:D=>{const{command:e=!0}=u;return e&&(D=D.command("completions","Print shell completions to stdout",{flags:{shell:{description:"Shell type",type:String,default:""}},parameters:["[shell]"]}).on("completions",t=>{if(!D._name)throw new Error("CLI name is not defined!");const r=String(t.parameters.shell||t.flags.shell);if(!r)throw new Error("Missing shell name");if(r in mD)process.stdout.write(mD[r](t));else throw new Error(`No such shell: ${r}`)})),D}}),Ae=u=>Array.isArray(u)?u:[u],xe=u=>u.replace(/([A-Z])/g,(D,e)=>`-${e.toLowerCase()}`),ED=u=>u.length<=1?`-${u}`:`--${xe(u)}`;var b={exports:{}};let $e=mu,Se=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||$e.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),B=(u,D,e=u)=>t=>{let r=""+t,n=r.indexOf(D,u.length);return~n?u+hD(r,D,e,n)+D:u+r+D},hD=(u,D,e,t)=>{let r=u.substring(0,t)+e,n=u.substring(t+D.length),o=n.indexOf(D);return~o?r+hD(n,D,e,o):r+n},pD=(u=Se)=>({isColorSupported:u,reset:u?D=>`\x1B[0m${D}\x1B[0m`:String,bold:u?B("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?B("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?B("\x1B[3m","\x1B[23m"):String,underline:u?B("\x1B[4m","\x1B[24m"):String,inverse:u?B("\x1B[7m","\x1B[27m"):String,hidden:u?B("\x1B[8m","\x1B[28m"):String,strikethrough:u?B("\x1B[9m","\x1B[29m"):String,black:u?B("\x1B[30m","\x1B[39m"):String,red:u?B("\x1B[31m","\x1B[39m"):String,green:u?B("\x1B[32m","\x1B[39m"):String,yellow:u?B("\x1B[33m","\x1B[39m"):String,blue:u?B("\x1B[34m","\x1B[39m"):String,magenta:u?B("\x1B[35m","\x1B[39m"):String,cyan:u?B("\x1B[36m","\x1B[39m"):String,white:u?B("\x1B[37m","\x1B[39m"):String,gray:u?B("\x1B[90m","\x1B[39m"):String,bgBlack:u?B("\x1B[40m","\x1B[49m"):String,bgRed:u?B("\x1B[41m","\x1B[49m"):String,bgGreen:u?B("\x1B[42m","\x1B[49m"):String,bgYellow:u?B("\x1B[43m","\x1B[49m"):String,bgBlue:u?B("\x1B[44m","\x1B[49m"):String,bgMagenta:u?B("\x1B[45m","\x1B[49m"):String,bgCyan:u?B("\x1B[46m","\x1B[49m"):String,bgWhite:u?B("\x1B[47m","\x1B[49m"):String});b.exports=pD(),b.exports.createColors=pD;var we=function(u,D){D||(D={});var e=D.hsep===void 0?" ":D.hsep,t=D.align||[],r=D.stringLength||function(s){return String(s).length},n=BD(u,function(s,a){return gD(a,function(c,C){var l=dD(c);(!s[C]||l>s[C])&&(s[C]=l)}),s},[]),o=au(u,function(s){return au(s,function(a,c){var C=String(a);if(t[c]==="."){var l=dD(C),m=n[c]+(/\./.test(C)?1:2)-(r(C)-l);return C+Array(m).join(" ")}else return C})}),i=BD(o,function(s,a){return gD(a,function(c,C){var l=r(c);(!s[C]||l>s[C])&&(s[C]=l)}),s},[]);return au(o,function(s){return au(s,function(a,c){var C=i[c]-r(a)||0,l=Array(Math.max(C+1,1)).join(" ");return t[c]==="r"||t[c]==="."?l+a:t[c]==="c"?Array(Math.ceil(C/2+1)).join(" ")+a+Array(Math.floor(C/2+1)).join(" "):a+l}).join(e).replace(/\s+$/,"")}).join(`
64
+ `)};function dD(u){var D=/\.[^.]*$/.exec(u);return D?D.index+1:u.length}function BD(u,D,e){if(u.reduce)return u.reduce(D,e);for(var t=0,r=arguments.length>=3?e:u[t++];t<u.length;t++)D(r,u[t],t);return r}function gD(u,D){if(u.forEach)return u.forEach(D);for(var e=0;e<u.length;e++)D.call(u,u[e],e)}function au(u,D){if(u.map)return u.map(D);for(var e=[],t=0;t<u.length;t++)e.push(D.call(u,u[t],t));return e}var vu={exports:{}},be=({onlyFirst:u=!1}={})=>{const D=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(D,u?void 0:"g")};const ye=be;var ve=u=>typeof u=="string"?u.replace(ye(),""):u,Ou={exports:{}};const fD=u=>Number.isNaN(u)?!1:u>=4352&&(u<=4447||u===9001||u===9002||11904<=u&&u<=12871&&u!==12351||12880<=u&&u<=19903||19968<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65131||65281<=u&&u<=65376||65504<=u&&u<=65510||110592<=u&&u<=110593||127488<=u&&u<=127569||131072<=u&&u<=262141);Ou.exports=fD,Ou.exports.default=fD;var Oe=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};const _e=ve,Ne=Ou.exports,Te=Oe,AD=u=>{if(typeof u!="string"||u.length===0||(u=_e(u),u.length===0))return 0;u=u.replace(Te()," ");let D=0;for(let e=0;e<u.length;e++){const t=u.codePointAt(e);t<=31||t>=127&&t<=159||t>=768&&t<=879||(t>65535&&e++,D+=Ne(t)?2:1)}return D};vu.exports=AD,vu.exports.default=AD;const _u=u=>we(u,{stringLength:vu.exports}),Nu=u=>_u(u).split(`
65
+ `),xD=new Map([[Boolean,""],[String,"string"],[Number,"number"]]),Me=(u,D=!1)=>{const e=xD.has(u)?xD.get(u):"value";return D?`[${e}]`:`<${e}>`},P=u=>{const D=[];for(const e of u){if(e.type==="block"||!e.type){const t=" ",r=e.body.map(o=>t+o);r.unshift("");const n=r.join(`
66
+ `);D.push(_u([[b.exports.bold(`${e.title}:`)],[n]]).toString())}else if(e.type==="inline"){const t=e.items.map(n=>[b.exports.bold(`${n.title}:`),n.body]),r=_u(t);D.push(r.toString())}D.push("")}return D.join(`
67
+ `)},Le={renderFlagName:u=>u,renderSections:u=>u,renderType:(u,D)=>Me(u,D),renderDefault:u=>JSON.stringify(u)},ke={en:{"help.name":"Name","help.version":"Version","help.subcommand":"Subcommand","help.commands":"Commands","help.flags":"Flags","help.description":"Description","help.usage":"Usage","help.examples":"Examples","help.notes":"Notes","help.noDescription":"(No description)","help.notes.1":"If no command is specified, show help for the CLI.","help.notes.2":"If a command is specified, show help for the command.","help.notes.3":"-h is an alias for --help.","help.examples.1":"Show help","help.examples.2":"Show help for a specific command","help.commandDescription":"Show help","help.default":"Default: "},"zh-CN":{"help.name":"\u540D\u79F0","help.version":"\u7248\u672C","help.subcommand":"\u5B50\u547D\u4EE4","help.commands":"\u547D\u4EE4","help.flags":"\u6807\u5FD7","help.description":"\u63CF\u8FF0","help.usage":"\u4F7F\u7528","help.examples":"\u793A\u4F8B","help.notes":"\u5907\u6CE8","help.noDescription":"(\u65E0\u63CF\u8FF0)","help.notes.1":"\u5982\u679C\u6CA1\u6709\u6307\u5B9A\u5C55\u793A\u54EA\u4E2A\u547D\u4EE4\u7684\u5E2E\u52A9\u4FE1\u606F\uFF0C\u9ED8\u8BA4\u5C55\u793ACLI\u7684\u3002","help.notes.2":"\u5982\u679C\u6307\u5B9A\u4E86\u5219\u5C55\u793A\u8BE5\u547D\u4EE4\u5E2E\u52A9\u4FE1\u606F\u3002","help.notes.3":"-h \u662F --help \u7684\u4E00\u4E2A\u522B\u540D\u3002","help.examples.1":"\u5C55\u793A CLI \u7684\u5E2E\u52A9\u4FE1\u606F","help.examples.2":"\u5C55\u793A\u6307\u5B9A\u547D\u4EE4\u7684\u5E2E\u52A9\u4FE1\u606F","help.commandDescription":"\u5C55\u793A\u5E2E\u52A9\u4FE1\u606F","help.default":"\u9ED8\u8BA4\u503C: %s"}},Tu=b.exports.yellow("-"),$D=u=>{process.stdout.write(u)},Mu=(u,D,e)=>{const{t}=D.i18n,r=[{title:t("help.name"),body:b.exports.red(D._name)},{title:t("help.version"),body:b.exports.yellow(D._version)}];e&&r.push({title:t("help.subcommand"),body:b.exports.green(`${D._name} ${U(e.name)}`)}),u.push({type:"inline",items:r}),u.push({title:t("help.description"),body:[(e==null?void 0:e.description)||D._description]})},SD=(u,D,e)=>{const t=D.map(([r,n])=>[r,Tu,n]);u.push({title:e("help.examples"),body:Nu(t)})},lu=(u,D,e,t)=>{const{cli:r}=D,{t:n}=r.i18n,o=[];Mu(o,r),o.push({title:n("help.usage"),body:[b.exports.magenta(`$ ${r._name} ${eD("command",D.hasRootOrAlias)} [flags]`)]});const i=[...D.hasRoot?[r._commands[p]]:[],...Object.values(r._commands)].map(s=>{const a=[typeof s.name=="symbol"?"":s.name,...Ae(s.alias||[])].sort((c,C)=>c===p?-1:C===p?1:c.length-C.length).map(c=>c===""||typeof c=="symbol"?`${r._name}`:`${r._name} ${c}`).join(", ");return[b.exports.cyan(a),Tu,s.description]});return o.push({title:n("help.commands"),body:Nu(i)}),e&&o.push({title:n("help.notes"),body:e}),t&&SD(o,t,n),u(o)},Lu=(u,D,e)=>{var t;const{cli:r}=D,{t:n}=r.i18n,[o]=Ku(r._commands,e,n);if(!o)throw new ou(U(e),n);const i=Object.assign({},Le,o.help);let s=[];e===p?Mu(s,r):Mu(s,r,{...o,name:U(e)});const a=((t=o.parameters)==null?void 0:t.join(" "))||void 0,c=e===p?"":` ${U(e)}`,C=a?` ${a}`:"",l=o.flags?" [flags]":"";return s.push({title:n("help.usage"),body:[b.exports.magenta(`$ ${r._name}${c}${C}${l}`)]}),o.flags&&s.push({title:n("help.flags"),body:Nu(Object.entries(o.flags).map(([m,F])=>{const h=F.default!==void 0;let d=[ED(m)];F.alias&&d.push(ED(F.alias)),d=d.map(i.renderFlagName);const y=[b.exports.blue(d.join(", ")),i.renderType(F.type,h)];return y.push(Tu,F.description||n("help.noDescription")),h&&y.push(`(${n("help.default",i.renderDefault(F.default))})`),y}))}),o.notes&&s.push({title:n("help.notes"),body:o.notes}),o.examples&&SD(s,o.examples,n),s=i.renderSections(s),u(s)},Ie=({command:u=!0,showHelpWhenNoCommand:D=!0,notes:e,examples:t,banner:r}={})=>W({setup:n=>{const{add:o,t:i}=n.i18n;o(ke);const s=a=>{r&&$D(`${r}
68
+ `),$D(a)};return u&&(n=n.command("help",i("help.commandDescription"),{parameters:["[command...]"],notes:[i("help.notes.1"),i("help.notes.2"),i("help.notes.3")],examples:[[`$ ${n._name} help`,i("help.examples.1")],[`$ ${n._name} help <command>`,i("help.examples.2")],[`$ ${n._name} <command> --help`,i("help.examples.2")]]}).on("help",a=>{a.parameters.command.length?s(Lu(P,a,a.parameters.command)):s(lu(P,a,e,t))})),n.inspector((a,c)=>{const C=a.raw.mergedFlags.h||a.raw.mergedFlags.help;if(!a.hasRootOrAlias&&!a.raw._.length&&D&&!C){let l=`${i("core.noCommandGiven")}
69
69
 
70
- `;p+=le(l,c,n,r),p+=`
71
- `,m(p),process.exit(1)}else d?c.raw._.length?c.called!==C&&c.name===C?m(le(l,c,n,r)):m(Oe(l,c,c.raw._)):c.hasRootOrAlias?m(Oe(l,c,C)):m(le(l,c,n,r)):h()}),i}}),bn={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},Fn=(e,{add:t,t:n})=>(t(bn),e.length<=1?e[0]:n("utils.and",e.slice(0,-1).join(", "),e[e.length-1])),L=new Uint32Array(65536),vn=(e,t)=>{const n=e.length,r=t.length,s=1<<n-1;let o=-1,i=0,u=n,a=n;for(;a--;)L[e.charCodeAt(a)]|=1<<a;for(a=0;a<r;a++){let l=L[t.charCodeAt(a)];const m=l|i;l|=(l&o)+o^o,i|=~(l|o),o&=l,i&s&&u++,o&s&&u--,i=i<<1|1,o=o<<1|~(m|i),i&=m}for(a=n;a--;)L[e.charCodeAt(a)]=0;return u},An=(e,t)=>{const n=t.length,r=e.length,s=[],o=[],i=Math.ceil(n/32),u=Math.ceil(r/32);for(let p=0;p<i;p++)o[p]=-1,s[p]=0;let a=0;for(;a<u-1;a++){let p=0,g=-1;const x=a*32,y=Math.min(32,r)+x;for(let B=x;B<y;B++)L[e.charCodeAt(B)]|=1<<B;for(let B=0;B<n;B++){const M=L[t.charCodeAt(B)],b=o[B/32|0]>>>B&1,A=s[B/32|0]>>>B&1,G=M|p,_e=((M|A)&g)+g^g|M|A;let z=p|~(_e|g),te=g&_e;z>>>31^b&&(o[B/32|0]^=1<<B),te>>>31^A&&(s[B/32|0]^=1<<B),z=z<<1|b,te=te<<1|A,g=te|~(G|z),p=z&G}for(let B=x;B<y;B++)L[e.charCodeAt(B)]=0}let l=0,m=-1;const c=a*32,h=Math.min(32,r-c)+c;for(let p=c;p<h;p++)L[e.charCodeAt(p)]|=1<<p;let d=r;for(let p=0;p<n;p++){const g=L[t.charCodeAt(p)],x=o[p/32|0]>>>p&1,y=s[p/32|0]>>>p&1,B=g|l,M=((g|y)&m)+m^m|g|y;let b=l|~(M|m),A=m&M;d+=b>>>r-1&1,d-=A>>>r-1&1,b>>>31^x&&(o[p/32|0]^=1<<p),A>>>31^y&&(s[p/32|0]^=1<<p),b=b<<1|x,A=A<<1|y,m=A|~(B|b),l=b&B}for(let p=c;p<h;p++)L[e.charCodeAt(p)]=0;return d},ft=(e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return t.length===0?e.length:e.length<=32?vn(e,t):An(e,t)};var ce=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Dn=1/0,On="[object Symbol]",_n=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tn="\\u0300-\\u036f\\ufe20-\\ufe23",Mn="\\u20d0-\\u20f0",Nn="["+Tn+Mn+"]",Ln=RegExp(Nn,"g"),In={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},kn=typeof ce=="object"&&ce&&ce.Object===Object&&ce,Rn=typeof self=="object"&&self&&self.Object===Object&&self,jn=kn||Rn||Function("return this")();function Wn(e){return function(t){return e==null?void 0:e[t]}}var Pn=Wn(In),Hn=Object.prototype,Un=Hn.toString,xt=jn.Symbol,Ct=xt?xt.prototype:void 0,Bt=Ct?Ct.toString:void 0;function Yn(e){if(typeof e=="string")return e;if(zn(e))return Bt?Bt.call(e):"";var t=e+"";return t=="0"&&1/e==-Dn?"-0":t}function Gn(e){return!!e&&typeof e=="object"}function zn(e){return typeof e=="symbol"||Gn(e)&&Un.call(e)==On}function Vn(e){return e==null?"":Yn(e)}function Zn(e){return e=Vn(e),e&&e.replace(_n,Pn).replace(Ln,"")}var qn=Zn;let v,O;(function(e){e.ALL_CLOSEST_MATCHES="all-closest-matches",e.ALL_MATCHES="all-matches",e.ALL_SORTED_MATCHES="all-sorted-matches",e.FIRST_CLOSEST_MATCH="first-closest-match",e.FIRST_MATCH="first-match"})(v||(v={})),function(e){e.EDIT_DISTANCE="edit-distance",e.SIMILARITY="similarity"}(O||(O={}));const $t=new Error("unknown returnType"),me=new Error("unknown thresholdType"),Et=(e,t)=>{let n=e;return t.trimSpaces&&(n=n.trim().replace(/\s+/g," ")),t.deburr&&(n=qn(n)),t.caseSensitive||(n=n.toLowerCase()),n},St=(e,t)=>{const{matchPath:n}=t,r=((s,o)=>{const i=o.length>0?o.reduce((u,a)=>u==null?void 0:u[a],s):s;return typeof i!="string"?"":i})(e,n);return Et(r,t)};function Jn(e,t,n){const r=(h=>{const d={caseSensitive:!1,deburr:!0,matchPath:[],returnType:v.FIRST_CLOSEST_MATCH,thresholdType:O.SIMILARITY,trimSpaces:!0,...h};switch(d.thresholdType){case O.EDIT_DISTANCE:return{threshold:20,...d};case O.SIMILARITY:return{threshold:.4,...d};default:throw me}})(n),{returnType:s,threshold:o,thresholdType:i}=r,u=Et(e,r);let a,l;switch(i){case O.EDIT_DISTANCE:a=h=>h<=o,l=h=>ft(u,St(h,r));break;case O.SIMILARITY:a=h=>h>=o,l=h=>((d,p)=>{if(!d||!p)return 0;if(d===p)return 1;const g=ft(d,p),x=Math.max(d.length,p.length);return(x-g)/x})(u,St(h,r));break;default:throw me}const m=[],c=t.length;switch(s){case v.ALL_CLOSEST_MATCHES:case v.FIRST_CLOSEST_MATCH:{const h=[];let d;switch(i){case O.EDIT_DISTANCE:d=1/0;for(let g=0;g<c;g+=1){const x=l(t[g]);d>x&&(d=x),h.push(x)}break;case O.SIMILARITY:d=0;for(let g=0;g<c;g+=1){const x=l(t[g]);d<x&&(d=x),h.push(x)}break;default:throw me}const p=h.length;for(let g=0;g<p;g+=1){const x=h[g];a(x)&&x===d&&m.push(g)}break}case v.ALL_MATCHES:for(let h=0;h<c;h+=1)a(l(t[h]))&&m.push(h);break;case v.ALL_SORTED_MATCHES:{const h=[];for(let d=0;d<c;d+=1){const p=l(t[d]);a(p)&&h.push({score:p,index:d})}switch(i){case O.EDIT_DISTANCE:h.sort((d,p)=>d.score-p.score);break;case O.SIMILARITY:h.sort((d,p)=>p.score-d.score);break;default:throw me}for(const d of h)m.push(d.index);break}case v.FIRST_MATCH:for(let h=0;h<c;h+=1)if(a(l(t[h]))){m.push(h);break}break;default:throw $t}return((h,d,p)=>{switch(p){case v.ALL_CLOSEST_MATCHES:case v.ALL_MATCHES:case v.ALL_SORTED_MATCHES:return d.map(g=>h[g]);case v.FIRST_CLOSEST_MATCH:case v.FIRST_MATCH:return d.length?h[d[0]]:null;default:throw $t}})(t,m,s)}var he={exports:{}};let Kn=pe,Qn=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||Kn.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),E=(e,t,n=e)=>r=>{let s=""+r,o=s.indexOf(t,e.length);return~o?e+wt(s,t,n,o)+t:e+s+t},wt=(e,t,n,r)=>{let s=e.substring(0,r)+n,o=e.substring(r+t.length),i=o.indexOf(t);return~i?s+wt(o,t,n,i):s+o},yt=(e=Qn)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?E("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?E("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?E("\x1B[3m","\x1B[23m"):String,underline:e?E("\x1B[4m","\x1B[24m"):String,inverse:e?E("\x1B[7m","\x1B[27m"):String,hidden:e?E("\x1B[8m","\x1B[28m"):String,strikethrough:e?E("\x1B[9m","\x1B[29m"):String,black:e?E("\x1B[30m","\x1B[39m"):String,red:e?E("\x1B[31m","\x1B[39m"):String,green:e?E("\x1B[32m","\x1B[39m"):String,yellow:e?E("\x1B[33m","\x1B[39m"):String,blue:e?E("\x1B[34m","\x1B[39m"):String,magenta:e?E("\x1B[35m","\x1B[39m"):String,cyan:e?E("\x1B[36m","\x1B[39m"):String,white:e?E("\x1B[37m","\x1B[39m"):String,gray:e?E("\x1B[90m","\x1B[39m"):String,bgBlack:e?E("\x1B[40m","\x1B[49m"):String,bgRed:e?E("\x1B[41m","\x1B[49m"):String,bgGreen:e?E("\x1B[42m","\x1B[49m"):String,bgYellow:e?E("\x1B[43m","\x1B[49m"):String,bgBlue:e?E("\x1B[44m","\x1B[49m"):String,bgMagenta:e?E("\x1B[45m","\x1B[49m"):String,bgCyan:e?E("\x1B[46m","\x1B[49m"):String,bgWhite:e?E("\x1B[47m","\x1B[49m"):String});he.exports=yt(),he.exports.createColors=yt;const Xn={en:{"notFound.possibleCommands":"Possible commands: %s.","notFound.commandNotFound":'Command "%s" not found.',"notFound.didyoumean":'Did you mean "%s"?',"notFound.commandNotRegisteredNote":"NOTE: You haven't register any command yet."},"zh-CN":{"notFound.possibleCommands":"\u53EF\u80FD\u7684\u547D\u4EE4: %s\u3002","notFound.commandNotFound":'\u672A\u627E\u5230\u547D\u4EE4 "%s"\u3002',"notFound.didyoumean":'\u4F60\u662F\u4E0D\u662F\u6307 "%s"\uFF1F',"notFound.commandNotRegisteredNote":"\u63D0\u793A: \u4F60\u8FD8\u6CA1\u6709\u6CE8\u518C\u4EFB\u4F55\u547D\u4EE4\u3002"}},er=()=>P({setup:e=>{const{t,add:n}=e.i18n;return n(Xn),e.inspector({enforce:"pre",fn:(r,s)=>{const o=Object.keys(e._commands),i=!!o.length;try{s()}catch(u){if(!(u instanceof oe||u instanceof se))throw u;if(r.raw._.length===0||u instanceof se){console.error(t("core.noCommandGiven")),i&&console.error(t("notFound.possibleCommands",Fn(o,e.i18n)));return}const a=u.commandName,l=Jn(a,o);console.error(t("notFound.commandNotFound",he.exports.strikethrough(a))),i&&l?console.error(t("notFound.didyoumean",he.exports.bold(l))):i||console.error(t("notFound.commandNotRegisteredNote")),process.stderr.write(`
72
- `),process.exit(2)}}})}}),tr={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},bt=(e,{add:t,t:n})=>(t(tr),e.length<=1?e[0]:n("utils.and",e.slice(0,-1).join(", "),e[e.length-1])),nr={en:{"strictFlags.unexpectedSingle":"Unexpected flag: %s.","strictFlags.unexpectedMore":"Unexpected flags: %s.","strictFlags.and":"%s and %s"},"zh-CN":{"strictFlags.unexpectedSingle":"\u9884\u671F\u4E4B\u5916\u7684\u6807\u5FD7: %s\u3002","strictFlags.unexpectedMore":"\u9884\u671F\u4E4B\u5916\u7684\u6807\u5FD7: %s\u3002","strictFlags.and":"%s \u548C %s"}},rr=()=>P({setup:e=>{const{add:t,t:n}=e.i18n;return t(nr),e.inspector((r,s)=>{const o=Object.keys(r.unknownFlags);if(!r.resolved||o.length===0)s();else throw o.length>1?new Error(n("strictFlags.unexpectedMore",bt(o,e.i18n))):new Error(n("strictFlags.unexpectedSingle",bt(o,e.i18n)))})}}),or=e=>e.length===0?"":e.startsWith("v")?e:`v${e}`,sr={en:{"version.commandDescription":"Show CLI version","version.notes.1":'The version string begins with a "v".'},"zh-CN":{"version.commandDescription":"\u5C55\u793A CLI \u7248\u672C","version.notes.1":'\u7248\u672C\u53F7\u5F00\u5934\u5E26\u6709 "v"\u3002'}},ir=({alias:e=["V"],command:t=!0}={})=>P({setup:n=>{const{add:r,t:s}=n.i18n;r(sr);const o=or(n._version);return t&&(n=n.command("version",s("version.commandDescription"),{notes:[s("version.notes.1")]}).on("version",()=>{process.stdout.write(o)})),n.inspector({enforce:"pre",fn:(i,u)=>{let a=!1;const l=["version",...e];for(const m of Object.keys(i.raw.mergedFlags))if(l.includes(m)){a=!0;break}a?process.stdout.write(o):u()}})}});var I={exports:{}};let ar=pe,ur=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||ar.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),S=(e,t,n=e)=>r=>{let s=""+r,o=s.indexOf(t,e.length);return~o?e+Ft(s,t,n,o)+t:e+s+t},Ft=(e,t,n,r)=>{let s=e.substring(0,r)+n,o=e.substring(r+t.length),i=o.indexOf(t);return~i?s+Ft(o,t,n,i):s+o},vt=(e=ur)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?S("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?S("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?S("\x1B[3m","\x1B[23m"):String,underline:e?S("\x1B[4m","\x1B[24m"):String,inverse:e?S("\x1B[7m","\x1B[27m"):String,hidden:e?S("\x1B[8m","\x1B[28m"):String,strikethrough:e?S("\x1B[9m","\x1B[29m"):String,black:e?S("\x1B[30m","\x1B[39m"):String,red:e?S("\x1B[31m","\x1B[39m"):String,green:e?S("\x1B[32m","\x1B[39m"):String,yellow:e?S("\x1B[33m","\x1B[39m"):String,blue:e?S("\x1B[34m","\x1B[39m"):String,magenta:e?S("\x1B[35m","\x1B[39m"):String,cyan:e?S("\x1B[36m","\x1B[39m"):String,white:e?S("\x1B[37m","\x1B[39m"):String,gray:e?S("\x1B[90m","\x1B[39m"):String,bgBlack:e?S("\x1B[40m","\x1B[49m"):String,bgRed:e?S("\x1B[41m","\x1B[49m"):String,bgGreen:e?S("\x1B[42m","\x1B[49m"):String,bgYellow:e?S("\x1B[43m","\x1B[49m"):String,bgBlue:e?S("\x1B[44m","\x1B[49m"):String,bgMagenta:e?S("\x1B[45m","\x1B[49m"):String,bgCyan:e?S("\x1B[46m","\x1B[49m"):String,bgWhite:e?S("\x1B[47m","\x1B[49m"):String});I.exports=vt(),I.exports.createColors=vt;function lr(e){return e.split(`
73
- `).splice(1).map(t=>t.trim().replace("file://",""))}function cr(e){return`
74
- ${lr(e).map(t=>` ${t.replace(/^at ([\s\S]+) \((.+)\)/,(n,r,s)=>I.exports.gray(`at ${r} (${I.exports.cyan(s)})`))}`).join(`
75
- `)}`}function mr(e){return e.map(t=>typeof(t==null?void 0:t.stack)=="string"?`${t.message}
76
- ${cr(t.stack)}`:t)}function hr(e,t){const n=e.toUpperCase(),r=I.exports[t];return I.exports.bold(I.exports.inverse(r(` ${n} `)))}function ee(e,t,n){const r=I.exports[t],s=n!=null&&n.textColor?I.exports[n.textColor]:r,o=(n==null?void 0:n.target)||console.log;return(...i)=>{const u=mr(i);o(`${hr(e,t)} ${s(u.join(" "))}
77
- `)}}ee("log","gray"),ee("info","blue",{target:console.info}),ee("warn","yellow",{target:console.warn}),ee("success","green");const pr=ee("error","red",{target:console.error}),dr=()=>P({setup:e=>e.inspector({enforce:"pre",fn:(t,n)=>{try{n()}catch(r){pr(r.message),process.exit(1)}}})});export{nn as Clerc,Ie as CommandExistsError,ke as CommandNameConflictError,je as DescriptionNotSetError,Pe as InvalidCommandNameError,fe as LocaleNotCalledFirstError,Re as NameNotSetError,se as NoCommandGivenError,oe as NoSuchCommandError,C as Root,We as VersionNotSetError,hn as completionsPlugin,Ze as compose,sn as defineCommand,rn as defineHandler,on as defineInspector,P as definePlugin,Ke as detectLocale,H as formatCommandName,dr as friendlyErrorPlugin,yn as helpPlugin,qe as isInvalidName,er as notFoundPlugin,Ce as resolveArgv,Ye as resolveCommand,Ge as resolveCommandStrict,xe as resolveFlattenCommands,Ve as resolveParametersBeforeFlag,Xt as resolveRootCommands,ze as resolveSubcommandsByParent,rr as strictFlagsPlugin,ir as versionPlugin,Je as withBrackets};
70
+ `;l+=lu(P,a,e,t),l+=`
71
+ `,s(l),process.exit(1)}else C?a.raw._.length?a.called!==p&&a.name===p?s(lu(P,a,e,t)):s(Lu(P,a,a.raw._)):a.hasRootOrAlias?s(Lu(P,a,p)):s(lu(P,a,e,t)):c()}),n}}),Re={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},je=(u,{add:D,t:e})=>(D(Re),u.length<=1?u[0]:e("utils.and",u.slice(0,-1).join(", "),u[u.length-1])),M=new Uint32Array(65536),We=(u,D)=>{const e=u.length,t=D.length,r=1<<e-1;let n=-1,o=0,i=e,s=e;for(;s--;)M[u.charCodeAt(s)]|=1<<s;for(s=0;s<t;s++){let a=M[D.charCodeAt(s)];const c=a|o;a|=(a&n)+n^n,o|=~(a|n),n&=a,o&r&&i++,n&r&&i--,o=o<<1|1,n=n<<1|~(c|o),o&=c}for(s=e;s--;)M[u.charCodeAt(s)]=0;return i},Pe=(u,D)=>{const e=D.length,t=u.length,r=[],n=[],o=Math.ceil(e/32),i=Math.ceil(t/32);for(let F=0;F<o;F++)n[F]=-1,r[F]=0;let s=0;for(;s<i-1;s++){let F=0,h=-1;const d=s*32,y=Math.min(32,t)+d;for(let A=d;A<y;A++)M[u.charCodeAt(A)]|=1<<A;for(let A=0;A<e;A++){const H=M[D.charCodeAt(A)],N=n[A/32|0]>>>A&1,O=r[A/32|0]>>>A&1,ku=H|F,Iu=((H|O)&h)+h^h|H|O;let G=F|~(Iu|h),tu=h&Iu;G>>>31^N&&(n[A/32|0]^=1<<A),tu>>>31^O&&(r[A/32|0]^=1<<A),G=G<<1|N,tu=tu<<1|O,h=tu|~(ku|G),F=G&ku}for(let A=d;A<y;A++)M[u.charCodeAt(A)]=0}let a=0,c=-1;const C=s*32,l=Math.min(32,t-C)+C;for(let F=C;F<l;F++)M[u.charCodeAt(F)]|=1<<F;let m=t;for(let F=0;F<e;F++){const h=M[D.charCodeAt(F)],d=n[F/32|0]>>>F&1,y=r[F/32|0]>>>F&1,A=h|a,H=((h|y)&c)+c^c|h|y;let N=a|~(H|c),O=c&H;m+=N>>>t-1&1,m-=O>>>t-1&1,N>>>31^d&&(n[F/32|0]^=1<<F),O>>>31^y&&(r[F/32|0]^=1<<F),N=N<<1|d,O=O<<1|y,c=O|~(A|N),a=N&A}for(let F=C;F<l;F++)M[u.charCodeAt(F)]=0;return m},wD=(u,D)=>{if(u.length<D.length){const e=D;D=u,u=e}return D.length===0?u.length:u.length<=32?We(u,D):Pe(u,D)};var cu=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},He=1/0,Ue="[object Symbol]",Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ze="\\u0300-\\u036f\\ufe20-\\ufe23",Ge="\\u20d0-\\u20f0",Ze="["+ze+Ge+"]",Ve=RegExp(Ze,"g"),qe={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},Je=typeof cu=="object"&&cu&&cu.Object===Object&&cu,Ke=typeof self=="object"&&self&&self.Object===Object&&self,Qe=Je||Ke||Function("return this")();function Xe(u){return function(D){return u==null?void 0:u[D]}}var ut=Xe(qe),Dt=Object.prototype,et=Dt.toString,bD=Qe.Symbol,yD=bD?bD.prototype:void 0,vD=yD?yD.toString:void 0;function tt(u){if(typeof u=="string")return u;if(rt(u))return vD?vD.call(u):"";var D=u+"";return D=="0"&&1/u==-He?"-0":D}function nt(u){return!!u&&typeof u=="object"}function rt(u){return typeof u=="symbol"||nt(u)&&et.call(u)==Ue}function ot(u){return u==null?"":tt(u)}function st(u){return u=ot(u),u&&u.replace(Ye,ut).replace(Ve,"")}var it=st;let $,v;(function(u){u.ALL_CLOSEST_MATCHES="all-closest-matches",u.ALL_MATCHES="all-matches",u.ALL_SORTED_MATCHES="all-sorted-matches",u.FIRST_CLOSEST_MATCH="first-closest-match",u.FIRST_MATCH="first-match"})($||($={})),function(u){u.EDIT_DISTANCE="edit-distance",u.SIMILARITY="similarity"}(v||(v={}));const OD=new Error("unknown returnType"),Fu=new Error("unknown thresholdType"),_D=(u,D)=>{let e=u;return D.trimSpaces&&(e=e.trim().replace(/\s+/g," ")),D.deburr&&(e=it(e)),D.caseSensitive||(e=e.toLowerCase()),e},ND=(u,D)=>{const{matchPath:e}=D,t=((r,n)=>{const o=n.length>0?n.reduce((i,s)=>i==null?void 0:i[s],r):r;return typeof o!="string"?"":o})(u,e);return _D(t,D)};function at(u,D,e){const t=(l=>{const m={caseSensitive:!1,deburr:!0,matchPath:[],returnType:$.FIRST_CLOSEST_MATCH,thresholdType:v.SIMILARITY,trimSpaces:!0,...l};switch(m.thresholdType){case v.EDIT_DISTANCE:return{threshold:20,...m};case v.SIMILARITY:return{threshold:.4,...m};default:throw Fu}})(e),{returnType:r,threshold:n,thresholdType:o}=t,i=_D(u,t);let s,a;switch(o){case v.EDIT_DISTANCE:s=l=>l<=n,a=l=>wD(i,ND(l,t));break;case v.SIMILARITY:s=l=>l>=n,a=l=>((m,F)=>{if(!m||!F)return 0;if(m===F)return 1;const h=wD(m,F),d=Math.max(m.length,F.length);return(d-h)/d})(i,ND(l,t));break;default:throw Fu}const c=[],C=D.length;switch(r){case $.ALL_CLOSEST_MATCHES:case $.FIRST_CLOSEST_MATCH:{const l=[];let m;switch(o){case v.EDIT_DISTANCE:m=1/0;for(let h=0;h<C;h+=1){const d=a(D[h]);m>d&&(m=d),l.push(d)}break;case v.SIMILARITY:m=0;for(let h=0;h<C;h+=1){const d=a(D[h]);m<d&&(m=d),l.push(d)}break;default:throw Fu}const F=l.length;for(let h=0;h<F;h+=1){const d=l[h];s(d)&&d===m&&c.push(h)}break}case $.ALL_MATCHES:for(let l=0;l<C;l+=1)s(a(D[l]))&&c.push(l);break;case $.ALL_SORTED_MATCHES:{const l=[];for(let m=0;m<C;m+=1){const F=a(D[m]);s(F)&&l.push({score:F,index:m})}switch(o){case v.EDIT_DISTANCE:l.sort((m,F)=>m.score-F.score);break;case v.SIMILARITY:l.sort((m,F)=>F.score-m.score);break;default:throw Fu}for(const m of l)c.push(m.index);break}case $.FIRST_MATCH:for(let l=0;l<C;l+=1)if(s(a(D[l]))){c.push(l);break}break;default:throw OD}return((l,m,F)=>{switch(F){case $.ALL_CLOSEST_MATCHES:case $.ALL_MATCHES:case $.ALL_SORTED_MATCHES:return m.map(h=>l[h]);case $.FIRST_CLOSEST_MATCH:case $.FIRST_MATCH:return m.length?l[m[0]]:null;default:throw OD}})(D,c,r)}var Cu={exports:{}};let lt=mu,ct=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||lt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),g=(u,D,e=u)=>t=>{let r=""+t,n=r.indexOf(D,u.length);return~n?u+TD(r,D,e,n)+D:u+r+D},TD=(u,D,e,t)=>{let r=u.substring(0,t)+e,n=u.substring(t+D.length),o=n.indexOf(D);return~o?r+TD(n,D,e,o):r+n},MD=(u=ct)=>({isColorSupported:u,reset:u?D=>`\x1B[0m${D}\x1B[0m`:String,bold:u?g("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?g("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?g("\x1B[3m","\x1B[23m"):String,underline:u?g("\x1B[4m","\x1B[24m"):String,inverse:u?g("\x1B[7m","\x1B[27m"):String,hidden:u?g("\x1B[8m","\x1B[28m"):String,strikethrough:u?g("\x1B[9m","\x1B[29m"):String,black:u?g("\x1B[30m","\x1B[39m"):String,red:u?g("\x1B[31m","\x1B[39m"):String,green:u?g("\x1B[32m","\x1B[39m"):String,yellow:u?g("\x1B[33m","\x1B[39m"):String,blue:u?g("\x1B[34m","\x1B[39m"):String,magenta:u?g("\x1B[35m","\x1B[39m"):String,cyan:u?g("\x1B[36m","\x1B[39m"):String,white:u?g("\x1B[37m","\x1B[39m"):String,gray:u?g("\x1B[90m","\x1B[39m"):String,bgBlack:u?g("\x1B[40m","\x1B[49m"):String,bgRed:u?g("\x1B[41m","\x1B[49m"):String,bgGreen:u?g("\x1B[42m","\x1B[49m"):String,bgYellow:u?g("\x1B[43m","\x1B[49m"):String,bgBlue:u?g("\x1B[44m","\x1B[49m"):String,bgMagenta:u?g("\x1B[45m","\x1B[49m"):String,bgCyan:u?g("\x1B[46m","\x1B[49m"):String,bgWhite:u?g("\x1B[47m","\x1B[49m"):String});Cu.exports=MD(),Cu.exports.createColors=MD;const Ft={en:{"notFound.possibleCommands":"Possible commands: %s.","notFound.commandNotFound":'Command "%s" not found.',"notFound.didyoumean":'Did you mean "%s"?',"notFound.commandNotRegisteredNote":"NOTE: You haven't register any command yet."},"zh-CN":{"notFound.possibleCommands":"\u53EF\u80FD\u7684\u547D\u4EE4: %s\u3002","notFound.commandNotFound":'\u672A\u627E\u5230\u547D\u4EE4 "%s"\u3002',"notFound.didyoumean":'\u4F60\u662F\u4E0D\u662F\u6307 "%s"\uFF1F',"notFound.commandNotRegisteredNote":"\u63D0\u793A: \u4F60\u8FD8\u6CA1\u6709\u6CE8\u518C\u4EFB\u4F55\u547D\u4EE4\u3002"}},Ct=()=>W({setup:u=>{const{t:D,add:e}=u.i18n;return e(Ft),u.inspector({enforce:"pre",fn:(t,r)=>{const n=Object.keys(u._commands),o=!!n.length;try{r()}catch(i){if(!(i instanceof ou||i instanceof su))throw i;if(t.raw._.length===0||i instanceof su){console.error(D("core.noCommandGiven")),o&&console.error(D("notFound.possibleCommands",je(n,u.i18n)));return}const s=i.commandName,a=at(s,n);console.error(D("notFound.commandNotFound",Cu.exports.strikethrough(s))),o&&a?console.error(D("notFound.didyoumean",Cu.exports.bold(a))):o||console.error(D("notFound.commandNotRegisteredNote")),process.stderr.write(`
72
+ `),process.exit(2)}}})}}),mt={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},LD=(u,{add:D,t:e})=>(D(mt),u.length<=1?u[0]:e("utils.and",u.slice(0,-1).join(", "),u[u.length-1])),Et={en:{"strictFlags.unexpectedSingle":"Unexpected flag: %s.","strictFlags.unexpectedMore":"Unexpected flags: %s.","strictFlags.and":"%s and %s"},"zh-CN":{"strictFlags.unexpectedSingle":"\u9884\u671F\u4E4B\u5916\u7684\u6807\u5FD7: %s\u3002","strictFlags.unexpectedMore":"\u9884\u671F\u4E4B\u5916\u7684\u6807\u5FD7: %s\u3002","strictFlags.and":"%s \u548C %s"}},ht=()=>W({setup:u=>{const{add:D,t:e}=u.i18n;return D(Et),u.inspector((t,r)=>{const n=Object.keys(t.unknownFlags);if(!t.resolved||n.length===0)r();else throw n.length>1?new Error(e("strictFlags.unexpectedMore",LD(n,u.i18n))):new Error(e("strictFlags.unexpectedSingle",LD(n,u.i18n)))})}}),pt=u=>u.length===0?"":u.startsWith("v")?u:`v${u}`,dt={en:{"version.commandDescription":"Show CLI version","version.notes.1":'The version string begins with a "v".'},"zh-CN":{"version.commandDescription":"\u5C55\u793A CLI \u7248\u672C","version.notes.1":'\u7248\u672C\u53F7\u5F00\u5934\u5E26\u6709 "v"\u3002'}},Bt=({alias:u=["V"],command:D=!0}={})=>W({setup:e=>{const{add:t,t:r}=e.i18n;t(dt);const n=pt(e._version);return D&&(e=e.command("version",r("version.commandDescription"),{notes:[r("version.notes.1")]}).on("version",()=>{process.stdout.write(n)})),e.inspector({enforce:"pre",fn:(o,i)=>{let s=!1;const a=["version",...u];for(const c of Object.keys(o.raw.mergedFlags))if(a.includes(c)){s=!0;break}s?process.stdout.write(n):i()}})}});var L={exports:{}};let gt=mu,ft=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||gt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),f=(u,D,e=u)=>t=>{let r=""+t,n=r.indexOf(D,u.length);return~n?u+kD(r,D,e,n)+D:u+r+D},kD=(u,D,e,t)=>{let r=u.substring(0,t)+e,n=u.substring(t+D.length),o=n.indexOf(D);return~o?r+kD(n,D,e,o):r+n},ID=(u=ft)=>({isColorSupported:u,reset:u?D=>`\x1B[0m${D}\x1B[0m`:String,bold:u?f("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?f("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?f("\x1B[3m","\x1B[23m"):String,underline:u?f("\x1B[4m","\x1B[24m"):String,inverse:u?f("\x1B[7m","\x1B[27m"):String,hidden:u?f("\x1B[8m","\x1B[28m"):String,strikethrough:u?f("\x1B[9m","\x1B[29m"):String,black:u?f("\x1B[30m","\x1B[39m"):String,red:u?f("\x1B[31m","\x1B[39m"):String,green:u?f("\x1B[32m","\x1B[39m"):String,yellow:u?f("\x1B[33m","\x1B[39m"):String,blue:u?f("\x1B[34m","\x1B[39m"):String,magenta:u?f("\x1B[35m","\x1B[39m"):String,cyan:u?f("\x1B[36m","\x1B[39m"):String,white:u?f("\x1B[37m","\x1B[39m"):String,gray:u?f("\x1B[90m","\x1B[39m"):String,bgBlack:u?f("\x1B[40m","\x1B[49m"):String,bgRed:u?f("\x1B[41m","\x1B[49m"):String,bgGreen:u?f("\x1B[42m","\x1B[49m"):String,bgYellow:u?f("\x1B[43m","\x1B[49m"):String,bgBlue:u?f("\x1B[44m","\x1B[49m"):String,bgMagenta:u?f("\x1B[45m","\x1B[49m"):String,bgCyan:u?f("\x1B[46m","\x1B[49m"):String,bgWhite:u?f("\x1B[47m","\x1B[49m"):String});L.exports=ID(),L.exports.createColors=ID;function At(u){return u.split(`
73
+ `).splice(1).map(D=>D.trim().replace("file://",""))}function xt(u){return`
74
+ ${At(u).map(D=>` ${D.replace(/^at ([\s\S]+) \((.+)\)/,(e,t,r)=>L.exports.gray(`at ${t} (${L.exports.cyan(r)})`))}`).join(`
75
+ `)}`}function $t(u){return u.map(D=>typeof(D==null?void 0:D.stack)=="string"?`${D.message}
76
+ ${xt(D.stack)}`:D)}function St(u,D){const e=u.toUpperCase(),t=L.exports[D];return L.exports.bold(L.exports.inverse(t(` ${e} `)))}function eu(u,D,e){const t=L.exports[D],r=e!=null&&e.textColor?L.exports[e.textColor]:t,n=(e==null?void 0:e.target)||console.log;return(...o)=>{const i=$t(o);n(`${St(u,D)} ${r(i.join(" "))}
77
+ `)}}eu("log","gray"),eu("info","blue",{target:console.info}),eu("warn","yellow",{target:console.warn}),eu("success","green");const wt=eu("error","red",{target:console.error}),bt=()=>W({setup:u=>u.errorHandler(D=>{wt(D.message),process.exit(1)})});export{Fe as Clerc,Hu as CommandExistsError,Uu as CommandNameConflictError,zu as DescriptionNotSetError,Zu as InvalidCommandNameError,pu as LocaleNotCalledFirstError,Yu as NameNotSetError,su as NoCommandGivenError,ou as NoSuchCommandError,p as Root,Gu as VersionNotSetError,fe as completionsPlugin,uD as compose,Ee as defineCommand,Ce as defineHandler,me as defineInspector,W as definePlugin,tD as detectLocale,U as formatCommandName,bt as friendlyErrorPlugin,Ie as helpPlugin,DD as isInvalidName,Ct as notFoundPlugin,Bu as resolveArgv,Ju as resolveCommand,Ku as resolveCommandStrict,du as resolveFlattenCommands,Xu as resolveParametersBeforeFlag,ae as resolveRootCommands,Qu as resolveSubcommandsByParent,ht as strictFlagsPlugin,Bt as versionPlugin,eD as withBrackets};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clerc",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
5
5
  "description": "Clerc: The full-featured cli framework.",
6
6
  "keywords": [
@@ -47,13 +47,13 @@
47
47
  "access": "public"
48
48
  },
49
49
  "devDependencies": {
50
- "@clerc/core": "0.29.0",
51
- "@clerc/plugin-help": "0.29.0",
52
- "@clerc/plugin-friendly-error": "0.29.0",
53
- "@clerc/plugin-completions": "0.29.0",
54
- "@clerc/plugin-strict-flags": "0.29.0",
55
- "@clerc/plugin-version": "0.29.0",
56
- "@clerc/plugin-not-found": "0.29.0"
50
+ "@clerc/core": "0.30.0",
51
+ "@clerc/plugin-friendly-error": "0.30.0",
52
+ "@clerc/plugin-help": "0.30.0",
53
+ "@clerc/plugin-strict-flags": "0.30.0",
54
+ "@clerc/plugin-not-found": "0.30.0",
55
+ "@clerc/plugin-completions": "0.30.0",
56
+ "@clerc/plugin-version": "0.30.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "puild --minify",