cligr 1.0.1 → 1.0.2
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/commands/config.js +102 -0
- package/dist/commands/down.js +26 -0
- package/dist/commands/groups.js +43 -0
- package/dist/commands/ls.js +23 -0
- package/dist/commands/up.js +39 -0
- package/dist/config/loader.js +82 -0
- package/dist/config/types.js +0 -0
- package/dist/index.js +35 -35
- package/dist/process/manager.js +226 -0
- package/dist/process/pid-store.js +141 -0
- package/dist/process/template.js +53 -0
- package/package.json +2 -1
- package/src/commands/down.ts +28 -3
- package/src/commands/up.ts +5 -0
- package/src/process/manager.ts +102 -2
- package/src/process/pid-store.ts +192 -0
- package/tests/integration/commands.test.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import ee from"fs";import br from"os";import W from"path";function De(e){return typeof e>"u"||e===null}function Lr(e){return typeof e=="object"&&e!==null}function Nr(e){return Array.isArray(e)?e:De(e)?[]:[e]}function Rr(e,r){var n,o,i,t;if(r)for(t=Object.keys(r),n=0,o=t.length;n<o;n+=1)i=t[n],e[i]=r[i];return e}function Dr(e,r){var n="",o;for(o=0;o<r;o+=1)n+=e;return n}function Mr(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var $r=De,Gr=Lr,jr=Nr,Br=Dr,Yr=Mr,Hr=Rr,A={isNothing:$r,isObject:Gr,toArray:jr,repeat:Br,isNegativeZero:Yr,extend:Hr};function Me(e,r){var n="",o=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!r&&e.mark.snippet&&(n+=`
|
|
3
3
|
|
|
4
|
-
`+e.mark.snippet),o+" "+
|
|
5
|
-
`+u;for(
|
|
6
|
-
`,u+=
|
|
7
|
-
`,c=1;c<=
|
|
8
|
-
`;return u.replace(/\n$/,"")}var
|
|
9
|
-
\r`;function
|
|
10
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function
|
|
11
|
-
`,
|
|
12
|
-
`,t?1+c:c):i===
|
|
13
|
-
`);break}for(o?
|
|
14
|
-
`,t?1+c:c)):
|
|
15
|
-
`,c+1)):c===0?t&&(e.result+=" "):e.result+=
|
|
16
|
-
`,c):e.result+=
|
|
17
|
-
`,t?1+c:c),t=!0,l=!0,c=0,
|
|
18
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var
|
|
4
|
+
`+e.mark.snippet),o+" "+n):o}function H(e,r){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=r,this.message=Me(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}H.prototype=Object.create(Error.prototype);H.prototype.constructor=H;H.prototype.toString=function(r){return this.name+": "+Me(this,r)};var E=H;function oe(e,r,n,o,i){var t="",l="",u=Math.floor(i/2)-1;return o-r>u&&(t=" ... ",r=o-u+t.length),n-o>u&&(l=" ...",n=o+u-l.length),{str:t+e.slice(r,n).replace(/\t/g,"\u2192")+l,pos:o-r+t.length}}function le(e,r){return A.repeat(" ",r-e.length)+e}function Ur(e,r){if(r=Object.create(r||null),!e.buffer)return null;r.maxLength||(r.maxLength=79),typeof r.indent!="number"&&(r.indent=1),typeof r.linesBefore!="number"&&(r.linesBefore=3),typeof r.linesAfter!="number"&&(r.linesAfter=2);for(var n=/\r?\n|\r|\0/g,o=[0],i=[],t,l=-1;t=n.exec(e.buffer);)i.push(t.index),o.push(t.index+t[0].length),e.position<=t.index&&l<0&&(l=o.length-2);l<0&&(l=o.length-1);var u="",c,a,f=Math.min(e.line+r.linesAfter,i.length).toString().length,s=r.maxLength-(r.indent+f+3);for(c=1;c<=r.linesBefore&&!(l-c<0);c++)a=oe(e.buffer,o[l-c],i[l-c],e.position-(o[l]-o[l-c]),s),u=A.repeat(" ",r.indent)+le((e.line-c+1).toString(),f)+" | "+a.str+`
|
|
5
|
+
`+u;for(a=oe(e.buffer,o[l],i[l],e.position,s),u+=A.repeat(" ",r.indent)+le((e.line+1).toString(),f)+" | "+a.str+`
|
|
6
|
+
`,u+=A.repeat("-",r.indent+f+3+a.pos)+`^
|
|
7
|
+
`,c=1;c<=r.linesAfter&&!(l+c>=i.length);c++)a=oe(e.buffer,o[l+c],i[l+c],e.position-(o[l]-o[l+c]),s),u+=A.repeat(" ",r.indent)+le((e.line+c+1).toString(),f)+" | "+a.str+`
|
|
8
|
+
`;return u.replace(/\n$/,"")}var Kr=Ur,qr=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Wr=["scalar","sequence","mapping"];function Qr(e){var r={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(o){r[String(o)]=n})}),r}function Vr(e,r){if(r=r||{},Object.keys(r).forEach(function(n){if(qr.indexOf(n)===-1)throw new E('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=r,this.tag=e,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(n){return n},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=Qr(r.styleAliases||null),Wr.indexOf(this.kind)===-1)throw new E('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var w=Vr;function we(e,r){var n=[];return e[r].forEach(function(o){var i=n.length;n.forEach(function(t,l){t.tag===o.tag&&t.kind===o.kind&&t.multi===o.multi&&(i=l)}),n[i]=o}),n}function Xr(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},r,n;function o(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(r=0,n=arguments.length;r<n;r+=1)arguments[r].forEach(o);return e}function ue(e){return this.extend(e)}ue.prototype.extend=function(r){var n=[],o=[];if(r instanceof w)o.push(r);else if(Array.isArray(r))o=o.concat(r);else if(r&&(Array.isArray(r.implicit)||Array.isArray(r.explicit)))r.implicit&&(n=n.concat(r.implicit)),r.explicit&&(o=o.concat(r.explicit));else throw new E("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(t){if(!(t instanceof w))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&t.loadKind!=="scalar")throw new E("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new E("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),o.forEach(function(t){if(!(t instanceof w))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(ue.prototype);return i.implicit=(this.implicit||[]).concat(n),i.explicit=(this.explicit||[]).concat(o),i.compiledImplicit=we(i,"implicit"),i.compiledExplicit=we(i,"explicit"),i.compiledTypeMap=Xr(i.compiledImplicit,i.compiledExplicit),i};var $e=ue,Ge=new w("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),je=new w("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Be=new w("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Ye=new $e({explicit:[Ge,je,Be]});function Jr(e){if(e===null)return!0;var r=e.length;return r===1&&e==="~"||r===4&&(e==="null"||e==="Null"||e==="NULL")}function Zr(){return null}function zr(e){return e===null}var He=new w("tag:yaml.org,2002:null",{kind:"scalar",resolve:Jr,construct:Zr,predicate:zr,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function en(e){if(e===null)return!1;var r=e.length;return r===4&&(e==="true"||e==="True"||e==="TRUE")||r===5&&(e==="false"||e==="False"||e==="FALSE")}function rn(e){return e==="true"||e==="True"||e==="TRUE"}function nn(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Ue=new w("tag:yaml.org,2002:bool",{kind:"scalar",resolve:en,construct:rn,predicate:nn,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function on(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function ln(e){return 48<=e&&e<=55}function tn(e){return 48<=e&&e<=57}function un(e){if(e===null)return!1;var r=e.length,n=0,o=!1,i;if(!r)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===r)return!0;if(i=e[++n],i==="b"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;o=!0}return o&&i!=="_"}if(i==="x"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!on(e.charCodeAt(n)))return!1;o=!0}return o&&i!=="_"}if(i==="o"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!ln(e.charCodeAt(n)))return!1;o=!0}return o&&i!=="_"}}if(i==="_")return!1;for(;n<r;n++)if(i=e[n],i!=="_"){if(!tn(e.charCodeAt(n)))return!1;o=!0}return!(!o||i==="_")}function cn(e){var r=e,n=1,o;if(r.indexOf("_")!==-1&&(r=r.replace(/_/g,"")),o=r[0],(o==="-"||o==="+")&&(o==="-"&&(n=-1),r=r.slice(1),o=r[0]),r==="0")return 0;if(o==="0"){if(r[1]==="b")return n*parseInt(r.slice(2),2);if(r[1]==="x")return n*parseInt(r.slice(2),16);if(r[1]==="o")return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)}function an(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!A.isNegativeZero(e)}var Ke=new w("tag:yaml.org,2002:int",{kind:"scalar",resolve:un,construct:cn,predicate:an,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),sn=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function fn(e){return!(e===null||!sn.test(e)||e[e.length-1]==="_")}function pn(e){var r,n;return r=e.replace(/_/g,"").toLowerCase(),n=r[0]==="-"?-1:1,"+-".indexOf(r[0])>=0&&(r=r.slice(1)),r===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:r===".nan"?NaN:n*parseFloat(r,10)}var dn=/^[-+]?[0-9]+e/;function hn(e,r){var n;if(isNaN(e))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(A.isNegativeZero(e))return"-0.0";return n=e.toString(10),dn.test(n)?n.replace("e",".e"):n}function mn(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||A.isNegativeZero(e))}var qe=new w("tag:yaml.org,2002:float",{kind:"scalar",resolve:fn,construct:pn,predicate:mn,represent:hn,defaultStyle:"lowercase"}),We=Ye.extend({implicit:[He,Ue,Ke,qe]}),Qe=We,Ve=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Xe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function gn(e){return e===null?!1:Ve.exec(e)!==null||Xe.exec(e)!==null}function xn(e){var r,n,o,i,t,l,u,c=0,a=null,f,s,d;if(r=Ve.exec(e),r===null&&(r=Xe.exec(e)),r===null)throw new Error("Date resolve error");if(n=+r[1],o=+r[2]-1,i=+r[3],!r[4])return new Date(Date.UTC(n,o,i));if(t=+r[4],l=+r[5],u=+r[6],r[7]){for(c=r[7].slice(0,3);c.length<3;)c+="0";c=+c}return r[9]&&(f=+r[10],s=+(r[11]||0),a=(f*60+s)*6e4,r[9]==="-"&&(a=-a)),d=new Date(Date.UTC(n,o,i,t,l,u,c)),a&&d.setTime(d.getTime()-a),d}function vn(e){return e.toISOString()}var Je=new w("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:gn,construct:xn,instanceOf:Date,represent:vn});function yn(e){return e==="<<"||e===null}var Ze=new w("tag:yaml.org,2002:merge",{kind:"scalar",resolve:yn}),pe=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
9
|
+
\r`;function An(e){if(e===null)return!1;var r,n,o=0,i=e.length,t=pe;for(n=0;n<i;n++)if(r=t.indexOf(e.charAt(n)),!(r>64)){if(r<0)return!1;o+=6}return o%8===0}function wn(e){var r,n,o=e.replace(/[\r\n=]/g,""),i=o.length,t=pe,l=0,u=[];for(r=0;r<i;r++)r%4===0&&r&&(u.push(l>>16&255),u.push(l>>8&255),u.push(l&255)),l=l<<6|t.indexOf(o.charAt(r));return n=i%4*6,n===0?(u.push(l>>16&255),u.push(l>>8&255),u.push(l&255)):n===18?(u.push(l>>10&255),u.push(l>>2&255)):n===12&&u.push(l>>4&255),new Uint8Array(u)}function Cn(e){var r="",n=0,o,i,t=e.length,l=pe;for(o=0;o<t;o++)o%3===0&&o&&(r+=l[n>>18&63],r+=l[n>>12&63],r+=l[n>>6&63],r+=l[n&63]),n=(n<<8)+e[o];return i=t%3,i===0?(r+=l[n>>18&63],r+=l[n>>12&63],r+=l[n>>6&63],r+=l[n&63]):i===2?(r+=l[n>>10&63],r+=l[n>>4&63],r+=l[n<<2&63],r+=l[64]):i===1&&(r+=l[n>>2&63],r+=l[n<<4&63],r+=l[64],r+=l[64]),r}function En(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var ze=new w("tag:yaml.org,2002:binary",{kind:"scalar",resolve:An,construct:wn,predicate:En,represent:Cn}),Sn=Object.prototype.hasOwnProperty,bn=Object.prototype.toString;function _n(e){if(e===null)return!0;var r=[],n,o,i,t,l,u=e;for(n=0,o=u.length;n<o;n+=1){if(i=u[n],l=!1,bn.call(i)!=="[object Object]")return!1;for(t in i)if(Sn.call(i,t))if(!l)l=!0;else return!1;if(!l)return!1;if(r.indexOf(t)===-1)r.push(t);else return!1}return!0}function Tn(e){return e!==null?e:[]}var er=new w("tag:yaml.org,2002:omap",{kind:"sequence",resolve:_n,construct:Tn}),In=Object.prototype.toString;function kn(e){if(e===null)return!0;var r,n,o,i,t,l=e;for(t=new Array(l.length),r=0,n=l.length;r<n;r+=1){if(o=l[r],In.call(o)!=="[object Object]"||(i=Object.keys(o),i.length!==1))return!1;t[r]=[i[0],o[i[0]]]}return!0}function Pn(e){if(e===null)return[];var r,n,o,i,t,l=e;for(t=new Array(l.length),r=0,n=l.length;r<n;r+=1)o=l[r],i=Object.keys(o),t[r]=[i[0],o[i[0]]];return t}var rr=new w("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:kn,construct:Pn}),Fn=Object.prototype.hasOwnProperty;function On(e){if(e===null)return!0;var r,n=e;for(r in n)if(Fn.call(n,r)&&n[r]!==null)return!1;return!0}function Ln(e){return e!==null?e:{}}var nr=new w("tag:yaml.org,2002:set",{kind:"mapping",resolve:On,construct:Ln}),de=Qe.extend({implicit:[Je,Ze],explicit:[ze,er,rr,nr]}),k=Object.prototype.hasOwnProperty,Q=1,ir=2,or=3,V=4,te=1,Nn=2,Ce=3,Rn=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Dn=/[\x85\u2028\u2029]/,Mn=/[,\[\]\{\}]/,lr=/^(?:!|!!|![a-z\-]+!)$/i,tr=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ee(e){return Object.prototype.toString.call(e)}function _(e){return e===10||e===13}function O(e){return e===9||e===32}function S(e){return e===9||e===32||e===10||e===13}function D(e){return e===44||e===91||e===93||e===123||e===125}function $n(e){var r;return 48<=e&&e<=57?e-48:(r=e|32,97<=r&&r<=102?r-97+10:-1)}function Gn(e){return e===120?2:e===117?4:e===85?8:0}function jn(e){return 48<=e&&e<=57?e-48:-1}function Se(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
10
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Bn(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function ur(e,r,n){r==="__proto__"?Object.defineProperty(e,r,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[r]=n}var cr=new Array(256),ar=new Array(256);for(F=0;F<256;F++)cr[F]=Se(F)?1:0,ar[F]=Se(F);var F;function Yn(e,r){this.input=e,this.filename=r.filename||null,this.schema=r.schema||de,this.onWarning=r.onWarning||null,this.legacy=r.legacy||!1,this.json=r.json||!1,this.listener=r.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function sr(e,r){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Kr(n),new E(r,n)}function p(e,r){throw sr(e,r)}function X(e,r){e.onWarning&&e.onWarning.call(null,sr(e,r))}var be={YAML:function(r,n,o){var i,t,l;r.version!==null&&p(r,"duplication of %YAML directive"),o.length!==1&&p(r,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(o[0]),i===null&&p(r,"ill-formed argument of the YAML directive"),t=parseInt(i[1],10),l=parseInt(i[2],10),t!==1&&p(r,"unacceptable YAML version of the document"),r.version=o[0],r.checkLineBreaks=l<2,l!==1&&l!==2&&X(r,"unsupported YAML version of the document")},TAG:function(r,n,o){var i,t;o.length!==2&&p(r,"TAG directive accepts exactly two arguments"),i=o[0],t=o[1],lr.test(i)||p(r,"ill-formed tag handle (first argument) of the TAG directive"),k.call(r.tagMap,i)&&p(r,'there is a previously declared suffix for "'+i+'" tag handle'),tr.test(t)||p(r,"ill-formed tag prefix (second argument) of the TAG directive");try{t=decodeURIComponent(t)}catch{p(r,"tag prefix is malformed: "+t)}r.tagMap[i]=t}};function I(e,r,n,o){var i,t,l,u;if(r<n){if(u=e.input.slice(r,n),o)for(i=0,t=u.length;i<t;i+=1)l=u.charCodeAt(i),l===9||32<=l&&l<=1114111||p(e,"expected valid JSON character");else Rn.test(u)&&p(e,"the stream contains non-printable characters");e.result+=u}}function _e(e,r,n,o){var i,t,l,u;for(A.isObject(n)||p(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),l=0,u=i.length;l<u;l+=1)t=i[l],k.call(r,t)||(ur(r,t,n[t]),o[t]=!0)}function M(e,r,n,o,i,t,l,u,c){var a,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),a=0,f=i.length;a<f;a+=1)Array.isArray(i[a])&&p(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Ee(i[a])==="[object Object]"&&(i[a]="[object Object]");if(typeof i=="object"&&Ee(i)==="[object Object]"&&(i="[object Object]"),i=String(i),r===null&&(r={}),o==="tag:yaml.org,2002:merge")if(Array.isArray(t))for(a=0,f=t.length;a<f;a+=1)_e(e,r,t[a],n);else _e(e,r,t,n);else!e.json&&!k.call(n,i)&&k.call(r,i)&&(e.line=l||e.line,e.lineStart=u||e.lineStart,e.position=c||e.position,p(e,"duplicated mapping key")),ur(r,i,t),delete n[i];return r}function he(e){var r;r=e.input.charCodeAt(e.position),r===10?e.position++:r===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):p(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function y(e,r,n){for(var o=0,i=e.input.charCodeAt(e.position);i!==0;){for(;O(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(r&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(_(i))for(he(e),i=e.input.charCodeAt(e.position),o++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&o!==0&&e.lineIndent<n&&X(e,"deficient indentation"),o}function z(e){var r=e.position,n;return n=e.input.charCodeAt(r),!!((n===45||n===46)&&n===e.input.charCodeAt(r+1)&&n===e.input.charCodeAt(r+2)&&(r+=3,n=e.input.charCodeAt(r),n===0||S(n)))}function me(e,r){r===1?e.result+=" ":r>1&&(e.result+=A.repeat(`
|
|
11
|
+
`,r-1))}function Hn(e,r,n){var o,i,t,l,u,c,a,f,s=e.kind,d=e.result,h;if(h=e.input.charCodeAt(e.position),S(h)||D(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),S(i)||n&&D(i)))return!1;for(e.kind="scalar",e.result="",t=l=e.position,u=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),S(i)||n&&D(i))break}else if(h===35){if(o=e.input.charCodeAt(e.position-1),S(o))break}else{if(e.position===e.lineStart&&z(e)||n&&D(h))break;if(_(h))if(c=e.line,a=e.lineStart,f=e.lineIndent,y(e,!1,-1),e.lineIndent>=r){u=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=l,e.line=c,e.lineStart=a,e.lineIndent=f;break}}u&&(I(e,t,l,!1),me(e,e.line-c),t=l=e.position,u=!1),O(h)||(l=e.position+1),h=e.input.charCodeAt(++e.position)}return I(e,t,l,!1),e.result?!0:(e.kind=s,e.result=d,!1)}function Un(e,r){var n,o,i;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,o=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(I(e,o,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)o=e.position,e.position++,i=e.position;else return!0;else _(n)?(I(e,o,i,!0),me(e,y(e,!1,r)),o=i=e.position):e.position===e.lineStart&&z(e)?p(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);p(e,"unexpected end of the stream within a single quoted scalar")}function Kn(e,r){var n,o,i,t,l,u;if(u=e.input.charCodeAt(e.position),u!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=o=e.position;(u=e.input.charCodeAt(e.position))!==0;){if(u===34)return I(e,n,e.position,!0),e.position++,!0;if(u===92){if(I(e,n,e.position,!0),u=e.input.charCodeAt(++e.position),_(u))y(e,!1,r);else if(u<256&&cr[u])e.result+=ar[u],e.position++;else if((l=Gn(u))>0){for(i=l,t=0;i>0;i--)u=e.input.charCodeAt(++e.position),(l=$n(u))>=0?t=(t<<4)+l:p(e,"expected hexadecimal character");e.result+=Bn(t),e.position++}else p(e,"unknown escape sequence");n=o=e.position}else _(u)?(I(e,n,o,!0),me(e,y(e,!1,r)),n=o=e.position):e.position===e.lineStart&&z(e)?p(e,"unexpected end of the document within a double quoted scalar"):(e.position++,o=e.position)}p(e,"unexpected end of the stream within a double quoted scalar")}function qn(e,r){var n=!0,o,i,t,l=e.tag,u,c=e.anchor,a,f,s,d,h,m=Object.create(null),x,v,b,g;if(g=e.input.charCodeAt(e.position),g===91)f=93,h=!1,u=[];else if(g===123)f=125,h=!0,u={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),g=e.input.charCodeAt(++e.position);g!==0;){if(y(e,!0,r),g=e.input.charCodeAt(e.position),g===f)return e.position++,e.tag=l,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=u,!0;n?g===44&&p(e,"expected the node content, but found ','"):p(e,"missed comma between flow collection entries"),v=x=b=null,s=d=!1,g===63&&(a=e.input.charCodeAt(e.position+1),S(a)&&(s=d=!0,e.position++,y(e,!0,r))),o=e.line,i=e.lineStart,t=e.position,$(e,r,Q,!1,!0),v=e.tag,x=e.result,y(e,!0,r),g=e.input.charCodeAt(e.position),(d||e.line===o)&&g===58&&(s=!0,g=e.input.charCodeAt(++e.position),y(e,!0,r),$(e,r,Q,!1,!0),b=e.result),h?M(e,u,m,v,x,b,o,i,t):s?u.push(M(e,null,m,v,x,b,o,i,t)):u.push(x),y(e,!0,r),g=e.input.charCodeAt(e.position),g===44?(n=!0,g=e.input.charCodeAt(++e.position)):n=!1}p(e,"unexpected end of the stream within a flow collection")}function Wn(e,r){var n,o,i=te,t=!1,l=!1,u=r,c=0,a=!1,f,s;if(s=e.input.charCodeAt(e.position),s===124)o=!1;else if(s===62)o=!0;else return!1;for(e.kind="scalar",e.result="";s!==0;)if(s=e.input.charCodeAt(++e.position),s===43||s===45)te===i?i=s===43?Ce:Nn:p(e,"repeat of a chomping mode identifier");else if((f=jn(s))>=0)f===0?p(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?p(e,"repeat of an indentation width identifier"):(u=r+f-1,l=!0);else break;if(O(s)){do s=e.input.charCodeAt(++e.position);while(O(s));if(s===35)do s=e.input.charCodeAt(++e.position);while(!_(s)&&s!==0)}for(;s!==0;){for(he(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!l||e.lineIndent<u)&&s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>u&&(u=e.lineIndent),_(s)){c++;continue}if(e.lineIndent<u){i===Ce?e.result+=A.repeat(`
|
|
12
|
+
`,t?1+c:c):i===te&&t&&(e.result+=`
|
|
13
|
+
`);break}for(o?O(s)?(a=!0,e.result+=A.repeat(`
|
|
14
|
+
`,t?1+c:c)):a?(a=!1,e.result+=A.repeat(`
|
|
15
|
+
`,c+1)):c===0?t&&(e.result+=" "):e.result+=A.repeat(`
|
|
16
|
+
`,c):e.result+=A.repeat(`
|
|
17
|
+
`,t?1+c:c),t=!0,l=!0,c=0,n=e.position;!_(s)&&s!==0;)s=e.input.charCodeAt(++e.position);I(e,n,e.position,!1)}return!0}function Te(e,r){var n,o=e.tag,i=e.anchor,t=[],l,u=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=t),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,p(e,"tab characters must not be used in indentation")),!(c!==45||(l=e.input.charCodeAt(e.position+1),!S(l))));){if(u=!0,e.position++,y(e,!0,-1)&&e.lineIndent<=r){t.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,$(e,r,or,!1,!0),t.push(e.result),y(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>r)&&c!==0)p(e,"bad indentation of a sequence entry");else if(e.lineIndent<r)break}return u?(e.tag=o,e.anchor=i,e.kind="sequence",e.result=t,!0):!1}function Qn(e,r,n){var o,i,t,l,u,c,a=e.tag,f=e.anchor,s={},d=Object.create(null),h=null,m=null,x=null,v=!1,b=!1,g;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),g=e.input.charCodeAt(e.position);g!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,p(e,"tab characters must not be used in indentation")),o=e.input.charCodeAt(e.position+1),t=e.line,(g===63||g===58)&&S(o))g===63?(v&&(M(e,s,d,h,m,null,l,u,c),h=m=x=null),b=!0,v=!0,i=!0):v?(v=!1,i=!0):p(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,g=o;else{if(l=e.line,u=e.lineStart,c=e.position,!$(e,n,ir,!1,!0))break;if(e.line===t){for(g=e.input.charCodeAt(e.position);O(g);)g=e.input.charCodeAt(++e.position);if(g===58)g=e.input.charCodeAt(++e.position),S(g)||p(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(M(e,s,d,h,m,null,l,u,c),h=m=x=null),b=!0,v=!1,i=!1,h=e.tag,m=e.result;else if(b)p(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=a,e.anchor=f,!0}else if(b)p(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=a,e.anchor=f,!0}if((e.line===t||e.lineIndent>r)&&(v&&(l=e.line,u=e.lineStart,c=e.position),$(e,r,V,!0,i)&&(v?m=e.result:x=e.result),v||(M(e,s,d,h,m,x,l,u,c),h=m=x=null),y(e,!0,-1),g=e.input.charCodeAt(e.position)),(e.line===t||e.lineIndent>r)&&g!==0)p(e,"bad indentation of a mapping entry");else if(e.lineIndent<r)break}return v&&M(e,s,d,h,m,null,l,u,c),b&&(e.tag=a,e.anchor=f,e.kind="mapping",e.result=s),b}function Vn(e){var r,n=!1,o=!1,i,t,l;if(l=e.input.charCodeAt(e.position),l!==33)return!1;if(e.tag!==null&&p(e,"duplication of a tag property"),l=e.input.charCodeAt(++e.position),l===60?(n=!0,l=e.input.charCodeAt(++e.position)):l===33?(o=!0,i="!!",l=e.input.charCodeAt(++e.position)):i="!",r=e.position,n){do l=e.input.charCodeAt(++e.position);while(l!==0&&l!==62);e.position<e.length?(t=e.input.slice(r,e.position),l=e.input.charCodeAt(++e.position)):p(e,"unexpected end of the stream within a verbatim tag")}else{for(;l!==0&&!S(l);)l===33&&(o?p(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(r-1,e.position+1),lr.test(i)||p(e,"named tag handle cannot contain such characters"),o=!0,r=e.position+1)),l=e.input.charCodeAt(++e.position);t=e.input.slice(r,e.position),Mn.test(t)&&p(e,"tag suffix cannot contain flow indicator characters")}t&&!tr.test(t)&&p(e,"tag name cannot contain such characters: "+t);try{t=decodeURIComponent(t)}catch{p(e,"tag name is malformed: "+t)}return n?e.tag=t:k.call(e.tagMap,i)?e.tag=e.tagMap[i]+t:i==="!"?e.tag="!"+t:i==="!!"?e.tag="tag:yaml.org,2002:"+t:p(e,'undeclared tag handle "'+i+'"'),!0}function Xn(e){var r,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&p(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),r=e.position;n!==0&&!S(n)&&!D(n);)n=e.input.charCodeAt(++e.position);return e.position===r&&p(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(r,e.position),!0}function Jn(e){var r,n,o;if(o=e.input.charCodeAt(e.position),o!==42)return!1;for(o=e.input.charCodeAt(++e.position),r=e.position;o!==0&&!S(o)&&!D(o);)o=e.input.charCodeAt(++e.position);return e.position===r&&p(e,"name of an alias node must contain at least one character"),n=e.input.slice(r,e.position),k.call(e.anchorMap,n)||p(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],y(e,!0,-1),!0}function $(e,r,n,o,i){var t,l,u,c=1,a=!1,f=!1,s,d,h,m,x,v;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,t=l=u=V===n||or===n,o&&y(e,!0,-1)&&(a=!0,e.lineIndent>r?c=1:e.lineIndent===r?c=0:e.lineIndent<r&&(c=-1)),c===1)for(;Vn(e)||Xn(e);)y(e,!0,-1)?(a=!0,u=t,e.lineIndent>r?c=1:e.lineIndent===r?c=0:e.lineIndent<r&&(c=-1)):u=!1;if(u&&(u=a||i),(c===1||V===n)&&(Q===n||ir===n?x=r:x=r+1,v=e.position-e.lineStart,c===1?u&&(Te(e,v)||Qn(e,v,x))||qn(e,x)?f=!0:(l&&Wn(e,x)||Un(e,x)||Kn(e,x)?f=!0:Jn(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&p(e,"alias node should not have any properties")):Hn(e,x,Q===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=u&&Te(e,v))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&p(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),s=0,d=e.implicitTypes.length;s<d;s+=1)if(m=e.implicitTypes[s],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(k.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,h=e.typeMap.multi[e.kind||"fallback"],s=0,d=h.length;s<d;s+=1)if(e.tag.slice(0,h[s].tag.length)===h[s].tag){m=h[s];break}m||p(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&p(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):p(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function Zn(e){var r=e.position,n,o,i,t=!1,l;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(l=e.input.charCodeAt(e.position))!==0&&(y(e,!0,-1),l=e.input.charCodeAt(e.position),!(e.lineIndent>0||l!==37));){for(t=!0,l=e.input.charCodeAt(++e.position),n=e.position;l!==0&&!S(l);)l=e.input.charCodeAt(++e.position);for(o=e.input.slice(n,e.position),i=[],o.length<1&&p(e,"directive name must not be less than one character in length");l!==0;){for(;O(l);)l=e.input.charCodeAt(++e.position);if(l===35){do l=e.input.charCodeAt(++e.position);while(l!==0&&!_(l));break}if(_(l))break;for(n=e.position;l!==0&&!S(l);)l=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}l!==0&&he(e),k.call(be,o)?be[o](e,o,i):X(e,'unknown document directive "'+o+'"')}if(y(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,y(e,!0,-1)):t&&p(e,"directives end mark is expected"),$(e,e.lineIndent-1,V,!1,!0),y(e,!0,-1),e.checkLineBreaks&&Dn.test(e.input.slice(r,e.position))&&X(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&z(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,y(e,!0,-1));return}if(e.position<e.length-1)p(e,"end of the stream or a document separator is expected");else return}function fr(e,r){e=String(e),r=r||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
18
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Yn(e,r),o=e.indexOf("\0");for(o!==-1&&(n.position=o,p(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Zn(n);return n.documents}function zn(e,r,n){r!==null&&typeof r=="object"&&typeof n>"u"&&(n=r,r=null);var o=fr(e,n);if(typeof r!="function")return o;for(var i=0,t=o.length;i<t;i+=1)r(o[i])}function ei(e,r){var n=fr(e,r);if(n.length!==0){if(n.length===1)return n[0];throw new E("expected a single document in the stream, but found more")}}var ri=zn,ni=ei,pr={loadAll:ri,load:ni},dr=Object.prototype.toString,hr=Object.prototype.hasOwnProperty,ge=65279,ii=9,U=10,oi=13,li=32,ti=33,ui=34,ce=35,ci=37,ai=38,si=39,fi=42,mr=44,pi=45,J=58,di=61,hi=62,mi=63,gi=64,gr=91,xr=93,xi=96,vr=123,vi=124,yr=125,C={};C[0]="\\0";C[7]="\\a";C[8]="\\b";C[9]="\\t";C[10]="\\n";C[11]="\\v";C[12]="\\f";C[13]="\\r";C[27]="\\e";C[34]='\\"';C[92]="\\\\";C[133]="\\N";C[160]="\\_";C[8232]="\\L";C[8233]="\\P";var yi=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Ai=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function wi(e,r){var n,o,i,t,l,u,c;if(r===null)return{};for(n={},o=Object.keys(r),i=0,t=o.length;i<t;i+=1)l=o[i],u=String(r[l]),l.slice(0,2)==="!!"&&(l="tag:yaml.org,2002:"+l.slice(2)),c=e.compiledTypeMap.fallback[l],c&&hr.call(c.styleAliases,u)&&(u=c.styleAliases[u]),n[l]=u;return n}function Ci(e){var r,n,o;if(r=e.toString(16).toUpperCase(),e<=255)n="x",o=2;else if(e<=65535)n="u",o=4;else if(e<=4294967295)n="U",o=8;else throw new E("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+A.repeat("0",o-r.length)+r}var Ei=1,K=2;function Si(e){this.schema=e.schema||de,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=A.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=wi(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?K:Ei,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ie(e,r){for(var n=A.repeat(" ",r),o=0,i=-1,t="",l,u=e.length;o<u;)i=e.indexOf(`
|
|
19
19
|
`,o),i===-1?(l=e.slice(o),o=u):(l=e.slice(o,i+1),o=i+1),l.length&&l!==`
|
|
20
|
-
`&&(t+=
|
|
21
|
-
`+
|
|
20
|
+
`&&(t+=n),t+=l;return t}function ae(e,r){return`
|
|
21
|
+
`+A.repeat(" ",e.indent*r)}function bi(e,r){var n,o,i;for(n=0,o=e.implicitTypes.length;n<o;n+=1)if(i=e.implicitTypes[n],i.resolve(r))return!0;return!1}function Z(e){return e===li||e===ii}function q(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ge||65536<=e&&e<=1114111}function ke(e){return q(e)&&e!==ge&&e!==oi&&e!==U}function Pe(e,r,n){var o=ke(e),i=o&&!Z(e);return(n?o:o&&e!==mr&&e!==gr&&e!==xr&&e!==vr&&e!==yr)&&e!==ce&&!(r===J&&!i)||ke(r)&&!Z(r)&&e===ce||r===J&&i}function _i(e){return q(e)&&e!==ge&&!Z(e)&&e!==pi&&e!==mi&&e!==J&&e!==mr&&e!==gr&&e!==xr&&e!==vr&&e!==yr&&e!==ce&&e!==ai&&e!==fi&&e!==ti&&e!==vi&&e!==di&&e!==hi&&e!==si&&e!==ui&&e!==ci&&e!==gi&&e!==xi}function Ti(e){return!Z(e)&&e!==J}function Y(e,r){var n=e.charCodeAt(r),o;return n>=55296&&n<=56319&&r+1<e.length&&(o=e.charCodeAt(r+1),o>=56320&&o<=57343)?(n-55296)*1024+o-56320+65536:n}function Ar(e){var r=/^\n* /;return r.test(e)}var wr=1,se=2,Cr=3,Er=4,R=5;function Ii(e,r,n,o,i,t,l,u){var c,a=0,f=null,s=!1,d=!1,h=o!==-1,m=-1,x=_i(Y(e,0))&&Ti(Y(e,e.length-1));if(r||l)for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=Y(e,c),!q(a))return R;x=x&&Pe(a,f,u),f=a}else{for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=Y(e,c),a===U)s=!0,h&&(d=d||c-m-1>o&&e[m+1]!==" ",m=c);else if(!q(a))return R;x=x&&Pe(a,f,u),f=a}d=d||h&&c-m-1>o&&e[m+1]!==" "}return!s&&!d?x&&!l&&!i(e)?wr:t===K?R:se:n>9&&Ar(e)?R:l?t===K?R:se:d?Er:Cr}function ki(e,r,n,o,i){e.dump=function(){if(r.length===0)return e.quotingType===K?'""':"''";if(!e.noCompatMode&&(yi.indexOf(r)!==-1||Ai.test(r)))return e.quotingType===K?'"'+r+'"':"'"+r+"'";var t=e.indent*Math.max(1,n),l=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-t),u=o||e.flowLevel>-1&&n>=e.flowLevel;function c(a){return bi(e,a)}switch(Ii(r,u,e.indent,l,c,e.quotingType,e.forceQuotes&&!o,i)){case wr:return r;case se:return"'"+r.replace(/'/g,"''")+"'";case Cr:return"|"+Fe(r,e.indent)+Oe(Ie(r,t));case Er:return">"+Fe(r,e.indent)+Oe(Ie(Pi(r,l),t));case R:return'"'+Fi(r)+'"';default:throw new E("impossible error: invalid scalar style")}}()}function Fe(e,r){var n=Ar(e)?String(r):"",o=e[e.length-1]===`
|
|
22
22
|
`,i=o&&(e[e.length-2]===`
|
|
23
23
|
`||e===`
|
|
24
|
-
`),t=i?"+":o?"":"-";return
|
|
25
|
-
`}function
|
|
26
|
-
`?e.slice(0,-1):e}function
|
|
27
|
-
`);return
|
|
28
|
-
`||e[0]===" ",t,l;l=
|
|
29
|
-
`:"")+
|
|
24
|
+
`),t=i?"+":o?"":"-";return n+t+`
|
|
25
|
+
`}function Oe(e){return e[e.length-1]===`
|
|
26
|
+
`?e.slice(0,-1):e}function Pi(e,r){for(var n=/(\n+)([^\n]*)/g,o=function(){var a=e.indexOf(`
|
|
27
|
+
`);return a=a!==-1?a:e.length,n.lastIndex=a,Le(e.slice(0,a),r)}(),i=e[0]===`
|
|
28
|
+
`||e[0]===" ",t,l;l=n.exec(e);){var u=l[1],c=l[2];t=c[0]===" ",o+=u+(!i&&!t&&c!==""?`
|
|
29
|
+
`:"")+Le(c,r),i=t}return o}function Le(e,r){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,o,i=0,t,l=0,u=0,c="";o=n.exec(e);)u=o.index,u-i>r&&(t=l>i?l:u,c+=`
|
|
30
30
|
`+e.slice(i,t),i=t+1),l=u;return c+=`
|
|
31
|
-
`,e.length-i>
|
|
32
|
-
`+e.slice(l+1):c+=e.slice(i),c.slice(1)}function
|
|
33
|
-
`:""}var
|
|
34
|
-
- ${
|
|
35
|
-
- ${
|
|
36
|
-
Shutting down...`),process.removeListener("SIGINT",
|
|
37
|
-
Group: ${e}`),console.log(`Tool: ${
|
|
38
|
-
Items:`);for(let o of
|
|
31
|
+
`,e.length-i>r&&l>i?c+=e.slice(i,l)+`
|
|
32
|
+
`+e.slice(l+1):c+=e.slice(i),c.slice(1)}function Fi(e){for(var r="",n=0,o,i=0;i<e.length;n>=65536?i+=2:i++)n=Y(e,i),o=C[n],!o&&q(n)?(r+=e[i],n>=65536&&(r+=e[i+1])):r+=o||Ci(n);return r}function Oi(e,r,n){var o="",i=e.tag,t,l,u;for(t=0,l=n.length;t<l;t+=1)u=n[t],e.replacer&&(u=e.replacer.call(n,String(t),u)),(T(e,r,u,!1,!1)||typeof u>"u"&&T(e,r,null,!1,!1))&&(o!==""&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=i,e.dump="["+o+"]"}function Ne(e,r,n,o){var i="",t=e.tag,l,u,c;for(l=0,u=n.length;l<u;l+=1)c=n[l],e.replacer&&(c=e.replacer.call(n,String(l),c)),(T(e,r+1,c,!0,!0,!1,!0)||typeof c>"u"&&T(e,r+1,null,!0,!0,!1,!0))&&((!o||i!=="")&&(i+=ae(e,r)),e.dump&&U===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=t,e.dump=i||"[]"}function Li(e,r,n){var o="",i=e.tag,t=Object.keys(n),l,u,c,a,f;for(l=0,u=t.length;l<u;l+=1)f="",o!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=t[l],a=n[c],e.replacer&&(a=e.replacer.call(n,c,a)),T(e,r,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),T(e,r,a,!1,!1)&&(f+=e.dump,o+=f));e.tag=i,e.dump="{"+o+"}"}function Ni(e,r,n,o){var i="",t=e.tag,l=Object.keys(n),u,c,a,f,s,d;if(e.sortKeys===!0)l.sort();else if(typeof e.sortKeys=="function")l.sort(e.sortKeys);else if(e.sortKeys)throw new E("sortKeys must be a boolean or a function");for(u=0,c=l.length;u<c;u+=1)d="",(!o||i!=="")&&(d+=ae(e,r)),a=l[u],f=n[a],e.replacer&&(f=e.replacer.call(n,a,f)),T(e,r+1,a,!0,!0,!0)&&(s=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,s&&(e.dump&&U===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,s&&(d+=ae(e,r)),T(e,r+1,f,!0,s)&&(e.dump&&U===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,i+=d));e.tag=t,e.dump=i||"{}"}function Re(e,r,n){var o,i,t,l,u,c;for(i=n?e.explicitTypes:e.implicitTypes,t=0,l=i.length;t<l;t+=1)if(u=i[t],(u.instanceOf||u.predicate)&&(!u.instanceOf||typeof r=="object"&&r instanceof u.instanceOf)&&(!u.predicate||u.predicate(r))){if(n?u.multi&&u.representName?e.tag=u.representName(r):e.tag=u.tag:e.tag="?",u.represent){if(c=e.styleMap[u.tag]||u.defaultStyle,dr.call(u.represent)==="[object Function]")o=u.represent(r,c);else if(hr.call(u.represent,c))o=u.represent[c](r,c);else throw new E("!<"+u.tag+'> tag resolver accepts not "'+c+'" style');e.dump=o}return!0}return!1}function T(e,r,n,o,i,t,l){e.tag=null,e.dump=n,Re(e,n,!1)||Re(e,n,!0);var u=dr.call(e.dump),c=o,a;o&&(o=e.flowLevel<0||e.flowLevel>r);var f=u==="[object Object]"||u==="[object Array]",s,d;if(f&&(s=e.duplicates.indexOf(n),d=s!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&r>0)&&(i=!1),d&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(f&&d&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),u==="[object Object]")o&&Object.keys(e.dump).length!==0?(Ni(e,r,e.dump,i),d&&(e.dump="&ref_"+s+e.dump)):(Li(e,r,e.dump),d&&(e.dump="&ref_"+s+" "+e.dump));else if(u==="[object Array]")o&&e.dump.length!==0?(e.noArrayIndent&&!l&&r>0?Ne(e,r-1,e.dump,i):Ne(e,r,e.dump,i),d&&(e.dump="&ref_"+s+e.dump)):(Oi(e,r,e.dump),d&&(e.dump="&ref_"+s+" "+e.dump));else if(u==="[object String]")e.tag!=="?"&&ki(e,e.dump,r,t,c);else{if(u==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new E("unacceptable kind of an object to dump "+u)}e.tag!==null&&e.tag!=="?"&&(a=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?a="!"+a:a.slice(0,18)==="tag:yaml.org,2002:"?a="!!"+a.slice(18):a="!<"+a+">",e.dump=a+" "+e.dump)}return!0}function Ri(e,r){var n=[],o=[],i,t;for(fe(e,n,o),i=0,t=o.length;i<t;i+=1)r.duplicates.push(n[o[i]]);r.usedDuplicates=new Array(t)}function fe(e,r,n){var o,i,t;if(e!==null&&typeof e=="object")if(i=r.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(r.push(e),Array.isArray(e))for(i=0,t=e.length;i<t;i+=1)fe(e[i],r,n);else for(o=Object.keys(e),i=0,t=o.length;i<t;i+=1)fe(e[o[i]],r,n)}function Di(e,r){r=r||{};var n=new Si(r);n.noRefs||Ri(e,n);var o=e;return n.replacer&&(o=n.replacer.call({"":o},"",o)),T(n,0,o,!0,!0)?n.dump+`
|
|
33
|
+
`:""}var Mi=Di,$i={dump:Mi};function xe(e,r){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var Gi=w,ji=$e,Bi=Ye,Yi=We,Hi=Qe,Ui=de,Ki=pr.load,qi=pr.loadAll,Wi=$i.dump,Qi=E,Vi={binary:ze,float:qe,map:Be,null:He,pairs:rr,set:nr,timestamp:Je,bool:Ue,int:Ke,merge:Ze,omap:er,seq:je,str:Ge},Xi=xe("safeLoad","load"),Ji=xe("safeLoadAll","loadAll"),Zi=xe("safeDump","dump"),Sr={Type:Gi,Schema:ji,FAILSAFE_SCHEMA:Bi,JSON_SCHEMA:Yi,CORE_SCHEMA:Hi,DEFAULT_SCHEMA:Ui,load:Ki,loadAll:qi,dump:Wi,YAMLException:Qi,types:Vi,safeLoad:Xi,safeLoadAll:Ji,safeDump:Zi};var re=".cligr.yml",L=class extends Error{constructor(r){super(r),this.name="ConfigError"}},P=class{configPath;constructor(r){if(r)this.configPath=W.resolve(r);else{let n=W.join(br.homedir(),re),o=W.resolve(re);ee.existsSync(n)?this.configPath=n:ee.existsSync(o)?this.configPath=o:this.configPath=n}}load(){if(!ee.existsSync(this.configPath))throw new L(`Config file not found. Looking for:
|
|
34
|
+
- ${W.join(br.homedir(),re)}
|
|
35
|
+
- ${W.resolve(re)}`);let r=ee.readFileSync(this.configPath,"utf-8"),n;try{n=Sr.load(r)}catch(o){throw new L(`Invalid YAML: ${o.message}`)}return this.validate(n)}validate(r){if(!r||typeof r!="object")throw new L("Config must be an object");let n=r;if(!n.groups||typeof n.groups!="object")throw new L('Config must have a "groups" object');return n}getGroup(r){let n=this.load(),o=n.groups[r];if(!o){let l=Object.keys(n.groups).join(", ");throw new L(`Unknown group: ${r}. Available: ${l}`)}let i=null,t=null;return n.tools&&n.tools[o.tool]?(i=n.tools[o.tool].cmd,t=o.tool):(t=null,i=null),{config:o,tool:t,toolTemplate:i}}listGroups(){let r=this.load();return Object.keys(r.groups)}};var ne=class{static expand(r,n,o){let i=n.split(",").map(u=>u.trim()),t=i[0]||`item-${o}`,l=r;for(let u=i.length-1;u>=0;u--){let c=`$${u+1}`;l=l.replaceAll(c,i[u])}return{name:t,args:i,fullCmd:l}}static parseItem(r,n,o,i){if(n){let t=this.expand(n,o,i),l=n.match(/\$\d+/g)||[],u=0;for(let c of l){let a=parseInt(c.substring(1),10);a>u&&(u=a)}if(u>0&&t.args.length>u){let c=t.args.slice(u);t.fullCmd=`${t.fullCmd} ${c.join(" ")}`}return t}else{let t=o.split(",").map(c=>c.trim()),l=t[0]||`item-${i}`;!o.includes(",")&&t.length===1&&(l=t[0].split(/\s+/)[0]||`item-${i}`);let u=r?`${r} ${o}`:o;return{name:l,args:t,fullCmd:u}}}};import{spawn as eo}from"child_process";import{promises as N}from"fs";import ie from"path";import zi from"os";var G=class{pidsDir;constructor(){this.pidsDir=ie.join(zi.homedir(),".cligr","pids")}async ensureDir(){try{await N.mkdir(this.pidsDir,{recursive:!0})}catch(r){if(r.code!=="EEXIST")throw r}}getPidFilePath(r,n){return ie.join(this.pidsDir,`${r}_${n}.pid`)}async writePid(r){await this.ensureDir();let n=this.getPidFilePath(r.groupName,r.itemName);await N.writeFile(n,JSON.stringify(r,null,2),"utf-8")}async readPidsByGroup(r){await this.ensureDir();let n=[];try{let o=await N.readdir(this.pidsDir),i=`${r}_`;for(let t of o)if(t.startsWith(i)&&t.endsWith(".pid"))try{let l=await N.readFile(ie.join(this.pidsDir,t),"utf-8");n.push(JSON.parse(l))}catch{continue}}catch{return[]}return n}async readAllPids(){await this.ensureDir();let r=[];try{let n=await N.readdir(this.pidsDir);for(let o of n)if(o.endsWith(".pid"))try{let i=await N.readFile(ie.join(this.pidsDir,o),"utf-8");r.push(JSON.parse(i))}catch{continue}}catch{return[]}return r}async deletePid(r,n){let o=this.getPidFilePath(r,n);try{await N.unlink(o)}catch(i){if(i.code!=="ENOENT")throw i}}async deleteGroupPids(r){let n=await this.readPidsByGroup(r);for(let o of n)await this.deletePid(o.groupName,o.itemName)}isPidRunning(r){try{return process.kill(r,0),!0}catch{return!1}}isPidEntryValid(r){if(!this.isPidRunning(r.pid))return!1;let n=Date.now()-5*60*1e3;return r.startTime>n}async cleanupStalePids(){let r=await this.readAllPids(),n=[];for(let o of r)this.isPidEntryValid(o)||(n.push(o),await this.deletePid(o.groupName,o.itemName));return n}async getRunningGroups(){let r=await this.readAllPids(),n=new Set(r.map(o=>o.groupName));return Array.from(n)}};var ve=class{constructor(r,n,o="running"){this.item=r;this.process=n;this.status=o}},j=class{groups=new Map;restartTimestamps=new Map;maxRestarts=3;restartWindow=1e4;pidStore=new G;spawnGroup(r,n,o){if(this.groups.has(r))throw new Error(`Group ${r} is already running`);let i=[];for(let t of n){let l=this.spawnProcess(t,r,o);i.push(new ve(t,l))}this.groups.set(r,i)}spawnProcess(r,n,o){let{cmd:i,args:t}=this.parseCommand(r.fullCmd),l=eo(i,t,{stdio:["inherit","pipe","pipe"],shell:!1,windowsHide:!0});if(this.pidStore.deletePid(n,r.name).catch(()=>{}),l.pid){let u={pid:l.pid,groupName:n,itemName:r.name,startTime:Date.now(),restartPolicy:o,fullCmd:r.fullCmd};this.pidStore.writePid(u).catch(c=>{console.error(`[${r.name}] Failed to write PID file:`,c)})}return l.stdout&&l.stdout.on("data",u=>{process.stdout.write(`[${r.name}] ${u}`)}),l.stderr&&l.stderr.on("data",u=>{process.stderr.write(`[${r.name}] ${u}`)}),l.on("exit",(u,c)=>{this.handleExit(n,r,o,u,c)}),l}parseCommand(r){let n=[],o="",i=!1,t="";for(let l=0;l<r.length;l++){let u=r[l],c=r[l+1];(u==='"'||u==="'")&&!i?(i=!0,t=u):u===t&&i?(i=!1,t=""):u===" "&&!i?o&&(n.push(o),o=""):o+=u}return o&&n.push(o),{cmd:n[0]||"",args:n.slice(1)}}handleExit(r,n,o,i,t){if(o==="unless-stopped"&&t==="SIGTERM"){this.pidStore.deletePid(r,n.name).catch(()=>{});return}if(o==="no"){this.pidStore.deletePid(r,n.name).catch(()=>{});return}let l=`${r}-${n.name}`,u=Date.now(),a=(this.restartTimestamps.get(l)||[]).filter(f=>u-f<this.restartWindow);if(a.push(u),this.restartTimestamps.set(l,a),a.length>this.maxRestarts){console.error(`[${n.name}] Crash loop detected. Stopping restarts.`),this.pidStore.deletePid(r,n.name).catch(()=>{});return}setTimeout(()=>{console.log(`[${n.name}] Restarting... (exit code: ${i})`);let f=this.spawnProcess(n,r,o),s=this.groups.get(r);if(s){let d=s.find(h=>h.item.name===n.name);d&&(d.process=f)}},1e3)}killGroup(r){let n=this.groups.get(r);if(!n)return Promise.resolve();let o=n.map(i=>this.killProcess(i.process));return this.groups.delete(r),Promise.all(o).then(async()=>{await this.pidStore.deleteGroupPids(r)})}async killGroupByPid(r){let n=await this.pidStore.readPidsByGroup(r),o={killed:0,notRunning:0,errors:[]};for(let i of n){if(this.pidStore.isPidEntryValid(i))try{await this.killPid(i.pid),o.killed++}catch(t){o.errors.push(`[${i.itemName}] ${t}`)}else o.notRunning++;await this.pidStore.deletePid(i.groupName,i.itemName)}return o}killPid(r){return new Promise((n,o)=>{try{process.kill(r,"SIGTERM");let i=setTimeout(()=>{try{process.kill(r,"SIGKILL")}catch{}},5e3),t=setInterval(()=>{this.pidStore.isPidRunning(r)||(clearTimeout(i),clearInterval(t),n())},100);this.pidStore.isPidRunning(r)||(clearTimeout(i),clearInterval(t),n())}catch(i){o(i)}})}killProcess(r){return new Promise(n=>{r.kill("SIGTERM");let o=setTimeout(()=>{r.killed||r.kill("SIGKILL")},5e3);r.on("exit",()=>{clearTimeout(o),n()}),(r.killed||r.exitCode!==null)&&(clearTimeout(o),n())})}killAll(){let r=[];for(let n of this.groups.keys())r.push(this.killGroup(n));return Promise.all(r).then(()=>{})}getGroupStatus(r){let n=this.groups.get(r);return n?n.map(o=>o.status):[]}isGroupRunning(r){return this.groups.has(r)}getRunningGroups(){return Array.from(this.groups.keys())}};async function _r(e){let r=new P,n=new j,o=new G;try{await o.cleanupStalePids();let{config:i,tool:t,toolTemplate:l}=r.getGroup(e),u=i.items.map((c,a)=>ne.parseItem(t,l,c,a));return n.spawnGroup(e,u,i.restart),console.log(`Started group ${e} with ${u.length} process(es)`),console.log("Press Ctrl+C to stop..."),new Promise(c=>{let a=async()=>{console.log(`
|
|
36
|
+
Shutting down...`),process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),await n.killAll(),c(0)};process.on("SIGINT",a),process.on("SIGTERM",a)})}catch(i){if(i instanceof Error&&i.name==="ConfigError")return console.error(i.message),1;throw i}}async function Tr(e){let r=new P;try{let{config:n}=r.getGroup(e);console.log(`
|
|
37
|
+
Group: ${e}`),console.log(`Tool: ${n.tool}`),console.log(`Restart: ${n.restart}`),console.log(`
|
|
38
|
+
Items:`);for(let o of n.items)console.log(` - ${o}`);return console.log(""),0}catch(n){return console.error(n.message),1}}async function Ir(e){let n=await new j().killGroupByPid(e);if(n.killed===0&&n.notRunning===0)return console.log(`Group '${e}' is not running`),0;if(n.killed>0&&console.log(`Stopped ${n.killed} process(es) for group '${e}'`),n.notRunning>0&&console.log(`Cleaned up ${n.notRunning} stale PID file(s) for group '${e}'`),n.errors.length>0){console.error("Errors while stopping processes:");for(let o of n.errors)console.error(` ${o}`);return 1}return 0}import{spawn as ro,spawnSync as Pr}from"child_process";import B from"fs";import no from"os";import ye from"path";var kr=".cligr.yml",io=`# Cligr Configuration
|
|
39
39
|
|
|
40
40
|
groups:
|
|
41
41
|
web:
|
|
@@ -61,12 +61,12 @@ tools:
|
|
|
61
61
|
# - $1 = name (first value)
|
|
62
62
|
# - $2, $3... = additional arguments
|
|
63
63
|
# - If no tool specified, executes directly
|
|
64
|
-
`;function
|
|
64
|
+
`;function oo(){let e=process.platform;return Pr(e==="win32"?"where":"which",["code"],{stdio:"ignore"}).status===0?"code":process.env.EDITOR?process.env.EDITOR:e==="win32"?"notepad.exe":"vim"}function lo(e,r){let n=process.platform;if(Pr(n==="win32"?"where":"which",[r],{stdio:"ignore"}).status!==0&&r!==process.env.EDITOR)throw new Error(`Editor '${r}' not found.
|
|
65
65
|
Install VS Code or set EDITOR environment variable.
|
|
66
66
|
|
|
67
67
|
Example:
|
|
68
68
|
export EDITOR=vim
|
|
69
|
-
cligr config`);
|
|
69
|
+
cligr config`);ro(r,[e],{detached:!0,stdio:"ignore",shell:n==="win32"}).unref()}function to(e){let r=ye.dirname(e);B.existsSync(r)||B.mkdirSync(r,{recursive:!0}),B.writeFileSync(e,io,"utf-8")}async function Fr(){try{let e=ye.join(no.homedir(),kr),r=ye.resolve(kr),n;B.existsSync(e)?n=e:B.existsSync(r)?n=r:n=e,B.existsSync(n)||to(n);let o=oo();return lo(n,o),console.log(`Opening ${n} in ${o}...`),0}catch(e){return console.error(`Error: ${e.message}`),1}}async function Or(e){let r=new P;try{let n=r.listGroups();if(n.length===0)return 0;if(e){let o=r.load(),i=[];for(let a of n){let f=o.groups[a];i.push({name:a,tool:f.tool||"(none)",restart:f.restart||"(none)",itemCount:f.items.length})}let t=Math.max(5,...i.map(a=>a.name.length)),l=Math.max(4,...i.map(a=>a.tool.length)),u=Math.max(7,...i.map(a=>a.restart.length)),c="GROUP".padEnd(t)+" "+"TOOL".padEnd(l)+" "+"RESTART".padEnd(u)+" ITEMS";console.log(c);for(let a of i){let f=a.name.padEnd(t)+" "+a.tool.padEnd(l)+" "+a.restart.padEnd(u)+" "+String(a.itemCount);console.log(f)}}else for(let o of n)console.log(o);return 0}catch(n){return console.error(n.message),1}}async function uo(){let e=process.argv.slice(2);if(e.length===0){Ae(),process.exit(1);return}let[r,...n]=e,o,i=!1;if(r==="groups"){let l=n.findIndex(u=>u==="-v"||u==="--verbose");l!==-1&&(i=!0,n.splice(l,1))}if(o=n[0],r!=="config"&&r!=="groups"&&!o){console.error("Error: group name required"),Ae(),process.exit(1);return}let t=0;switch(r){case"config":t=await Fr();break;case"up":t=await _r(o);break;case"ls":t=await Tr(o);break;case"down":t=await Ir(o);break;case"groups":t=await Or(i);break;default:console.error(`Error: unknown command '${r}'`),Ae(),t=1}process.exit(t)}function Ae(){console.log(`
|
|
70
70
|
Usage: cligr <command> [options] [group]
|
|
71
71
|
|
|
72
72
|
Commands:
|
|
@@ -86,7 +86,7 @@ Examples:
|
|
|
86
86
|
cligr down test1
|
|
87
87
|
cligr groups
|
|
88
88
|
cligr groups -v
|
|
89
|
-
`)}
|
|
89
|
+
`)}uo().catch(e=>{console.error(e),process.exit(2)});
|
|
90
90
|
/*! Bundled license information:
|
|
91
91
|
|
|
92
92
|
js-yaml/dist/js-yaml.mjs:
|