aboutsummaryrefslogtreecommitdiff
path: root/node_modules/yargs/build
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/yargs/build')
-rw-r--r--node_modules/yargs/build/index.cjs1
-rw-r--r--node_modules/yargs/build/lib/argsert.js62
-rw-r--r--node_modules/yargs/build/lib/command.js432
-rw-r--r--node_modules/yargs/build/lib/completion-templates.js48
-rw-r--r--node_modules/yargs/build/lib/completion.js200
-rw-r--r--node_modules/yargs/build/lib/middleware.js88
-rw-r--r--node_modules/yargs/build/lib/parse-command.js32
-rw-r--r--node_modules/yargs/build/lib/typings/common-types.js9
-rw-r--r--node_modules/yargs/build/lib/typings/yargs-parser-types.js1
-rw-r--r--node_modules/yargs/build/lib/usage.js568
-rw-r--r--node_modules/yargs/build/lib/utils/apply-extends.js59
-rw-r--r--node_modules/yargs/build/lib/utils/is-promise.js5
-rw-r--r--node_modules/yargs/build/lib/utils/levenshtein.js34
-rw-r--r--node_modules/yargs/build/lib/utils/maybe-async-result.js17
-rw-r--r--node_modules/yargs/build/lib/utils/obj-filter.js10
-rw-r--r--node_modules/yargs/build/lib/utils/process-argv.js17
-rw-r--r--node_modules/yargs/build/lib/utils/set-blocking.js12
-rw-r--r--node_modules/yargs/build/lib/utils/which-module.js10
-rw-r--r--node_modules/yargs/build/lib/validation.js305
-rw-r--r--node_modules/yargs/build/lib/yargs-factory.js1483
-rw-r--r--node_modules/yargs/build/lib/yerror.js7
21 files changed, 3400 insertions, 0 deletions
diff --git a/node_modules/yargs/build/index.cjs b/node_modules/yargs/build/index.cjs
new file mode 100644
index 0000000..43a6bc7
--- /dev/null
+++ b/node_modules/yargs/build/index.cjs
@@ -0,0 +1 @@
+"use strict";var t=require("assert");class e extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace(this,e)}}let s,i=[];function n(t,o,a,h){s=h;let l={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return l;const r=/\.json|\..*rc$/.test(t.extends);let h=null;if(r)h=function(t,e){return s.path.resolve(t,e)}(o,t.extends);else try{h=require.resolve(t.extends)}catch(e){return t}!function(t){if(i.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(h),i.push(h),l=r?JSON.parse(s.readFileSync(h,"utf8")):require(t.extends),delete t.extends,l=n(l,s.path.dirname(h),a,s)}return i=[],a?r(l,t):Object.assign({},l,t)}function r(t,e){const s={};function i(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const n of Object.keys(e))i(e[n])&&i(s[n])?s[n]=r(t[n],e[n]):s[n]=e[n];return s}function o(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${t}`);const n={cmd:i.replace(s,""),demanded:[],optional:[]};return e.forEach(((t,i)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&i===e.length-1&&(r=!0),/^\[/.test(t)?n.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):n.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})})),n}const a=["first","second","third","fourth","fifth","sixth"];function h(t,s,i){try{let n=0;const[r,a,h]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,i],f=[].slice.call(a);for(;f.length&&void 0===f[f.length-1];)f.pop();const d=h||f.length;if(d<r.demanded.length)throw new e(`Not enough arguments provided. Expected ${r.demanded.length} but received ${f.length}.`);const u=r.demanded.length+r.optional.length;if(d>u)throw new e(`Too many arguments provided. Expected max ${u} but received ${d}.`);r.demanded.forEach((t=>{const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1})),r.optional.forEach((t=>{if(0===f.length)return;const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1}))}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,i){throw new e(`Invalid ${a[i]||"manyith"} argument. Expected ${s.join(" or ")} but received ${t}.`)}function f(t){return!!t&&!!t.then&&"function"==typeof t.then}function d(t,e,s,i){s.assert.notStrictEqual(t,e,i)}function u(t,e){e.assert.strictEqual(typeof t,"string")}function p(t){return Object.keys(t)}function g(t={},e=(()=>!0)){const s={};return p(t).forEach((i=>{e(i,t[i])&&(s[i]=t[i])})),s}function m(){return process.versions.electron&&!process.defaultApp?0:1}function y(){return process.argv[m()]}var b=Object.freeze({__proto__:null,hideBin:function(t){return t.slice(m()+1)},getProcessArgvBin:y});function v(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function O(t,e,s,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,s):n?n.value=s:e.set(t,s),s}class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,i=!1){if(h("<array|function> [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if("function"!=typeof t[i])throw Error("middleware must be a function");const n=t[i];n.applyBeforeValidation=e,n.global=s}Array.prototype.push.apply(this.globalMiddleware,t)}else if("function"==typeof t){const n=t;n.applyBeforeValidation=e,n.global=s,n.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const s=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((t=>{const i=[...s[e]||[],e];return!t.option||!i.includes(t.option)})),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function C(t,e,s,i){return s.reduce(((t,s)=>{if(s.applyBeforeValidation!==i)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(f(t))return t.then((t=>Promise.all([t,s(t,e)]))).then((([t,e])=>Object.assign(t,e)));{const i=s(t,e);return f(i)?i.then((e=>Object.assign(t,e))):Object.assign(t,i)}}),t)}function j(t,e,s=(t=>{throw t})){try{const s="function"==typeof t?t():t;return f(s)?s.then((t=>e(t))):e(s)}catch(t){return s(t)}}const _=/(^\*)|(^\$0)/;class M{constructor(t,e,s,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,i){"boolean"!=typeof(i=i||{}).recurse&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);const n="function"==typeof i.visit?i.visit:t=>t;i.visit=(t,e,s)=>{const i=n(t,e,s);if(i){if(this.requireCache.has(e))return i;this.requireCache.add(e),this.addHandler(i)}return i},this.shim.requireDirectory({require:e,filename:s},t,i)}addHandler(t,e,s,i,n,r){let a=[];const h=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(n);if(i=i||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...a]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(k(s))return void this.addHandler([t].concat(a),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const n=o(t);a=a.map((t=>o(t).cmd));let l=!1;const c=[n.cmd].concat(a).filter((t=>!_.test(t)||(l=!0,!1)));0===c.length&&l&&c.push("$0"),l&&(n.cmd=c[0],a=c.slice(1),t=t.replace(_,n.cmd)),a.forEach((t=>{this.aliasMap[t]=n.cmd})),!1!==e&&this.usage.command(t,e,l,a,r),this.handlers[n.cmd]={original:t,description:e,handler:i,builder:s||{},middlewares:h,deprecated:r,demanded:n.demanded,optional:n.optional},l&&(this.defaultCommand=this.handlers[n.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,i,n,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,a=e.getInternalMethods().getContext(),h=a.commands.slice(),l=!t;t&&(a.commands.push(t),a.fullCommands.push(o.original));const c=this.applyBuilderUpdateUsageAndParse(l,o,e,s.aliases,h,i,n,r);return f(c)?c.then((t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,n,t.aliases,e))):this.applyMiddlewareAndGetResult(l,o,c.innerArgv,a,n,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,i,n,r,o,a){const h=e.builder;let l=s;if(E(h)){const c=h(s.getInternalMethods().reset(i),a);if(f(c))return c.then((i=>{var a;return l=(a=i)&&"function"==typeof a.getInternalMethods?i:s,this.parseAndUpdateUsage(t,e,l,n,r,o)}))}else(function(t){return"object"==typeof t})(h)&&(l=s.getInternalMethods().reset(i),Object.keys(e.builder).forEach((t=>{l.option(t,h[t])})));return this.parseAndUpdateUsage(t,e,l,n,r,o)}parseAndUpdateUsage(t,e,s,i,n,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,n,r);return f(o)?o.then((t=>({aliases:s.parsed.aliases,innerArgv:t}))):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=_.test(e.original)?e.original.replace(_,"").trim():e.original,i=t.filter((t=>!_.test(t)));return i.push(s),`$0 ${i.join(" ")}`}applyMiddlewareAndGetResult(t,e,s,i,n,r,o){let a={};if(n)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,i,o));const h=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares);if(s=C(s,o,h,!0),!o.getInternalMethods().getHasOutput()){const e=o.getInternalMethods().runValidation(r,a,o.parsed.error,t);s=j(s,(t=>(e(t),t)))}if(e.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();const i=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(s,i,!1,!1),s=j(s=C(s,o,h,!1),(t=>{const s=e.handler(t);return f(s)?s.then((()=>t)):t})),t||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),f(s)&&!o.getInternalMethods().hasParseCallback()&&s.catch((t=>{try{o.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(i.commands.pop(),i.fullCommands.pop()),s}populatePositionals(t,e,s,i){e._=e._.slice(s.commands.length);const n=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(n.length,e._.length);n.length;){const t=n.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map((t=>""+t))),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),i),o}populatePositional(t,e,s){const i=t.cmd[0];t.variadic?s[i]=e._.splice(0).map(String):e._.length&&(s[i]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=o(t);return s.demanded.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i,e.demand[s]=!0})),s.optional.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i})),e}postProcessPositionals(t,e,s,i){const n=Object.assign({},i.getOptions());n.default=Object.assign(s.default,n.default);for(const t of Object.keys(s.alias))n.alias[t]=(n.alias[t]||[]).concat(s.alias[t]);n.array=n.array.concat(s.array),n.config={};const r=[];if(Object.keys(e).forEach((t=>{e[t].map((e=>{n.configuration["unknown-options-as-args"]&&(n.key[t]=!0),r.push(`--${t}`),r.push(e)}))})),!r.length)return;const o=Object.assign({},n.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},n,{configuration:o}));if(a.error)i.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach((t=>{s.push(...a.aliases[t])}));const n=i.getOptions().default;Object.keys(a.argv).forEach((i=>{s.includes(i)&&(e[i]||(e[i]=a.argv[i]),!Object.prototype.hasOwnProperty.call(n,i)&&Object.prototype.hasOwnProperty.call(t,i)&&Object.prototype.hasOwnProperty.call(a.argv,i)&&(Array.isArray(t[i])||Array.isArray(a.argv[i]))?t[i]=[].concat(t[i],a.argv[i]):t[i]=a.argv[i])}))}}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=_.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(E(e))return e(t,!0);k(e)||Object.keys(e).forEach((s=>{t.option(s,e[s])}))}moduleName(t){const e=function(t){if("undefined"==typeof require)return null;for(let e,s=0,i=Object.keys(require.cache);s<i.length;s++)if(e=require.cache[i[s]],e.exports===t)return e;return null}(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:s}){for(const i of[t,e,s]){if("string"==typeof i||!1===i)return i;d(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();d(t,void 0,this.shim),({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t)}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function k(t){return"object"==typeof t&&!!t.builder&&"function"==typeof t.handler}function E(t){return"function"==typeof t}function x(t){"undefined"!=typeof process&&[process.stdout,process.stderr].forEach((e=>{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)}))}function A(t){return"boolean"==typeof t}function S(t,s){const i=s.y18n.__,n={},r=[];n.failFn=function(t){r.push(t)};let o=null,a=!0;n.showHelpOnFail=function(t=!0,e){const[s,i]="string"==typeof t?[!0,t]:[t,e];return o=i,a=s,n};let h=!1;n.fail=function(s,i){const l=t.getInternalMethods().getLoggerInstance();if(!r.length){if(t.getExitProcess()&&x(!0),h||(h=!0,a&&(t.showHelp("error"),l.error()),(s||i)&&l.error(s||i),o&&((s||i)&&l.error(""),l.error(o))),i=i||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,i);throw i}for(let t=r.length-1;t>=0;--t){const e=r[t];if(A(e)){if(i)throw i;if(s)throw Error(s)}else e(s,i,n)}};let l=[],c=!1;n.usage=(t,e)=>null===t?(c=!0,l=[],n):(c=!1,l.push([t,e||""]),n),n.getUsage=()=>l,n.getUsageDisabled=()=>c,n.getPositionalGroupName=()=>i("Positionals:");let f=[];n.example=(t,e)=>{f.push([t,e||""])};let d=[];n.command=function(t,e,s,i,n=!1){s&&(d=d.map((t=>(t[2]=!1,t)))),d.push([t,e||"",s,i,n])},n.getCommands=()=>d;let u={};n.describe=function(t,e){Array.isArray(t)?t.forEach((t=>{n.describe(t,e)})):"object"==typeof t?Object.keys(t).forEach((e=>{n.describe(e,t[e])})):u[t]=e},n.getDescriptions=()=>u;let p=[];n.epilog=t=>{p.push(t)};let m,y=!1;function b(){return y||(m=function(){const t=80;return s.process.stdColumns?Math.min(t,s.process.stdColumns):t}(),y=!0),m}n.wrap=t=>{y=!0,m=t};const v="__yargsString__:";function O(t,e,i){let n=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{n=Math.max(s.stringWidth(i?`${i} ${I(t[0])}`:I(t[0]))+$(t[0]),n)})),e&&(n=Math.min(n,parseInt((.5*e).toString(),10))),n}let w;function C(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function j(t,e){let s=`[${i("default:")} `;if(void 0===t&&!e)return null;if(e)s+=e;else switch(typeof t){case"string":s+=`"${t}"`;break;case"object":s+=JSON.stringify(t);break;default:s+=t}return`${s}]`}n.deferY18nLookup=t=>v+t,n.help=function(){if(w)return w;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach((i=>{s.alias[i].forEach((r=>{u[r]&&n.describe(i,u[r]),r in e&&t.demandOption(i,e[r]),s.boolean.includes(r)&&t.boolean(i),s.count.includes(r)&&t.count(i),s.string.includes(r)&&t.string(i),s.normalize.includes(r)&&t.normalize(i),s.array.includes(r)&&t.array(i),s.number.includes(r)&&t.number(i)}))}))}();const e=t.customScriptName?t.$0:s.path.basename(t.$0),r=t.getDemandedOptions(),o=t.getDemandedCommands(),a=t.getDeprecatedOptions(),h=t.getGroups(),g=t.getOptions();let m=[];m=m.concat(Object.keys(u)),m=m.concat(Object.keys(r)),m=m.concat(Object.keys(o)),m=m.concat(Object.keys(g.default)),m=m.filter(C),m=Object.keys(m.reduce(((t,e)=>("_"!==e&&(t[e]=!0),t)),{}));const y=b(),_=s.cliui({width:y,wrap:!!y});if(!c)if(l.length)l.forEach((t=>{_.div({text:`${t[0].replace(/\$0/g,e)}`}),t[1]&&_.div({text:`${t[1]}`,padding:[1,0,0,0]})})),_.div();else if(d.length){let t=null;t=o._?`${e} <${i("command")}>\n`:`${e} [${i("command")}]\n`,_.div(`${t}`)}if(d.length>1||1===d.length&&!d[0][2]){_.div(i("Commands:"));const s=t.getInternalMethods().getContext(),n=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(d=d.sort(((t,e)=>t[0].localeCompare(e[0]))));const r=e?`${e} `:"";d.forEach((t=>{const s=`${r}${n}${t[0].replace(/^\$0 ?/,"")}`;_.span({text:s,padding:[0,2,0,2],width:O(d,y,`${e}${n}`)+4},{text:t[1]});const o=[];t[2]&&o.push(`[${i("default")}]`),t[3]&&t[3].length&&o.push(`[${i("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?o.push(`[${i("deprecated: %s",t[4])}]`):o.push(`[${i("deprecated")}]`)),o.length?_.div({text:o.join(" "),padding:[0,0,0,2],align:"right"}):_.div()})),_.div()}const M=(Object.keys(g.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);m=m.filter((e=>!t.parsed.newAliases[e]&&M.every((t=>-1===(g.alias[t]||[]).indexOf(e)))));const k=i("Options:");h[k]||(h[k]=[]),function(t,e,s,i){let n=[],r=null;Object.keys(s).forEach((t=>{n=n.concat(s[t])})),t.forEach((t=>{r=[t].concat(e[t]),r.some((t=>-1!==n.indexOf(t)))||s[i].push(t)}))}(m,g.alias,h,k);const E=t=>/^--/.test(I(t)),x=Object.keys(h).filter((t=>h[t].length>0)).map((t=>({groupName:t,normalizedKeys:h[t].filter(C).map((t=>{if(M.includes(t))return t;for(let e,s=0;void 0!==(e=M[s]);s++)if((g.alias[e]||[]).includes(t))return e;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:e})=>{const s=e.reduce(((e,s)=>(e[s]=[s].concat(g.alias[s]||[]).map((e=>t===n.getPositionalGroupName()?e:(/^[0-9]$/.test(e)?g.boolean.includes(s)?"-":"--":e.length>1?"--":"-")+e)).sort(((t,e)=>E(t)===E(e)?0:E(t)?1:-1)).join(", "),e)),{});return{groupName:t,normalizedKeys:e,switches:s}}));if(x.filter((({groupName:t})=>t!==n.getPositionalGroupName())).some((({normalizedKeys:t,switches:e})=>!t.every((t=>E(e[t])))))&&x.filter((({groupName:t})=>t!==n.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:e})=>{t.forEach((t=>{var s,i;E(e[t])&&(e[t]=(s=e[t],i="-x, ".length,P(s)?{text:s.text,indentation:s.indentation+i}:{text:s,indentation:i}))}))})),x.forEach((({groupName:t,normalizedKeys:e,switches:s})=>{_.div(t),e.forEach((t=>{const e=s[t];let o=u[t]||"",h=null;o.includes(v)&&(o=i(o.substring(v.length))),g.boolean.includes(t)&&(h=`[${i("boolean")}]`),g.count.includes(t)&&(h=`[${i("count")}]`),g.string.includes(t)&&(h=`[${i("string")}]`),g.normalize.includes(t)&&(h=`[${i("string")}]`),g.array.includes(t)&&(h=`[${i("array")}]`),g.number.includes(t)&&(h=`[${i("number")}]`);const l=[t in a?(c=a[t],"string"==typeof c?`[${i("deprecated: %s",c)}]`:`[${i("deprecated")}]`):null,h,t in r?`[${i("required")}]`:null,g.choices&&g.choices[t]?`[${i("choices:")} ${n.stringifiedValues(g.choices[t])}]`:null,j(g.default[t],g.defaultDescription[t])].filter(Boolean).join(" ");var c;_.span({text:I(e),padding:[0,2,0,2+$(e)],width:O(s,y)+4},o),l?_.div({text:l,padding:[0,0,0,2],align:"right"}):_.div()})),_.div()})),f.length&&(_.div(i("Examples:")),f.forEach((t=>{t[0]=t[0].replace(/\$0/g,e)})),f.forEach((t=>{""===t[1]?_.div({text:t[0],padding:[0,2,0,2]}):_.div({text:t[0],padding:[0,2,0,2],width:O(f,y)+4},{text:t[1]})})),_.div()),p.length>0){const t=p.map((t=>t.replace(/\$0/g,e))).join("\n");_.div(`${t}\n`)}return _.toString().replace(/\s*$/,"")},n.cacheHelpMessage=function(){w=this.help()},n.clearCachedHelpMessage=function(){w=void 0},n.hasCachedHelpMessage=function(){return!!w},n.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(n.help())},n.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):i("generated-value"),")"].join(""),n.stringifiedValues=function(t,e){let s="";const i=e||", ",n=[].concat(t);return t&&n.length?(n.forEach((t=>{s.length&&(s+=i),s+=JSON.stringify(t)})),s):s};let _=null;n.version=t=>{_=t},n.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(_)},n.reset=function(t){return o=null,h=!1,l=[],c=!1,p=[],f=[],d=[],u=g(u,(e=>!t[e])),n};const M=[];return n.freeze=function(){M.push({failMessage:o,failureOutput:h,usages:l,usageDisabled:c,epilogs:p,examples:f,commands:d,descriptions:u})},n.unfreeze=function(){const t=M.pop();t&&({failMessage:o,failureOutput:h,usages:l,usageDisabled:c,epilogs:p,examples:f,commands:d,descriptions:u}=t)},n}function P(t){return"object"==typeof t}function $(t){return P(t)?t.indentation:0}function I(t){return P(t)?t.text:t}class D{constructor(t,e,s,i){var n,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=null!==(o=(null===(n=this.shim.getEnv("SHELL"))||void 0===n?void 0:n.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,i){const n=this.command.getCommandHandlers();for(let e=0,s=t.length;e<s;++e)if(n[t[e]]&&n[t[e]].builder){const s=n[t[e]].builder;if(E(s)){const t=this.yargs.getInternalMethods().reset();return s(t,!0),t.argv}}const r=[];this.commandCompletions(r,t,s),this.optionCompletions(r,t,e,s),this.choicesCompletions(r,t,e,s),i(null,r)}commandCompletions(t,e,s){const i=this.yargs.getInternalMethods().getContext().commands;s.match(/^-/)||i[i.length-1]===s||this.previousArgHasChoices(e)||this.usage.getCommands().forEach((s=>{const i=o(s[0]).cmd;if(-1===e.indexOf(i))if(this.zshShell){const e=s[1]||"";t.push(i.replace(/:/g,"\\:")+":"+e)}else t.push(i)}))}optionCompletions(t,e,s,i){if((i.match(/^-/)||""===i&&0===t.length)&&!this.previousArgHasChoices(e)){const n=this.yargs.getOptions(),r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(n.key).forEach((o=>{const a=!!n.configuration["boolean-negation"]&&n.boolean.includes(o);r.includes(o)||this.argsContainKey(e,s,o,a)||(this.completeOptionKey(o,t,i),a&&n.default[o]&&this.completeOptionKey(`no-${o}`,t,i))}))}}choicesCompletions(t,e,s,i){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s)}}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("--")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("--"))return;const i=e.replace(/-/g,""),n=this.yargs.getOptions();return Object.keys(n.key).some((t=>t===i))&&Array.isArray(n.choices[i])?n.choices[i].filter((t=>!s||t.startsWith(s))):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s,i){if(-1!==t.indexOf(`--${s}`))return!0;if(i&&-1!==t.indexOf(`--no-${s}`))return!0;if(this.aliases)for(const t of this.aliases[s])if(void 0!==e[t])return!0;return!1}completeOptionKey(t,e,s){const i=this.usage.getDescriptions(),n=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";if(this.zshShell){const s=i[t]||"";e.push(n+`${t.replace(/:/g,"\\:")}:${s.replace("__yargsString__:","")}`)}else e.push(n+t)}customCompletion(t,e,s,i){if(d(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return f(t)?t.then((t=>{this.shim.process.nextTick((()=>{i(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{i(t,void 0)}))})):i(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,((n=i)=>this.defaultCompletion(t,e,s,n)),(t=>{i(null,t)})):this.customCompletionFunction(s,e,(t=>{i(null,t)}))}getCompletion(t,e){const s=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),n=this.customCompletionFunction?i=>this.customCompletion(t,i,s,e):i=>this.defaultCompletion(t,i,s,e);return f(i)?i.then(n):n(i)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,i),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function N(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let i,n;for(i=0;i<=e.length;i++)s[i]=[i];for(n=0;n<=t.length;n++)s[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?s[i][n]=s[i-1][n-1]:i>1&&n>1&&e.charAt(i-2)===t.charAt(n-1)&&e.charAt(i-1)===t.charAt(n-2)?s[i][n]=s[i-2][n-2]+1:s[i][n]=Math.min(s[i-1][n-1]+1,Math.min(s[i][n-1]+1,s[i-1][n]+1));return s[e.length][t.length]}const H=["$0","--","_"];var z,q,W,U,F,L,V,T,R,G,K,B,Y,J,Z,X,Q,tt,et,st,it,nt,rt,ot,at,ht,lt,ct,ft,dt,ut,pt,gt;const mt=Symbol("copyDoubleDash"),yt=Symbol("copyDoubleDash"),bt=Symbol("deleteFromParserHintObject"),vt=Symbol("emitWarning"),Ot=Symbol("freeze"),wt=Symbol("getDollarZero"),Ct=Symbol("getParserConfiguration"),jt=Symbol("guessLocale"),_t=Symbol("guessVersion"),Mt=Symbol("parsePositionalNumbers"),kt=Symbol("pkgUp"),Et=Symbol("populateParserHintArray"),xt=Symbol("populateParserHintSingleValueDictionary"),At=Symbol("populateParserHintArrayDictionary"),St=Symbol("populateParserHintDictionary"),Pt=Symbol("sanitizeKey"),$t=Symbol("setKey"),It=Symbol("unfreeze"),Dt=Symbol("validateAsync"),Nt=Symbol("getCommandInstance"),Ht=Symbol("getContext"),zt=Symbol("getHasOutput"),qt=Symbol("getLoggerInstance"),Wt=Symbol("getParseContext"),Ut=Symbol("getUsageInstance"),Ft=Symbol("getValidationInstance"),Lt=Symbol("hasParseCallback"),Vt=Symbol("postProcess"),Tt=Symbol("rebase"),Rt=Symbol("reset"),Gt=Symbol("runYargsParserAndExecuteCommands"),Kt=Symbol("runValidation"),Bt=Symbol("setHasOutput"),Yt=Symbol("kTrackManuallySetKeys");class Jt{constructor(t=[],e,s,i){this.customScriptName=!1,this.parsed=!1,z.set(this,void 0),q.set(this,void 0),W.set(this,{commands:[],fullCommands:[]}),U.set(this,null),F.set(this,null),L.set(this,"show-hidden"),V.set(this,null),T.set(this,!0),R.set(this,{}),G.set(this,!0),K.set(this,[]),B.set(this,void 0),Y.set(this,{}),J.set(this,!1),Z.set(this,null),X.set(this,void 0),Q.set(this,""),tt.set(this,void 0),et.set(this,void 0),st.set(this,{}),it.set(this,null),nt.set(this,null),rt.set(this,{}),ot.set(this,{}),at.set(this,void 0),ht.set(this,!1),lt.set(this,void 0),ct.set(this,!1),ft.set(this,!1),dt.set(this,!1),ut.set(this,void 0),pt.set(this,null),gt.set(this,void 0),O(this,lt,i,"f"),O(this,at,t,"f"),O(this,q,e,"f"),O(this,et,s,"f"),O(this,B,new w(this),"f"),this.$0=this[wt](),this[Rt](),O(this,z,v(this,z,"f"),"f"),O(this,ut,v(this,ut,"f"),"f"),O(this,gt,v(this,gt,"f"),"f"),O(this,tt,v(this,tt,"f"),"f"),v(this,tt,"f").showHiddenOpt=v(this,L,"f"),O(this,X,this[yt](),"f")}addHelpOpt(t,e){return h("[string|boolean] [string]",[t,e],arguments.length),v(this,Z,"f")&&(this[bt](v(this,Z,"f")),O(this,Z,null,"f")),!1===t&&void 0===e||(O(this,Z,"string"==typeof t?t:"help","f"),this.boolean(v(this,Z,"f")),this.describe(v(this,Z,"f"),e||v(this,ut,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(h("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:v(this,L,"f");return this.boolean(s),this.describe(s,e||v(this,ut,"f").deferY18nLookup("Show hidden options")),v(this,tt,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return h("<object|string|array> [string|array]",[t,e],arguments.length),this[At](this.alias.bind(this),"alias",t,e),this}array(t){return h("<array|string>",[t],arguments.length),this[Et]("array",t),this[Yt](t),this}boolean(t){return h("<array|string>",[t],arguments.length),this[Et]("boolean",t),this[Yt](t),this}check(t,e){return h("<function> [boolean]",[t,e],arguments.length),this.middleware(((e,s)=>j((()=>t(e,s.getOptions())),(s=>(s?("string"==typeof s||s instanceof Error)&&v(this,ut,"f").fail(s.toString(),s):v(this,ut,"f").fail(v(this,lt,"f").y18n.__("Argument check failed: %s",t.toString())),e)),(t=>(v(this,ut,"f").fail(t.message?t.message:t.toString(),t),e)))),!1,e),this}choices(t,e){return h("<object|string|array> [string|array]",[t,e],arguments.length),this[At](this.choices.bind(this),"choices",t,e),this}coerce(t,s){if(h("<object|string|array> [function]",[t,s],arguments.length),Array.isArray(t)){if(!s)throw new e("coerce callback must be provided");for(const e of t)this.coerce(e,s);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!s)throw new e("coerce callback must be provided");return v(this,tt,"f").key[t]=!0,v(this,B,"f").addCoerceMiddleware(((i,n)=>{let r;return j((()=>(r=n.getAliases(),s(i[t]))),(e=>{if(i[t]=e,r[t])for(const s of r[t])i[s]=e;return i}),(t=>{throw new e(t.message)}))}),t),this}conflicts(t,e){return h("<string|object> [string|array]",[t,e],arguments.length),v(this,gt,"f").conflicts(t,e),this}config(t="config",e,s){return h("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||v(this,ut,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{v(this,tt,"f").config[t]=s||!0})),this):(t=n(t,v(this,q,"f"),this[Ct]()["deep-merge-config"]||!1,v(this,lt,"f")),v(this,tt,"f").configObjects=(v(this,tt,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return h("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),O(this,F,t||v(this,F,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(v(this,F,"f"),e),s&&v(this,U,"f").registerFunction(s),this}command(t,e,s,i,n,r){return h("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,i,n,r],arguments.length),v(this,z,"f").addHandler(t,e,s,i,n,r),this}commands(t,e,s,i,n,r){return this.command(t,e,s,i,n,r)}commandDir(t,e){h("<string> [object]",[t,e],arguments.length);const s=v(this,et,"f")||v(this,lt,"f").require;return v(this,z,"f").addDirectory(t,s,v(this,lt,"f").getCallerFile(),e),this}count(t){return h("<array|string>",[t],arguments.length),this[Et]("count",t),this[Yt](t),this}default(t,e,s){return h("<object|string|array> [*] [string]",[t,e,s],arguments.length),s&&(u(t,v(this,lt,"f")),v(this,tt,"f").defaultDescription[t]=s),"function"==typeof e&&(u(t,v(this,lt,"f")),v(this,tt,"f").defaultDescription[t]||(v(this,tt,"f").defaultDescription[t]=v(this,ut,"f").functionDescription(e)),e=e.call()),this[xt](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,i){return h("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,i],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),v(this,tt,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:i},this}demand(t,e,s){return Array.isArray(e)?(e.forEach((t=>{d(s,!0,v(this,lt,"f")),this.demandOption(t,s)})),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(d(s,!0,v(this,lt,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach((t=>{d(s,!0,v(this,lt,"f")),this.demandOption(t,s)})):"string"==typeof s?this.demandOption(t,s):!0!==s&&void 0!==s||this.demandOption(t),this}demandOption(t,e){return h("<object|string|array> [string]",[t,e],arguments.length),this[xt](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return h("<string> [string|boolean]",[t,e],arguments.length),v(this,tt,"f").deprecatedOptions[t]=e,this}describe(t,e){return h("<object|string|array> [string]",[t,e],arguments.length),this[$t](t,!0),v(this,ut,"f").describe(t,e),this}detectLocale(t){return h("<boolean>",[t],arguments.length),O(this,T,t,"f"),this}env(t){return h("[string|boolean]",[t],arguments.length),!1===t?delete v(this,tt,"f").envPrefix:v(this,tt,"f").envPrefix=t||"",this}epilogue(t){return h("<string>",[t],arguments.length),v(this,ut,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return h("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach((t=>this.example(...t))):v(this,ut,"f").example(t,e),this}exit(t,e){O(this,J,!0,"f"),O(this,V,e,"f"),v(this,G,"f")&&v(this,lt,"f").process.exit(t)}exitProcess(t=!0){return h("[boolean]",[t],arguments.length),O(this,G,t,"f"),this}fail(t){if(h("<function|boolean>",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new e("Invalid first argument. Expected function or boolean 'false'");return v(this,ut,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return h("<array> [function]",[t,e],arguments.length),e?v(this,U,"f").getCompletion(t,e):new Promise(((e,s)=>{v(this,U,"f").getCompletion(t,((t,i)=>{t?s(t):e(i)}))}))}getDemandedOptions(){return h([],0),v(this,tt,"f").demandedOptions}getDemandedCommands(){return h([],0),v(this,tt,"f").demandedCommands}getDeprecatedOptions(){return h([],0),v(this,tt,"f").deprecatedOptions}getDetectLocale(){return v(this,T,"f")}getExitProcess(){return v(this,G,"f")}getGroups(){return Object.assign({},v(this,Y,"f"),v(this,ot,"f"))}getHelp(){if(O(this,J,!0,"f"),!v(this,ut,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Gt](v(this,at,"f"),void 0,void 0,0,!0);if(f(t))return t.then((()=>v(this,ut,"f").help()))}const t=v(this,z,"f").runDefaultBuilderOn(this);if(f(t))return t.then((()=>v(this,ut,"f").help()))}return Promise.resolve(v(this,ut,"f").help())}getOptions(){return v(this,tt,"f")}getStrict(){return v(this,ct,"f")}getStrictCommands(){return v(this,ft,"f")}getStrictOptions(){return v(this,dt,"f")}global(t,e){return h("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?v(this,tt,"f").local=v(this,tt,"f").local.filter((e=>-1===t.indexOf(e))):t.forEach((t=>{v(this,tt,"f").local.includes(t)||v(this,tt,"f").local.push(t)})),this}group(t,e){h("<string|array> <string>",[t,e],arguments.length);const s=v(this,ot,"f")[e]||v(this,Y,"f")[e];v(this,ot,"f")[e]&&delete v(this,ot,"f")[e];const i={};return v(this,Y,"f")[e]=(s||[]).concat(t).filter((t=>!i[t]&&(i[t]=!0))),this}hide(t){return h("<string>",[t],arguments.length),v(this,tt,"f").hiddenOptions.push(t),this}implies(t,e){return h("<string|object> [number|string|array]",[t,e],arguments.length),v(this,gt,"f").implies(t,e),this}locale(t){return h("[string]",[t],arguments.length),t?(O(this,T,!1,"f"),v(this,lt,"f").y18n.setLocale(t),this):(this[jt](),v(this,lt,"f").y18n.getLocale())}middleware(t,e,s){return v(this,B,"f").addMiddleware(t,!!e,s)}nargs(t,e){return h("<string|object|array> [number]",[t,e],arguments.length),this[xt](this.nargs.bind(this),"narg",t,e),this}normalize(t){return h("<array|string>",[t],arguments.length),this[Et]("normalize",t),this}number(t){return h("<array|string>",[t],arguments.length),this[Et]("number",t),this[Yt](t),this}option(t,e){if(h("<string|object> [object]",[t,e],arguments.length),"object"==typeof t)Object.keys(t).forEach((e=>{this.options(e,t[e])}));else{"object"!=typeof e&&(e={}),this[Yt](t),!v(this,pt,"f")||"version"!==t&&"version"!==(null==e?void 0:e.alias)||this[vt](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join("\n"),void 0,"versionWarning"),v(this,tt,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,"string"==typeof e.demandOption?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),void 0!==e.implies&&this.implies(t,e.implies),void 0!==e.nargs&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||"boolean"===e.type)&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||"array"===e.type)&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||"number"===e.type)&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||"string"===e.type)&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||"count"===e.type)&&this.count(t),"boolean"==typeof e.global&&this.global(t,e.global),e.defaultDescription&&(v(this,tt,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const n=e.describe||e.description||e.desc;this.describe(t,n),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,s){h("[string|array] [function|boolean|object] [function]",[t,e,s],arguments.length),this[Ot](),void 0===t&&(t=v(this,at,"f")),"object"==typeof e&&(O(this,nt,e,"f"),e=s),"function"==typeof e&&(O(this,it,e,"f"),e=!1),e||O(this,at,t,"f"),v(this,it,"f")&&O(this,G,!1,"f");const i=this[Gt](t,!!e),n=this.parsed;return v(this,U,"f").setParsed(this.parsed),f(i)?i.then((t=>(v(this,it,"f")&&v(this,it,"f").call(this,v(this,V,"f"),t,v(this,Q,"f")),t))).catch((t=>{throw v(this,it,"f")&&v(this,it,"f")(t,this.parsed.argv,v(this,Q,"f")),t})).finally((()=>{this[It](),this.parsed=n})):(v(this,it,"f")&&v(this,it,"f").call(this,v(this,V,"f"),i,v(this,Q,"f")),this[It](),this.parsed=n,i)}parseAsync(t,e,s){const i=this.parse(t,e,s);return f(i)?i:Promise.resolve(i)}parseSync(t,s,i){const n=this.parse(t,s,i);if(f(n))throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return n}parserConfiguration(t){return h("<object>",[t],arguments.length),O(this,st,t,"f"),this}pkgConf(t,e){h("<string> [string]",[t,e],arguments.length);let s=null;const i=this[kt](e||v(this,q,"f"));return i[t]&&"object"==typeof i[t]&&(s=n(i[t],e||v(this,q,"f"),this[Ct]()["deep-merge-config"]||!1,v(this,lt,"f")),v(this,tt,"f").configObjects=(v(this,tt,"f").configObjects||[]).concat(s)),this}positional(t,e){h("<string> <object>",[t,e],arguments.length);const s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=g(e,((t,e)=>!("type"===t&&!["string","number","boolean"].includes(e))&&s.includes(t)));const i=v(this,W,"f").fullCommands[v(this,W,"f").fullCommands.length-1],n=i?v(this,z,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return p(n).forEach((s=>{const i=n[s];Array.isArray(i)?-1!==i.indexOf(t)&&(e[s]=!0):i[t]&&!(s in e)&&(e[s]=i[t])})),this.group(t,v(this,ut,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return h("[boolean]",[t],arguments.length),O(this,ht,t,"f"),this}required(t,e,s){return this.demand(t,e,s)}require(t,e,s){return this.demand(t,e,s)}requiresArg(t){return h("<array|string|object> [number]",[t],arguments.length),"string"==typeof t&&v(this,tt,"f").narg[t]||this[xt](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,e){return h("[string] [string]",[t,e],arguments.length),t=t||this.$0,v(this,X,"f").log(v(this,U,"f").generateCompletionScript(t,e||v(this,F,"f")||"completion")),this}showHelp(t){if(h("[string|function]",[t],arguments.length),O(this,J,!0,"f"),!v(this,ut,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Gt](v(this,at,"f"),void 0,void 0,0,!0);if(f(e))return e.then((()=>{v(this,ut,"f").showHelp(t)})),this}const e=v(this,z,"f").runDefaultBuilderOn(this);if(f(e))return e.then((()=>{v(this,ut,"f").showHelp(t)})),this}return v(this,ut,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return h("[boolean|string] [string]",[t,e],arguments.length),v(this,ut,"f").showHelpOnFail(t,e),this}showVersion(t){return h("[string|function]",[t],arguments.length),v(this,ut,"f").showVersion(t),this}skipValidation(t){return h("<array|string>",[t],arguments.length),this[Et]("skipValidation",t),this}strict(t){return h("[boolean]",[t],arguments.length),O(this,ct,!1!==t,"f"),this}strictCommands(t){return h("[boolean]",[t],arguments.length),O(this,ft,!1!==t,"f"),this}strictOptions(t){return h("[boolean]",[t],arguments.length),O(this,dt,!1!==t,"f"),this}string(t){return h("<array|string>",[t],arguments.length),this[Et]("string",t),this[Yt](t),this}terminalWidth(){return h([],0),v(this,lt,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return h("<object>",[t],arguments.length),O(this,T,!1,"f"),v(this,lt,"f").y18n.updateLocale(t),this}usage(t,s,i,n){if(h("<string|null|undefined> [string|boolean] [function|object] [function]",[t,s,i,n],arguments.length),void 0!==s){if(d(t,null,v(this,lt,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,s,i,n);throw new e(".usage() description must start with $0 if being used as alias for .command()")}return v(this,ut,"f").usage(t),this}version(t,e,s){const i="version";if(h("[boolean|string] [string] [string]",[t,e,s],arguments.length),v(this,pt,"f")&&(this[bt](v(this,pt,"f")),v(this,ut,"f").version(void 0),O(this,pt,null,"f")),0===arguments.length)s=this[_t](),t=i;else if(1===arguments.length){if(!1===t)return this;s=t,t=i}else 2===arguments.length&&(s=e,e=void 0);return O(this,pt,"string"==typeof t?t:i,"f"),e=e||v(this,ut,"f").deferY18nLookup("Show version number"),v(this,ut,"f").version(s||void 0),this.boolean(v(this,pt,"f")),this.describe(v(this,pt,"f"),e),this}wrap(t){return h("<number|null|undefined>",[t],arguments.length),v(this,ut,"f").wrap(t),this}[(z=new WeakMap,q=new WeakMap,W=new WeakMap,U=new WeakMap,F=new WeakMap,L=new WeakMap,V=new WeakMap,T=new WeakMap,R=new WeakMap,G=new WeakMap,K=new WeakMap,B=new WeakMap,Y=new WeakMap,J=new WeakMap,Z=new WeakMap,X=new WeakMap,Q=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,at=new WeakMap,ht=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[yt](){return{log:(...t)=>{this[Lt]()||console.log(...t),O(this,J,!0,"f"),v(this,Q,"f").length&&O(this,Q,v(this,Q,"f")+"\n","f"),O(this,Q,v(this,Q,"f")+t.join(" "),"f")},error:(...t)=>{this[Lt]()||console.error(...t),O(this,J,!0,"f"),v(this,Q,"f").length&&O(this,Q,v(this,Q,"f")+"\n","f"),O(this,Q,v(this,Q,"f")+t.join(" "),"f")}}}[bt](t){p(v(this,tt,"f")).forEach((e=>{if("configObjects"===e)return;const s=v(this,tt,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]})),delete v(this,ut,"f").getDescriptions()[t]}[vt](t,e,s){v(this,R,"f")[s]||(v(this,lt,"f").process.emitWarning(t,e),v(this,R,"f")[s]=!0)}[Ot](){v(this,K,"f").push({options:v(this,tt,"f"),configObjects:v(this,tt,"f").configObjects.slice(0),exitProcess:v(this,G,"f"),groups:v(this,Y,"f"),strict:v(this,ct,"f"),strictCommands:v(this,ft,"f"),strictOptions:v(this,dt,"f"),completionCommand:v(this,F,"f"),output:v(this,Q,"f"),exitError:v(this,V,"f"),hasOutput:v(this,J,"f"),parsed:this.parsed,parseFn:v(this,it,"f"),parseContext:v(this,nt,"f")}),v(this,ut,"f").freeze(),v(this,gt,"f").freeze(),v(this,z,"f").freeze(),v(this,B,"f").freeze()}[wt](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(v(this,lt,"f").process.argv()[0])?v(this,lt,"f").process.argv().slice(1,2):v(this,lt,"f").process.argv().slice(0,1),e=t.map((t=>{const e=this[Tt](v(this,q,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.length<t.length?e:t})).join(" ").trim(),v(this,lt,"f").getEnv("_")&&v(this,lt,"f").getProcessArgvBin()===v(this,lt,"f").getEnv("_")&&(e=v(this,lt,"f").getEnv("_").replace(`${v(this,lt,"f").path.dirname(v(this,lt,"f").process.execPath())}/`,"")),e}[Ct](){return v(this,st,"f")}[jt](){if(!v(this,T,"f"))return;const t=v(this,lt,"f").getEnv("LC_ALL")||v(this,lt,"f").getEnv("LC_MESSAGES")||v(this,lt,"f").getEnv("LANG")||v(this,lt,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[_t](){return this[kt]().version||"unknown"}[Mt](t){const e=t["--"]?t["--"]:t._;for(let t,s=0;void 0!==(t=e[s]);s++)v(this,lt,"f").Parser.looksLikeNumber(t)&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))&&(e[s]=Number(t));return t}[kt](t){const e=t||"*";if(v(this,rt,"f")[e])return v(this,rt,"f")[e];let s={};try{let e=t||v(this,lt,"f").mainFilename;!t&&v(this,lt,"f").path.extname(e)&&(e=v(this,lt,"f").path.dirname(e));const i=v(this,lt,"f").findUp(e,((t,e)=>e.includes("package.json")?"package.json":void 0));d(i,void 0,v(this,lt,"f")),s=JSON.parse(v(this,lt,"f").readFileSync(i,"utf8"))}catch(t){}return v(this,rt,"f")[e]=s||{},v(this,rt,"f")[e]}[Et](t,e){(e=[].concat(e)).forEach((e=>{e=this[Pt](e),v(this,tt,"f")[t].push(e)}))}[xt](t,e,s,i){this[St](t,e,s,i,((t,e,s)=>{v(this,tt,"f")[t][e]=s}))}[At](t,e,s,i){this[St](t,e,s,i,((t,e,s)=>{v(this,tt,"f")[t][e]=(v(this,tt,"f")[t][e]||[]).concat(s)}))}[St](t,e,s,i,n){if(Array.isArray(s))s.forEach((e=>{t(e,i)}));else if((t=>"object"==typeof t)(s))for(const e of p(s))t(e,s[e]);else n(e,this[Pt](s),i)}[Pt](t){return"__proto__"===t?"___proto___":t}[$t](t,e){return this[xt](this[$t].bind(this),"key",t,e),this}[It](){var t,e,s,i,n,r,o,a,h,l,c,f;const u=v(this,K,"f").pop();let p;d(u,void 0,v(this,lt,"f")),t=this,e=this,s=this,i=this,n=this,r=this,o=this,a=this,h=this,l=this,c=this,f=this,({options:{set value(e){O(t,tt,e,"f")}}.value,configObjects:p,exitProcess:{set value(t){O(e,G,t,"f")}}.value,groups:{set value(t){O(s,Y,t,"f")}}.value,output:{set value(t){O(i,Q,t,"f")}}.value,exitError:{set value(t){O(n,V,t,"f")}}.value,hasOutput:{set value(t){O(r,J,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){O(o,ct,t,"f")}}.value,strictCommands:{set value(t){O(a,ft,t,"f")}}.value,strictOptions:{set value(t){O(h,dt,t,"f")}}.value,completionCommand:{set value(t){O(l,F,t,"f")}}.value,parseFn:{set value(t){O(c,it,t,"f")}}.value,parseContext:{set value(t){O(f,nt,t,"f")}}.value}=u),v(this,tt,"f").configObjects=p,v(this,ut,"f").unfreeze(),v(this,gt,"f").unfreeze(),v(this,z,"f").unfreeze(),v(this,B,"f").unfreeze()}[Dt](t,e){return j(e,(e=>(t(e),e)))}getInternalMethods(){return{getCommandInstance:this[Nt].bind(this),getContext:this[Ht].bind(this),getHasOutput:this[zt].bind(this),getLoggerInstance:this[qt].bind(this),getParseContext:this[Wt].bind(this),getParserConfiguration:this[Ct].bind(this),getUsageInstance:this[Ut].bind(this),getValidationInstance:this[Ft].bind(this),hasParseCallback:this[Lt].bind(this),postProcess:this[Vt].bind(this),reset:this[Rt].bind(this),runValidation:this[Kt].bind(this),runYargsParserAndExecuteCommands:this[Gt].bind(this),setHasOutput:this[Bt].bind(this)}}[Nt](){return v(this,z,"f")}[Ht](){return v(this,W,"f")}[zt](){return v(this,J,"f")}[qt](){return v(this,X,"f")}[Wt](){return v(this,nt,"f")||{}}[Ut](){return v(this,ut,"f")}[Ft](){return v(this,gt,"f")}[Lt](){return!!v(this,it,"f")}[Vt](t,e,s,i){if(s)return t;if(f(t))return t;e||(t=this[mt](t));return(this[Ct]()["parse-positional-numbers"]||void 0===this[Ct]()["parse-positional-numbers"])&&(t=this[Mt](t)),i&&(t=C(t,this,v(this,B,"f").getMiddleware(),!1)),t}[Rt](t={}){O(this,tt,v(this,tt,"f")||{},"f");const e={};e.local=v(this,tt,"f").local||[],e.configObjects=v(this,tt,"f").configObjects||[];const s={};e.local.forEach((e=>{s[e]=!0,(t[e]||[]).forEach((t=>{s[t]=!0}))})),Object.assign(v(this,ot,"f"),Object.keys(v(this,Y,"f")).reduce(((t,e)=>{const i=v(this,Y,"f")[e].filter((t=>!(t in s)));return i.length>0&&(t[e]=i),t}),{})),O(this,Y,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{e[t]=(v(this,tt,"f")[t]||[]).filter((t=>!s[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{e[t]=g(v(this,tt,"f")[t],(t=>!s[t]))})),e.envPrefix=v(this,tt,"f").envPrefix,O(this,tt,e,"f"),O(this,ut,v(this,ut,"f")?v(this,ut,"f").reset(s):S(this,v(this,lt,"f")),"f"),O(this,gt,v(this,gt,"f")?v(this,gt,"f").reset(s):function(t,e,s){const i=s.y18n.__,n=s.y18n.__n,r={nonOptionCount:function(s){const i=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;i._&&(r<i._.min||r>i._.max)&&(r<i._.min?void 0!==i._.minMsg?e.fail(i._.minMsg?i._.minMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.min.toString()):null):e.fail(n("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",r,r.toString(),i._.min.toString())):r>i._.max&&(void 0!==i._.maxMsg?e.fail(i._.maxMsg?i._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.max.toString()):null):e.fail(n("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),i._.max.toString()))))},positionalCount:function(t,s){s<t&&e.fail(n("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",s,s+"",t+""))},requiredArguments:function(t,s){let i=null;for(const e of Object.keys(s))Object.prototype.hasOwnProperty.call(t,e)&&void 0!==t[e]||(i=i||{},i[e]=s[e]);if(i){const t=[];for(const e of Object.keys(i)){const s=i[e];s&&t.indexOf(s)<0&&t.push(s)}const s=t.length?`\n${t.join("\n")}`:"";e.fail(n("Missing required argument: %s","Missing required arguments: %s",Object.keys(i).length,Object.keys(i).join(", ")+s))}},unknownArguments:function(s,i,o,a,h=!0){var l;const c=t.getInternalMethods().getCommandInstance().getCommands(),f=[],d=t.getInternalMethods().getContext();if(Object.keys(s).forEach((e=>{H.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,i)||f.push(e)})),h&&(d.commands.length>0||c.length>0||a)&&s._.slice(d.commands.length).forEach((t=>{c.includes(""+t)||f.push(""+t)})),h){const e=(null===(l=t.getDemandedCommands()._)||void 0===l?void 0:l.max)||0,i=d.commands.length+e;i<s._.length&&s._.slice(i).forEach((t=>{t=String(t),d.commands.includes(t)||f.includes(t)||f.push(t)}))}f.length&&e.fail(n("Unknown argument: %s","Unknown arguments: %s",f.length,f.join(", ")))},unknownCommands:function(s){const i=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||i.length>0)&&s._.slice(o.commands.length).forEach((t=>{i.includes(""+t)||r.push(""+t)})),r.length>0&&(e.fail(n("Unknown command: %s","Unknown commands: %s",r.length,r.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(e,s){if(!Object.prototype.hasOwnProperty.call(s,e))return!1;const i=t.parsed.newAliases;return[e,...s[e]].some((t=>!Object.prototype.hasOwnProperty.call(i,t)||!i[e]))},limitedChoices:function(s){const n=t.getOptions(),r={};if(!Object.keys(n.choices).length)return;Object.keys(s).forEach((t=>{-1===H.indexOf(t)&&Object.prototype.hasOwnProperty.call(n.choices,t)&&[].concat(s[t]).forEach((e=>{-1===n.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))}))}));const o=Object.keys(r);if(!o.length)return;let a=i("Invalid values:");o.forEach((t=>{a+=`\n ${i("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(n.choices[t]))}`})),e.fail(a)}};let o={};function a(t,e){const s=Number(e);return"number"==typeof(e=isNaN(s)?e:s)?e=t._.length>=e:e.match(/^--no-.+/)?(e=e.match(/^--no-(.+)/)[1],e=!Object.prototype.hasOwnProperty.call(t,e)):e=Object.prototype.hasOwnProperty.call(t,e),e}r.implies=function(e,i){h("<string|object> [array|number|string]",[e,i],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.implies(t,e[t])})):(t.global(e),o[e]||(o[e]=[]),Array.isArray(i)?i.forEach((t=>r.implies(e,t))):(d(i,void 0,s),o[e].push(i)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach((e=>{const i=e;(o[e]||[]).forEach((e=>{let n=i;const r=e;n=a(t,n),e=a(t,e),n&&!e&&s.push(` ${i} -> ${r}`)}))})),s.length){let t=`${i("Implications failed:")}\n`;s.forEach((e=>{t+=e})),e.fail(t)}};let l={};r.conflicts=function(e,s){h("<string|object> [array|string]",[e,s],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.conflicts(t,e[t])})):(t.global(e),l[e]||(l[e]=[]),Array.isArray(s)?s.forEach((t=>r.conflicts(e,t))):l[e].push(s))},r.getConflicting=()=>l,r.conflicting=function(n){Object.keys(n).forEach((t=>{l[t]&&l[t].forEach((s=>{s&&void 0!==n[t]&&void 0!==n[s]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,s))}))})),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach((t=>{l[t].forEach((r=>{r&&void 0!==n[s.Parser.camelCase(t)]&&void 0!==n[s.Parser.camelCase(r)]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,r))}))}))},r.recommendCommands=function(t,s){s=s.sort(((t,e)=>e.length-t.length));let n=null,r=1/0;for(let e,i=0;void 0!==(e=s[i]);i++){const s=N(t,e);s<=3&&s<r&&(r=s,n=e)}n&&e.fail(i("Did you mean %s?",n))},r.reset=function(t){return o=g(o,(e=>!t[e])),l=g(l,(e=>!t[e])),r};const c=[];return r.freeze=function(){c.push({implied:o,conflicting:l})},r.unfreeze=function(){const t=c.pop();d(t,void 0,s),({implied:o,conflicting:l}=t)},r}(this,v(this,ut,"f"),v(this,lt,"f")),"f"),O(this,z,v(this,z,"f")?v(this,z,"f").reset():function(t,e,s,i){return new M(t,e,s,i)}(v(this,ut,"f"),v(this,gt,"f"),v(this,B,"f"),v(this,lt,"f")),"f"),v(this,U,"f")||O(this,U,function(t,e,s,i){return new D(t,e,s,i)}(this,v(this,ut,"f"),v(this,z,"f"),v(this,lt,"f")),"f"),v(this,B,"f").reset(),O(this,F,null,"f"),O(this,Q,"","f"),O(this,V,null,"f"),O(this,J,!1,"f"),this.parsed=!1,this}[Tt](t,e){return v(this,lt,"f").path.relative(t,e)}[Gt](t,s,i,n=0,r=!1){let o=!!i||r;t=t||v(this,at,"f"),v(this,tt,"f").__=v(this,lt,"f").y18n.__,v(this,tt,"f").configuration=this[Ct]();const a=!!v(this,tt,"f").configuration["populate--"],h=Object.assign({},v(this,tt,"f").configuration,{"populate--":!0}),l=v(this,lt,"f").Parser.detailed(t,Object.assign({},v(this,tt,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),c=Object.assign(l.argv,v(this,nt,"f"));let d;const u=l.aliases;let p=!1,g=!1;Object.keys(c).forEach((t=>{t===v(this,Z,"f")&&c[t]?p=!0:t===v(this,pt,"f")&&c[t]&&(g=!0)})),c.$0=this.$0,this.parsed=l,0===n&&v(this,ut,"f").clearCachedHelpMessage();try{if(this[jt](),s)return this[Vt](c,a,!!i,!1);if(v(this,Z,"f")){[v(this,Z,"f")].concat(u[v(this,Z,"f")]||[]).filter((t=>t.length>1)).includes(""+c._[c._.length-1])&&(c._.pop(),p=!0)}const h=v(this,z,"f").getCommands(),m=v(this,U,"f").completionKey in c,y=p||m||r;if(c._.length){if(h.length){let t;for(let e,s=n||0;void 0!==c._[s];s++){if(e=String(c._[s]),h.includes(e)&&e!==v(this,F,"f")){const t=v(this,z,"f").runCommand(e,this,l,s+1,r,p||g||r);return this[Vt](t,a,!!i,!1)}if(!t&&e!==v(this,F,"f")){t=e;break}}!v(this,z,"f").hasDefaultCommand()&&v(this,ht,"f")&&t&&!y&&v(this,gt,"f").recommendCommands(t,h)}v(this,F,"f")&&c._.includes(v(this,F,"f"))&&!m&&(v(this,G,"f")&&x(!0),this.showCompletionScript(),this.exit(0))}if(v(this,z,"f").hasDefaultCommand()&&!y){const t=v(this,z,"f").runCommand(null,this,l,0,r,p||g||r);return this[Vt](t,a,!!i,!1)}if(m){v(this,G,"f")&&x(!0);const s=(t=[].concat(t)).slice(t.indexOf(`--${v(this,U,"f").completionKey}`)+1);return v(this,U,"f").getCompletion(s,((t,s)=>{if(t)throw new e(t.message);(s||[]).forEach((t=>{v(this,X,"f").log(t)})),this.exit(0)})),this[Vt](c,!a,!!i,!1)}if(v(this,J,"f")||(p?(v(this,G,"f")&&x(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(v(this,G,"f")&&x(!0),o=!0,v(this,ut,"f").showVersion("log"),this.exit(0))),!o&&v(this,tt,"f").skipValidation.length>0&&(o=Object.keys(c).some((t=>v(this,tt,"f").skipValidation.indexOf(t)>=0&&!0===c[t]))),!o){if(l.error)throw new e(l.error.message);if(!m){const t=this[Kt](u,{},l.error);i||(d=C(c,this,v(this,B,"f").getMiddleware(),!0)),d=this[Dt](t,null!=d?d:c),f(d)&&!i&&(d=d.then((()=>C(c,this,v(this,B,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof e))throw t;v(this,ut,"f").fail(t.message,t)}return this[Vt](null!=d?d:c,a,!!i,!0)}[Kt](t,s,i,n){const r={...this.getDemandedOptions()};return o=>{if(i)throw new e(i.message);v(this,gt,"f").nonOptionCount(o),v(this,gt,"f").requiredArguments(o,r);let a=!1;v(this,ft,"f")&&(a=v(this,gt,"f").unknownCommands(o)),v(this,ct,"f")&&!a?v(this,gt,"f").unknownArguments(o,t,s,!!n):v(this,dt,"f")&&v(this,gt,"f").unknownArguments(o,t,{},!1,!1),v(this,gt,"f").limitedChoices(o),v(this,gt,"f").implications(o),v(this,gt,"f").conflicting(o)}}[Bt](){O(this,J,!0,"f")}[Yt](t){if("string"==typeof t)v(this,tt,"f").key[t]=!0;else for(const e of t)v(this,tt,"f").key[e]=!0}}var Zt,Xt;const{readFileSync:Qt}=require("fs"),{inspect:te}=require("util"),{resolve:ee}=require("path"),se=require("y18n"),ie=require("yargs-parser");var ne,re={assert:{notStrictEqual:t.notStrictEqual,strictEqual:t.strictEqual},cliui:require("cliui"),findUp:require("escalade/sync"),getEnv:t=>process.env[t],getCallerFile:require("get-caller-file"),getProcessArgvBin:y,inspect:te,mainFilename:null!==(Xt=null===(Zt=null===require||void 0===require?void 0:require.main)||void 0===Zt?void 0:Zt.filename)&&void 0!==Xt?Xt:process.cwd(),Parser:ie,path:require("path"),process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:Qt,require:require,requireDirectory:require("require-directory"),stringWidth:require("string-width"),y18n:se({directory:ee(__dirname,"../locales"),updateFiles:!1})};const oe=(null===(ne=null===process||void 0===process?void 0:process.env)||void 0===ne?void 0:ne.YARGS_MIN_NODE_VERSION)?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version){if(Number(process.version.match(/v([^.]+)/)[1])<oe)throw Error(`yargs supports a minimum Node.js version of ${oe}. Read our version support policy: https://github.com/yargs/yargs#supported-nodejs-versions`)}const ae=require("yargs-parser");var he,le={applyExtends:n,cjsPlatformShim:re,Yargs:(he=re,(t=[],e=he.process.cwd(),s)=>{const i=new Jt(t,e,s,he);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}),argsert:h,isPromise:f,objFilter:g,parseCommand:o,Parser:ae,processArgv:b,YError:e};module.exports=le;
diff --git a/node_modules/yargs/build/lib/argsert.js b/node_modules/yargs/build/lib/argsert.js
new file mode 100644
index 0000000..be5b3aa
--- /dev/null
+++ b/node_modules/yargs/build/lib/argsert.js
@@ -0,0 +1,62 @@
+import { YError } from './yerror.js';
+import { parseCommand } from './parse-command.js';
+const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth'];
+export function argsert(arg1, arg2, arg3) {
+ function parseArgs() {
+ return typeof arg1 === 'object'
+ ? [{ demanded: [], optional: [] }, arg1, arg2]
+ : [
+ parseCommand(`cmd ${arg1}`),
+ arg2,
+ arg3,
+ ];
+ }
+ try {
+ let position = 0;
+ const [parsed, callerArguments, _length] = parseArgs();
+ const args = [].slice.call(callerArguments);
+ while (args.length && args[args.length - 1] === undefined)
+ args.pop();
+ const length = _length || args.length;
+ if (length < parsed.demanded.length) {
+ throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`);
+ }
+ const totalCommands = parsed.demanded.length + parsed.optional.length;
+ if (length > totalCommands) {
+ throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`);
+ }
+ parsed.demanded.forEach(demanded => {
+ const arg = args.shift();
+ const observedType = guessType(arg);
+ const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*');
+ if (matchingTypes.length === 0)
+ argumentTypeError(observedType, demanded.cmd, position);
+ position += 1;
+ });
+ parsed.optional.forEach(optional => {
+ if (args.length === 0)
+ return;
+ const arg = args.shift();
+ const observedType = guessType(arg);
+ const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*');
+ if (matchingTypes.length === 0)
+ argumentTypeError(observedType, optional.cmd, position);
+ position += 1;
+ });
+ }
+ catch (err) {
+ console.warn(err.stack);
+ }
+}
+function guessType(arg) {
+ if (Array.isArray(arg)) {
+ return 'array';
+ }
+ else if (arg === null) {
+ return 'null';
+ }
+ return typeof arg;
+}
+function argumentTypeError(observedType, allowedTypes, position) {
+ throw new YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`);
+}
diff --git a/node_modules/yargs/build/lib/command.js b/node_modules/yargs/build/lib/command.js
new file mode 100644
index 0000000..912a020
--- /dev/null
+++ b/node_modules/yargs/build/lib/command.js
@@ -0,0 +1,432 @@
+import { assertNotStrictEqual, } from './typings/common-types.js';
+import { isPromise } from './utils/is-promise.js';
+import { applyMiddleware, commandMiddlewareFactory, } from './middleware.js';
+import { parseCommand } from './parse-command.js';
+import { isYargsInstance, } from './yargs-factory.js';
+import { maybeAsyncResult } from './utils/maybe-async-result.js';
+import whichModule from './utils/which-module.js';
+const DEFAULT_MARKER = /(^\*)|(^\$0)/;
+export class CommandInstance {
+ constructor(usage, validation, globalMiddleware, shim) {
+ this.requireCache = new Set();
+ this.handlers = {};
+ this.aliasMap = {};
+ this.frozens = [];
+ this.shim = shim;
+ this.usage = usage;
+ this.globalMiddleware = globalMiddleware;
+ this.validation = validation;
+ }
+ addDirectory(dir, req, callerFile, opts) {
+ opts = opts || {};
+ if (typeof opts.recurse !== 'boolean')
+ opts.recurse = false;
+ if (!Array.isArray(opts.extensions))
+ opts.extensions = ['js'];
+ const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o;
+ opts.visit = (obj, joined, filename) => {
+ const visited = parentVisit(obj, joined, filename);
+ if (visited) {
+ if (this.requireCache.has(joined))
+ return visited;
+ else
+ this.requireCache.add(joined);
+ this.addHandler(visited);
+ }
+ return visited;
+ };
+ this.shim.requireDirectory({ require: req, filename: callerFile }, dir, opts);
+ }
+ addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) {
+ let aliases = [];
+ const middlewares = commandMiddlewareFactory(commandMiddleware);
+ handler = handler || (() => { });
+ if (Array.isArray(cmd)) {
+ if (isCommandAndAliases(cmd)) {
+ [cmd, ...aliases] = cmd;
+ }
+ else {
+ for (const command of cmd) {
+ this.addHandler(command);
+ }
+ }
+ }
+ else if (isCommandHandlerDefinition(cmd)) {
+ let command = Array.isArray(cmd.command) || typeof cmd.command === 'string'
+ ? cmd.command
+ : this.moduleName(cmd);
+ if (cmd.aliases)
+ command = [].concat(command).concat(cmd.aliases);
+ this.addHandler(command, this.extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
+ return;
+ }
+ else if (isCommandBuilderDefinition(builder)) {
+ this.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
+ return;
+ }
+ if (typeof cmd === 'string') {
+ const parsedCommand = parseCommand(cmd);
+ aliases = aliases.map(alias => parseCommand(alias).cmd);
+ let isDefault = false;
+ const parsedAliases = [parsedCommand.cmd].concat(aliases).filter(c => {
+ if (DEFAULT_MARKER.test(c)) {
+ isDefault = true;
+ return false;
+ }
+ return true;
+ });
+ if (parsedAliases.length === 0 && isDefault)
+ parsedAliases.push('$0');
+ if (isDefault) {
+ parsedCommand.cmd = parsedAliases[0];
+ aliases = parsedAliases.slice(1);
+ cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd);
+ }
+ aliases.forEach(alias => {
+ this.aliasMap[alias] = parsedCommand.cmd;
+ });
+ if (description !== false) {
+ this.usage.command(cmd, description, isDefault, aliases, deprecated);
+ }
+ this.handlers[parsedCommand.cmd] = {
+ original: cmd,
+ description,
+ handler,
+ builder: builder || {},
+ middlewares,
+ deprecated,
+ demanded: parsedCommand.demanded,
+ optional: parsedCommand.optional,
+ };
+ if (isDefault)
+ this.defaultCommand = this.handlers[parsedCommand.cmd];
+ }
+ }
+ getCommandHandlers() {
+ return this.handlers;
+ }
+ getCommands() {
+ return Object.keys(this.handlers).concat(Object.keys(this.aliasMap));
+ }
+ hasDefaultCommand() {
+ return !!this.defaultCommand;
+ }
+ runCommand(command, yargs, parsed, commandIndex, helpOnly, helpOrVersionSet) {
+ const commandHandler = this.handlers[command] ||
+ this.handlers[this.aliasMap[command]] ||
+ this.defaultCommand;
+ const currentContext = yargs.getInternalMethods().getContext();
+ const parentCommands = currentContext.commands.slice();
+ const isDefaultCommand = !command;
+ if (command) {
+ currentContext.commands.push(command);
+ currentContext.fullCommands.push(commandHandler.original);
+ }
+ const builderResult = this.applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, parsed.aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet);
+ return isPromise(builderResult)
+ ? builderResult.then(result => this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, result.innerArgv, currentContext, helpOnly, result.aliases, yargs))
+ : this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, builderResult.innerArgv, currentContext, helpOnly, builderResult.aliases, yargs);
+ }
+ applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet) {
+ const builder = commandHandler.builder;
+ let innerYargs = yargs;
+ if (isCommandBuilderCallback(builder)) {
+ const builderOutput = builder(yargs.getInternalMethods().reset(aliases), helpOrVersionSet);
+ if (isPromise(builderOutput)) {
+ return builderOutput.then(output => {
+ innerYargs = isYargsInstance(output) ? output : yargs;
+ return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly);
+ });
+ }
+ }
+ else if (isCommandBuilderOptionDefinitions(builder)) {
+ innerYargs = yargs.getInternalMethods().reset(aliases);
+ Object.keys(commandHandler.builder).forEach(key => {
+ innerYargs.option(key, builder[key]);
+ });
+ }
+ return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly);
+ }
+ parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly) {
+ if (isDefaultCommand)
+ innerYargs.getInternalMethods().getUsageInstance().unfreeze();
+ if (this.shouldUpdateUsage(innerYargs)) {
+ innerYargs
+ .getInternalMethods()
+ .getUsageInstance()
+ .usage(this.usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
+ }
+ const innerArgv = innerYargs
+ .getInternalMethods()
+ .runYargsParserAndExecuteCommands(null, undefined, true, commandIndex, helpOnly);
+ return isPromise(innerArgv)
+ ? innerArgv.then(argv => ({
+ aliases: innerYargs.parsed.aliases,
+ innerArgv: argv,
+ }))
+ : {
+ aliases: innerYargs.parsed.aliases,
+ innerArgv: innerArgv,
+ };
+ }
+ shouldUpdateUsage(yargs) {
+ return (!yargs.getInternalMethods().getUsageInstance().getUsageDisabled() &&
+ yargs.getInternalMethods().getUsageInstance().getUsage().length === 0);
+ }
+ usageFromParentCommandsCommandHandler(parentCommands, commandHandler) {
+ const c = DEFAULT_MARKER.test(commandHandler.original)
+ ? commandHandler.original.replace(DEFAULT_MARKER, '').trim()
+ : commandHandler.original;
+ const pc = parentCommands.filter(c => {
+ return !DEFAULT_MARKER.test(c);
+ });
+ pc.push(c);
+ return `$0 ${pc.join(' ')}`;
+ }
+ applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
+ let positionalMap = {};
+ if (helpOnly)
+ return innerArgv;
+ if (!yargs.getInternalMethods().getHasOutput()) {
+ positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
+ }
+ const middlewares = this.globalMiddleware
+ .getMiddleware()
+ .slice(0)
+ .concat(commandHandler.middlewares);
+ innerArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
+ if (!yargs.getInternalMethods().getHasOutput()) {
+ const validation = yargs
+ .getInternalMethods()
+ .runValidation(aliases, positionalMap, yargs.parsed.error, isDefaultCommand);
+ innerArgv = maybeAsyncResult(innerArgv, result => {
+ validation(result);
+ return result;
+ });
+ }
+ if (commandHandler.handler && !yargs.getInternalMethods().getHasOutput()) {
+ yargs.getInternalMethods().setHasOutput();
+ const populateDoubleDash = !!yargs.getOptions().configuration['populate--'];
+ yargs
+ .getInternalMethods()
+ .postProcess(innerArgv, populateDoubleDash, false, false);
+ innerArgv = applyMiddleware(innerArgv, yargs, middlewares, false);
+ innerArgv = maybeAsyncResult(innerArgv, result => {
+ const handlerResult = commandHandler.handler(result);
+ return isPromise(handlerResult)
+ ? handlerResult.then(() => result)
+ : result;
+ });
+ if (!isDefaultCommand) {
+ yargs.getInternalMethods().getUsageInstance().cacheHelpMessage();
+ }
+ if (isPromise(innerArgv) &&
+ !yargs.getInternalMethods().hasParseCallback()) {
+ innerArgv.catch(error => {
+ try {
+ yargs.getInternalMethods().getUsageInstance().fail(null, error);
+ }
+ catch (_err) {
+ }
+ });
+ }
+ }
+ if (!isDefaultCommand) {
+ currentContext.commands.pop();
+ currentContext.fullCommands.pop();
+ }
+ return innerArgv;
+ }
+ populatePositionals(commandHandler, argv, context, yargs) {
+ argv._ = argv._.slice(context.commands.length);
+ const demanded = commandHandler.demanded.slice(0);
+ const optional = commandHandler.optional.slice(0);
+ const positionalMap = {};
+ this.validation.positionalCount(demanded.length, argv._.length);
+ while (demanded.length) {
+ const demand = demanded.shift();
+ this.populatePositional(demand, argv, positionalMap);
+ }
+ while (optional.length) {
+ const maybe = optional.shift();
+ this.populatePositional(maybe, argv, positionalMap);
+ }
+ argv._ = context.commands.concat(argv._.map(a => '' + a));
+ this.postProcessPositionals(argv, positionalMap, this.cmdToParseOptions(commandHandler.original), yargs);
+ return positionalMap;
+ }
+ populatePositional(positional, argv, positionalMap) {
+ const cmd = positional.cmd[0];
+ if (positional.variadic) {
+ positionalMap[cmd] = argv._.splice(0).map(String);
+ }
+ else {
+ if (argv._.length)
+ positionalMap[cmd] = [String(argv._.shift())];
+ }
+ }
+ cmdToParseOptions(cmdString) {
+ const parseOptions = {
+ array: [],
+ default: {},
+ alias: {},
+ demand: {},
+ };
+ const parsed = parseCommand(cmdString);
+ parsed.demanded.forEach(d => {
+ const [cmd, ...aliases] = d.cmd;
+ if (d.variadic) {
+ parseOptions.array.push(cmd);
+ parseOptions.default[cmd] = [];
+ }
+ parseOptions.alias[cmd] = aliases;
+ parseOptions.demand[cmd] = true;
+ });
+ parsed.optional.forEach(o => {
+ const [cmd, ...aliases] = o.cmd;
+ if (o.variadic) {
+ parseOptions.array.push(cmd);
+ parseOptions.default[cmd] = [];
+ }
+ parseOptions.alias[cmd] = aliases;
+ });
+ return parseOptions;
+ }
+ postProcessPositionals(argv, positionalMap, parseOptions, yargs) {
+ const options = Object.assign({}, yargs.getOptions());
+ options.default = Object.assign(parseOptions.default, options.default);
+ for (const key of Object.keys(parseOptions.alias)) {
+ options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]);
+ }
+ options.array = options.array.concat(parseOptions.array);
+ options.config = {};
+ const unparsed = [];
+ Object.keys(positionalMap).forEach(key => {
+ positionalMap[key].map(value => {
+ if (options.configuration['unknown-options-as-args'])
+ options.key[key] = true;
+ unparsed.push(`--${key}`);
+ unparsed.push(value);
+ });
+ });
+ if (!unparsed.length)
+ return;
+ const config = Object.assign({}, options.configuration, {
+ 'populate--': false,
+ });
+ const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
+ configuration: config,
+ }));
+ if (parsed.error) {
+ yargs
+ .getInternalMethods()
+ .getUsageInstance()
+ .fail(parsed.error.message, parsed.error);
+ }
+ else {
+ const positionalKeys = Object.keys(positionalMap);
+ Object.keys(positionalMap).forEach(key => {
+ positionalKeys.push(...parsed.aliases[key]);
+ });
+ const defaults = yargs.getOptions().default;
+ Object.keys(parsed.argv).forEach(key => {
+ if (positionalKeys.includes(key)) {
+ if (!positionalMap[key])
+ positionalMap[key] = parsed.argv[key];
+ if (!Object.prototype.hasOwnProperty.call(defaults, key) &&
+ Object.prototype.hasOwnProperty.call(argv, key) &&
+ Object.prototype.hasOwnProperty.call(parsed.argv, key) &&
+ (Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) {
+ argv[key] = [].concat(argv[key], parsed.argv[key]);
+ }
+ else {
+ argv[key] = parsed.argv[key];
+ }
+ }
+ });
+ }
+ }
+ runDefaultBuilderOn(yargs) {
+ if (!this.defaultCommand)
+ return;
+ if (this.shouldUpdateUsage(yargs)) {
+ const commandString = DEFAULT_MARKER.test(this.defaultCommand.original)
+ ? this.defaultCommand.original
+ : this.defaultCommand.original.replace(/^[^[\]<>]*/, '$0 ');
+ yargs
+ .getInternalMethods()
+ .getUsageInstance()
+ .usage(commandString, this.defaultCommand.description);
+ }
+ const builder = this.defaultCommand.builder;
+ if (isCommandBuilderCallback(builder)) {
+ return builder(yargs, true);
+ }
+ else if (!isCommandBuilderDefinition(builder)) {
+ Object.keys(builder).forEach(key => {
+ yargs.option(key, builder[key]);
+ });
+ }
+ return undefined;
+ }
+ moduleName(obj) {
+ const mod = whichModule(obj);
+ if (!mod)
+ throw new Error(`No command name given for module: ${this.shim.inspect(obj)}`);
+ return this.commandFromFilename(mod.filename);
+ }
+ commandFromFilename(filename) {
+ return this.shim.path.basename(filename, this.shim.path.extname(filename));
+ }
+ extractDesc({ describe, description, desc }) {
+ for (const test of [describe, description, desc]) {
+ if (typeof test === 'string' || test === false)
+ return test;
+ assertNotStrictEqual(test, true, this.shim);
+ }
+ return false;
+ }
+ freeze() {
+ this.frozens.push({
+ handlers: this.handlers,
+ aliasMap: this.aliasMap,
+ defaultCommand: this.defaultCommand,
+ });
+ }
+ unfreeze() {
+ const frozen = this.frozens.pop();
+ assertNotStrictEqual(frozen, undefined, this.shim);
+ ({
+ handlers: this.handlers,
+ aliasMap: this.aliasMap,
+ defaultCommand: this.defaultCommand,
+ } = frozen);
+ }
+ reset() {
+ this.handlers = {};
+ this.aliasMap = {};
+ this.defaultCommand = undefined;
+ this.requireCache = new Set();
+ return this;
+ }
+}
+export function command(usage, validation, globalMiddleware, shim) {
+ return new CommandInstance(usage, validation, globalMiddleware, shim);
+}
+export function isCommandBuilderDefinition(builder) {
+ return (typeof builder === 'object' &&
+ !!builder.builder &&
+ typeof builder.handler === 'function');
+}
+function isCommandAndAliases(cmd) {
+ return cmd.every(c => typeof c === 'string');
+}
+export function isCommandBuilderCallback(builder) {
+ return typeof builder === 'function';
+}
+function isCommandBuilderOptionDefinitions(builder) {
+ return typeof builder === 'object';
+}
+export function isCommandHandlerDefinition(cmd) {
+ return typeof cmd === 'object' && !Array.isArray(cmd);
+}
diff --git a/node_modules/yargs/build/lib/completion-templates.js b/node_modules/yargs/build/lib/completion-templates.js
new file mode 100644
index 0000000..4bd930c
--- /dev/null
+++ b/node_modules/yargs/build/lib/completion-templates.js
@@ -0,0 +1,48 @@
+export const completionShTemplate = `###-begin-{{app_name}}-completions-###
+#
+# yargs command completion script
+#
+# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
+# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
+#
+_{{app_name}}_yargs_completions()
+{
+ local cur_word args type_list
+
+ cur_word="\${COMP_WORDS[COMP_CWORD]}"
+ args=("\${COMP_WORDS[@]}")
+
+ # ask yargs to generate completions.
+ type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
+
+ COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
+
+ # if no match was found, fall back to filename completion
+ if [ \${#COMPREPLY[@]} -eq 0 ]; then
+ COMPREPLY=()
+ fi
+
+ return 0
+}
+complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
+###-end-{{app_name}}-completions-###
+`;
+export const completionZshTemplate = `#compdef {{app_name}}
+###-begin-{{app_name}}-completions-###
+#
+# yargs command completion script
+#
+# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
+# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
+#
+_{{app_name}}_yargs_completions()
+{
+ local reply
+ local si=$IFS
+ IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
+ IFS=$si
+ _describe 'values' reply
+}
+compdef _{{app_name}}_yargs_completions {{app_name}}
+###-end-{{app_name}}-completions-###
+`;
diff --git a/node_modules/yargs/build/lib/completion.js b/node_modules/yargs/build/lib/completion.js
new file mode 100644
index 0000000..e54a975
--- /dev/null
+++ b/node_modules/yargs/build/lib/completion.js
@@ -0,0 +1,200 @@
+import { isCommandBuilderCallback } from './command.js';
+import { assertNotStrictEqual } from './typings/common-types.js';
+import * as templates from './completion-templates.js';
+import { isPromise } from './utils/is-promise.js';
+import { parseCommand } from './parse-command.js';
+export class Completion {
+ constructor(yargs, usage, command, shim) {
+ var _a, _b, _c;
+ this.yargs = yargs;
+ this.usage = usage;
+ this.command = command;
+ this.shim = shim;
+ this.completionKey = 'get-yargs-completions';
+ this.aliases = null;
+ this.customCompletionFunction = null;
+ this.zshShell =
+ (_c = (((_a = this.shim.getEnv('SHELL')) === null || _a === void 0 ? void 0 : _a.includes('zsh')) ||
+ ((_b = this.shim.getEnv('ZSH_NAME')) === null || _b === void 0 ? void 0 : _b.includes('zsh')))) !== null && _c !== void 0 ? _c : false;
+ }
+ defaultCompletion(args, argv, current, done) {
+ const handlers = this.command.getCommandHandlers();
+ for (let i = 0, ii = args.length; i < ii; ++i) {
+ if (handlers[args[i]] && handlers[args[i]].builder) {
+ const builder = handlers[args[i]].builder;
+ if (isCommandBuilderCallback(builder)) {
+ const y = this.yargs.getInternalMethods().reset();
+ builder(y, true);
+ return y.argv;
+ }
+ }
+ }
+ const completions = [];
+ this.commandCompletions(completions, args, current);
+ this.optionCompletions(completions, args, argv, current);
+ this.choicesCompletions(completions, args, argv, current);
+ done(null, completions);
+ }
+ commandCompletions(completions, args, current) {
+ const parentCommands = this.yargs
+ .getInternalMethods()
+ .getContext().commands;
+ if (!current.match(/^-/) &&
+ parentCommands[parentCommands.length - 1] !== current &&
+ !this.previousArgHasChoices(args)) {
+ this.usage.getCommands().forEach(usageCommand => {
+ const commandName = parseCommand(usageCommand[0]).cmd;
+ if (args.indexOf(commandName) === -1) {
+ if (!this.zshShell) {
+ completions.push(commandName);
+ }
+ else {
+ const desc = usageCommand[1] || '';
+ completions.push(commandName.replace(/:/g, '\\:') + ':' + desc);
+ }
+ }
+ });
+ }
+ }
+ optionCompletions(completions, args, argv, current) {
+ if ((current.match(/^-/) || (current === '' && completions.length === 0)) &&
+ !this.previousArgHasChoices(args)) {
+ const options = this.yargs.getOptions();
+ const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [];
+ Object.keys(options.key).forEach(key => {
+ const negable = !!options.configuration['boolean-negation'] &&
+ options.boolean.includes(key);
+ const isPositionalKey = positionalKeys.includes(key);
+ if (!isPositionalKey &&
+ !this.argsContainKey(args, argv, key, negable)) {
+ this.completeOptionKey(key, completions, current);
+ if (negable && !!options.default[key])
+ this.completeOptionKey(`no-${key}`, completions, current);
+ }
+ });
+ }
+ }
+ choicesCompletions(completions, args, argv, current) {
+ if (this.previousArgHasChoices(args)) {
+ const choices = this.getPreviousArgChoices(args);
+ if (choices && choices.length > 0) {
+ completions.push(...choices);
+ }
+ }
+ }
+ getPreviousArgChoices(args) {
+ if (args.length < 1)
+ return;
+ let previousArg = args[args.length - 1];
+ let filter = '';
+ if (!previousArg.startsWith('--') && args.length > 1) {
+ filter = previousArg;
+ previousArg = args[args.length - 2];
+ }
+ if (!previousArg.startsWith('--'))
+ return;
+ const previousArgKey = previousArg.replace(/-/g, '');
+ const options = this.yargs.getOptions();
+ if (Object.keys(options.key).some(key => key === previousArgKey) &&
+ Array.isArray(options.choices[previousArgKey])) {
+ return options.choices[previousArgKey].filter(choice => !filter || choice.startsWith(filter));
+ }
+ }
+ previousArgHasChoices(args) {
+ const choices = this.getPreviousArgChoices(args);
+ return choices !== undefined && choices.length > 0;
+ }
+ argsContainKey(args, argv, key, negable) {
+ if (args.indexOf(`--${key}`) !== -1)
+ return true;
+ if (negable && args.indexOf(`--no-${key}`) !== -1)
+ return true;
+ if (this.aliases) {
+ for (const alias of this.aliases[key]) {
+ if (argv[alias] !== undefined)
+ return true;
+ }
+ }
+ return false;
+ }
+ completeOptionKey(key, completions, current) {
+ const descs = this.usage.getDescriptions();
+ const startsByTwoDashes = (s) => /^--/.test(s);
+ const isShortOption = (s) => /^[^0-9]$/.test(s);
+ const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--';
+ if (!this.zshShell) {
+ completions.push(dashes + key);
+ }
+ else {
+ const desc = descs[key] || '';
+ completions.push(dashes +
+ `${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`);
+ }
+ }
+ customCompletion(args, argv, current, done) {
+ assertNotStrictEqual(this.customCompletionFunction, null, this.shim);
+ if (isSyncCompletionFunction(this.customCompletionFunction)) {
+ const result = this.customCompletionFunction(current, argv);
+ if (isPromise(result)) {
+ return result
+ .then(list => {
+ this.shim.process.nextTick(() => {
+ done(null, list);
+ });
+ })
+ .catch(err => {
+ this.shim.process.nextTick(() => {
+ done(err, undefined);
+ });
+ });
+ }
+ return done(null, result);
+ }
+ else if (isFallbackCompletionFunction(this.customCompletionFunction)) {
+ return this.customCompletionFunction(current, argv, (onCompleted = done) => this.defaultCompletion(args, argv, current, onCompleted), completions => {
+ done(null, completions);
+ });
+ }
+ else {
+ return this.customCompletionFunction(current, argv, completions => {
+ done(null, completions);
+ });
+ }
+ }
+ getCompletion(args, done) {
+ const current = args.length ? args[args.length - 1] : '';
+ const argv = this.yargs.parse(args, true);
+ const completionFunction = this.customCompletionFunction
+ ? (argv) => this.customCompletion(args, argv, current, done)
+ : (argv) => this.defaultCompletion(args, argv, current, done);
+ return isPromise(argv)
+ ? argv.then(completionFunction)
+ : completionFunction(argv);
+ }
+ generateCompletionScript($0, cmd) {
+ let script = this.zshShell
+ ? templates.completionZshTemplate
+ : templates.completionShTemplate;
+ const name = this.shim.path.basename($0);
+ if ($0.match(/\.js$/))
+ $0 = `./${$0}`;
+ script = script.replace(/{{app_name}}/g, name);
+ script = script.replace(/{{completion_command}}/g, cmd);
+ return script.replace(/{{app_path}}/g, $0);
+ }
+ registerFunction(fn) {
+ this.customCompletionFunction = fn;
+ }
+ setParsed(parsed) {
+ this.aliases = parsed.aliases;
+ }
+}
+export function completion(yargs, usage, command, shim) {
+ return new Completion(yargs, usage, command, shim);
+}
+function isSyncCompletionFunction(completionFunction) {
+ return completionFunction.length < 3;
+}
+function isFallbackCompletionFunction(completionFunction) {
+ return completionFunction.length > 3;
+}
diff --git a/node_modules/yargs/build/lib/middleware.js b/node_modules/yargs/build/lib/middleware.js
new file mode 100644
index 0000000..4e561a7
--- /dev/null
+++ b/node_modules/yargs/build/lib/middleware.js
@@ -0,0 +1,88 @@
+import { argsert } from './argsert.js';
+import { isPromise } from './utils/is-promise.js';
+export class GlobalMiddleware {
+ constructor(yargs) {
+ this.globalMiddleware = [];
+ this.frozens = [];
+ this.yargs = yargs;
+ }
+ addMiddleware(callback, applyBeforeValidation, global = true, mutates = false) {
+ argsert('<array|function> [boolean] [boolean] [boolean]', [callback, applyBeforeValidation, global], arguments.length);
+ if (Array.isArray(callback)) {
+ for (let i = 0; i < callback.length; i++) {
+ if (typeof callback[i] !== 'function') {
+ throw Error('middleware must be a function');
+ }
+ const m = callback[i];
+ m.applyBeforeValidation = applyBeforeValidation;
+ m.global = global;
+ }
+ Array.prototype.push.apply(this.globalMiddleware, callback);
+ }
+ else if (typeof callback === 'function') {
+ const m = callback;
+ m.applyBeforeValidation = applyBeforeValidation;
+ m.global = global;
+ m.mutates = mutates;
+ this.globalMiddleware.push(callback);
+ }
+ return this.yargs;
+ }
+ addCoerceMiddleware(callback, option) {
+ const aliases = this.yargs.getAliases();
+ this.globalMiddleware = this.globalMiddleware.filter(m => {
+ const toCheck = [...(aliases[option] || []), option];
+ if (!m.option)
+ return true;
+ else
+ return !toCheck.includes(m.option);
+ });
+ callback.option = option;
+ return this.addMiddleware(callback, true, true, true);
+ }
+ getMiddleware() {
+ return this.globalMiddleware;
+ }
+ freeze() {
+ this.frozens.push([...this.globalMiddleware]);
+ }
+ unfreeze() {
+ const frozen = this.frozens.pop();
+ if (frozen !== undefined)
+ this.globalMiddleware = frozen;
+ }
+ reset() {
+ this.globalMiddleware = this.globalMiddleware.filter(m => m.global);
+ }
+}
+export function commandMiddlewareFactory(commandMiddleware) {
+ if (!commandMiddleware)
+ return [];
+ return commandMiddleware.map(middleware => {
+ middleware.applyBeforeValidation = false;
+ return middleware;
+ });
+}
+export function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
+ return middlewares.reduce((acc, middleware) => {
+ if (middleware.applyBeforeValidation !== beforeValidation) {
+ return acc;
+ }
+ if (middleware.mutates) {
+ if (middleware.applied)
+ return acc;
+ middleware.applied = true;
+ }
+ if (isPromise(acc)) {
+ return acc
+ .then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)]))
+ .then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
+ }
+ else {
+ const result = middleware(acc, yargs);
+ return isPromise(result)
+ ? result.then(middlewareObj => Object.assign(acc, middlewareObj))
+ : Object.assign(acc, result);
+ }
+ }, argv);
+}
diff --git a/node_modules/yargs/build/lib/parse-command.js b/node_modules/yargs/build/lib/parse-command.js
new file mode 100644
index 0000000..4989f53
--- /dev/null
+++ b/node_modules/yargs/build/lib/parse-command.js
@@ -0,0 +1,32 @@
+export function parseCommand(cmd) {
+ const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ');
+ const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/);
+ const bregex = /\.*[\][<>]/g;
+ const firstCommand = splitCommand.shift();
+ if (!firstCommand)
+ throw new Error(`No command found in: ${cmd}`);
+ const parsedCommand = {
+ cmd: firstCommand.replace(bregex, ''),
+ demanded: [],
+ optional: [],
+ };
+ splitCommand.forEach((cmd, i) => {
+ let variadic = false;
+ cmd = cmd.replace(/\s/g, '');
+ if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1)
+ variadic = true;
+ if (/^\[/.test(cmd)) {
+ parsedCommand.optional.push({
+ cmd: cmd.replace(bregex, '').split('|'),
+ variadic,
+ });
+ }
+ else {
+ parsedCommand.demanded.push({
+ cmd: cmd.replace(bregex, '').split('|'),
+ variadic,
+ });
+ }
+ });
+ return parsedCommand;
+}
diff --git a/node_modules/yargs/build/lib/typings/common-types.js b/node_modules/yargs/build/lib/typings/common-types.js
new file mode 100644
index 0000000..73e1773
--- /dev/null
+++ b/node_modules/yargs/build/lib/typings/common-types.js
@@ -0,0 +1,9 @@
+export function assertNotStrictEqual(actual, expected, shim, message) {
+ shim.assert.notStrictEqual(actual, expected, message);
+}
+export function assertSingleKey(actual, shim) {
+ shim.assert.strictEqual(typeof actual, 'string');
+}
+export function objectKeys(object) {
+ return Object.keys(object);
+}
diff --git a/node_modules/yargs/build/lib/typings/yargs-parser-types.js b/node_modules/yargs/build/lib/typings/yargs-parser-types.js
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/node_modules/yargs/build/lib/typings/yargs-parser-types.js
@@ -0,0 +1 @@
+export {};
diff --git a/node_modules/yargs/build/lib/usage.js b/node_modules/yargs/build/lib/usage.js
new file mode 100644
index 0000000..2a2aeb0
--- /dev/null
+++ b/node_modules/yargs/build/lib/usage.js
@@ -0,0 +1,568 @@
+import { objFilter } from './utils/obj-filter.js';
+import { YError } from './yerror.js';
+import setBlocking from './utils/set-blocking.js';
+function isBoolean(fail) {
+ return typeof fail === 'boolean';
+}
+export function usage(yargs, shim) {
+ const __ = shim.y18n.__;
+ const self = {};
+ const fails = [];
+ self.failFn = function failFn(f) {
+ fails.push(f);
+ };
+ let failMessage = null;
+ let showHelpOnFail = true;
+ self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) {
+ function parseFunctionArgs() {
+ return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
+ }
+ const [enabled, message] = parseFunctionArgs();
+ failMessage = message;
+ showHelpOnFail = enabled;
+ return self;
+ };
+ let failureOutput = false;
+ self.fail = function fail(msg, err) {
+ const logger = yargs.getInternalMethods().getLoggerInstance();
+ if (fails.length) {
+ for (let i = fails.length - 1; i >= 0; --i) {
+ const fail = fails[i];
+ if (isBoolean(fail)) {
+ if (err)
+ throw err;
+ else if (msg)
+ throw Error(msg);
+ }
+ else {
+ fail(msg, err, self);
+ }
+ }
+ }
+ else {
+ if (yargs.getExitProcess())
+ setBlocking(true);
+ if (!failureOutput) {
+ failureOutput = true;
+ if (showHelpOnFail) {
+ yargs.showHelp('error');
+ logger.error();
+ }
+ if (msg || err)
+ logger.error(msg || err);
+ if (failMessage) {
+ if (msg || err)
+ logger.error('');
+ logger.error(failMessage);
+ }
+ }
+ err = err || new YError(msg);
+ if (yargs.getExitProcess()) {
+ return yargs.exit(1);
+ }
+ else if (yargs.getInternalMethods().hasParseCallback()) {
+ return yargs.exit(1, err);
+ }
+ else {
+ throw err;
+ }
+ }
+ };
+ let usages = [];
+ let usageDisabled = false;
+ self.usage = (msg, description) => {
+ if (msg === null) {
+ usageDisabled = true;
+ usages = [];
+ return self;
+ }
+ usageDisabled = false;
+ usages.push([msg, description || '']);
+ return self;
+ };
+ self.getUsage = () => {
+ return usages;
+ };
+ self.getUsageDisabled = () => {
+ return usageDisabled;
+ };
+ self.getPositionalGroupName = () => {
+ return __('Positionals:');
+ };
+ let examples = [];
+ self.example = (cmd, description) => {
+ examples.push([cmd, description || '']);
+ };
+ let commands = [];
+ self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
+ if (isDefault) {
+ commands = commands.map(cmdArray => {
+ cmdArray[2] = false;
+ return cmdArray;
+ });
+ }
+ commands.push([cmd, description || '', isDefault, aliases, deprecated]);
+ };
+ self.getCommands = () => commands;
+ let descriptions = {};
+ self.describe = function describe(keyOrKeys, desc) {
+ if (Array.isArray(keyOrKeys)) {
+ keyOrKeys.forEach(k => {
+ self.describe(k, desc);
+ });
+ }
+ else if (typeof keyOrKeys === 'object') {
+ Object.keys(keyOrKeys).forEach(k => {
+ self.describe(k, keyOrKeys[k]);
+ });
+ }
+ else {
+ descriptions[keyOrKeys] = desc;
+ }
+ };
+ self.getDescriptions = () => descriptions;
+ let epilogs = [];
+ self.epilog = msg => {
+ epilogs.push(msg);
+ };
+ let wrapSet = false;
+ let wrap;
+ self.wrap = cols => {
+ wrapSet = true;
+ wrap = cols;
+ };
+ function getWrap() {
+ if (!wrapSet) {
+ wrap = windowWidth();
+ wrapSet = true;
+ }
+ return wrap;
+ }
+ const deferY18nLookupPrefix = '__yargsString__:';
+ self.deferY18nLookup = str => deferY18nLookupPrefix + str;
+ self.help = function help() {
+ if (cachedHelpMessage)
+ return cachedHelpMessage;
+ normalizeAliases();
+ const base$0 = yargs.customScriptName
+ ? yargs.$0
+ : shim.path.basename(yargs.$0);
+ const demandedOptions = yargs.getDemandedOptions();
+ const demandedCommands = yargs.getDemandedCommands();
+ const deprecatedOptions = yargs.getDeprecatedOptions();
+ const groups = yargs.getGroups();
+ const options = yargs.getOptions();
+ let keys = [];
+ keys = keys.concat(Object.keys(descriptions));
+ keys = keys.concat(Object.keys(demandedOptions));
+ keys = keys.concat(Object.keys(demandedCommands));
+ keys = keys.concat(Object.keys(options.default));
+ keys = keys.filter(filterHiddenOptions);
+ keys = Object.keys(keys.reduce((acc, key) => {
+ if (key !== '_')
+ acc[key] = true;
+ return acc;
+ }, {}));
+ const theWrap = getWrap();
+ const ui = shim.cliui({
+ width: theWrap,
+ wrap: !!theWrap,
+ });
+ if (!usageDisabled) {
+ if (usages.length) {
+ usages.forEach(usage => {
+ ui.div({ text: `${usage[0].replace(/\$0/g, base$0)}` });
+ if (usage[1]) {
+ ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] });
+ }
+ });
+ ui.div();
+ }
+ else if (commands.length) {
+ let u = null;
+ if (demandedCommands._) {
+ u = `${base$0} <${__('command')}>\n`;
+ }
+ else {
+ u = `${base$0} [${__('command')}]\n`;
+ }
+ ui.div(`${u}`);
+ }
+ }
+ if (commands.length > 1 || (commands.length === 1 && !commands[0][2])) {
+ ui.div(__('Commands:'));
+ const context = yargs.getInternalMethods().getContext();
+ const parentCommands = context.commands.length
+ ? `${context.commands.join(' ')} `
+ : '';
+ if (yargs.getInternalMethods().getParserConfiguration()['sort-commands'] ===
+ true) {
+ commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
+ }
+ const prefix = base$0 ? `${base$0} ` : '';
+ commands.forEach(command => {
+ const commandString = `${prefix}${parentCommands}${command[0].replace(/^\$0 ?/, '')}`;
+ ui.span({
+ text: commandString,
+ padding: [0, 2, 0, 2],
+ width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4,
+ }, { text: command[1] });
+ const hints = [];
+ if (command[2])
+ hints.push(`[${__('default')}]`);
+ if (command[3] && command[3].length) {
+ hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`);
+ }
+ if (command[4]) {
+ if (typeof command[4] === 'string') {
+ hints.push(`[${__('deprecated: %s', command[4])}]`);
+ }
+ else {
+ hints.push(`[${__('deprecated')}]`);
+ }
+ }
+ if (hints.length) {
+ ui.div({
+ text: hints.join(' '),
+ padding: [0, 0, 0, 2],
+ align: 'right',
+ });
+ }
+ else {
+ ui.div();
+ }
+ });
+ ui.div();
+ }
+ const aliasKeys = (Object.keys(options.alias) || []).concat(Object.keys(yargs.parsed.newAliases) || []);
+ keys = keys.filter(key => !yargs.parsed.newAliases[key] &&
+ aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1));
+ const defaultGroup = __('Options:');
+ if (!groups[defaultGroup])
+ groups[defaultGroup] = [];
+ addUngroupedKeys(keys, options.alias, groups, defaultGroup);
+ const isLongSwitch = (sw) => /^--/.test(getText(sw));
+ const displayedGroups = Object.keys(groups)
+ .filter(groupName => groups[groupName].length > 0)
+ .map(groupName => {
+ const normalizedKeys = groups[groupName]
+ .filter(filterHiddenOptions)
+ .map(key => {
+ if (aliasKeys.includes(key))
+ return key;
+ for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
+ if ((options.alias[aliasKey] || []).includes(key))
+ return aliasKey;
+ }
+ return key;
+ });
+ return { groupName, normalizedKeys };
+ })
+ .filter(({ normalizedKeys }) => normalizedKeys.length > 0)
+ .map(({ groupName, normalizedKeys }) => {
+ const switches = normalizedKeys.reduce((acc, key) => {
+ acc[key] = [key]
+ .concat(options.alias[key] || [])
+ .map(sw => {
+ if (groupName === self.getPositionalGroupName())
+ return sw;
+ else {
+ return ((/^[0-9]$/.test(sw)
+ ? options.boolean.includes(key)
+ ? '-'
+ : '--'
+ : sw.length > 1
+ ? '--'
+ : '-') + sw);
+ }
+ })
+ .sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2)
+ ? 0
+ : isLongSwitch(sw1)
+ ? 1
+ : -1)
+ .join(', ');
+ return acc;
+ }, {});
+ return { groupName, normalizedKeys, switches };
+ });
+ const shortSwitchesUsed = displayedGroups
+ .filter(({ groupName }) => groupName !== self.getPositionalGroupName())
+ .some(({ normalizedKeys, switches }) => !normalizedKeys.every(key => isLongSwitch(switches[key])));
+ if (shortSwitchesUsed) {
+ displayedGroups
+ .filter(({ groupName }) => groupName !== self.getPositionalGroupName())
+ .forEach(({ normalizedKeys, switches }) => {
+ normalizedKeys.forEach(key => {
+ if (isLongSwitch(switches[key])) {
+ switches[key] = addIndentation(switches[key], '-x, '.length);
+ }
+ });
+ });
+ }
+ displayedGroups.forEach(({ groupName, normalizedKeys, switches }) => {
+ ui.div(groupName);
+ normalizedKeys.forEach(key => {
+ const kswitch = switches[key];
+ let desc = descriptions[key] || '';
+ let type = null;
+ if (desc.includes(deferY18nLookupPrefix))
+ desc = __(desc.substring(deferY18nLookupPrefix.length));
+ if (options.boolean.includes(key))
+ type = `[${__('boolean')}]`;
+ if (options.count.includes(key))
+ type = `[${__('count')}]`;
+ if (options.string.includes(key))
+ type = `[${__('string')}]`;
+ if (options.normalize.includes(key))
+ type = `[${__('string')}]`;
+ if (options.array.includes(key))
+ type = `[${__('array')}]`;
+ if (options.number.includes(key))
+ type = `[${__('number')}]`;
+ const deprecatedExtra = (deprecated) => typeof deprecated === 'string'
+ ? `[${__('deprecated: %s', deprecated)}]`
+ : `[${__('deprecated')}]`;
+ const extra = [
+ key in deprecatedOptions
+ ? deprecatedExtra(deprecatedOptions[key])
+ : null,
+ type,
+ key in demandedOptions ? `[${__('required')}]` : null,
+ options.choices && options.choices[key]
+ ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]`
+ : null,
+ defaultString(options.default[key], options.defaultDescription[key]),
+ ]
+ .filter(Boolean)
+ .join(' ');
+ ui.span({
+ text: getText(kswitch),
+ padding: [0, 2, 0, 2 + getIndentation(kswitch)],
+ width: maxWidth(switches, theWrap) + 4,
+ }, desc);
+ if (extra)
+ ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' });
+ else
+ ui.div();
+ });
+ ui.div();
+ });
+ if (examples.length) {
+ ui.div(__('Examples:'));
+ examples.forEach(example => {
+ example[0] = example[0].replace(/\$0/g, base$0);
+ });
+ examples.forEach(example => {
+ if (example[1] === '') {
+ ui.div({
+ text: example[0],
+ padding: [0, 2, 0, 2],
+ });
+ }
+ else {
+ ui.div({
+ text: example[0],
+ padding: [0, 2, 0, 2],
+ width: maxWidth(examples, theWrap) + 4,
+ }, {
+ text: example[1],
+ });
+ }
+ });
+ ui.div();
+ }
+ if (epilogs.length > 0) {
+ const e = epilogs
+ .map(epilog => epilog.replace(/\$0/g, base$0))
+ .join('\n');
+ ui.div(`${e}\n`);
+ }
+ return ui.toString().replace(/\s*$/, '');
+ };
+ function maxWidth(table, theWrap, modifier) {
+ let width = 0;
+ if (!Array.isArray(table)) {
+ table = Object.values(table).map(v => [v]);
+ }
+ table.forEach(v => {
+ width = Math.max(shim.stringWidth(modifier ? `${modifier} ${getText(v[0])}` : getText(v[0])) + getIndentation(v[0]), width);
+ });
+ if (theWrap)
+ width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10));
+ return width;
+ }
+ function normalizeAliases() {
+ const demandedOptions = yargs.getDemandedOptions();
+ const options = yargs.getOptions();
+ (Object.keys(options.alias) || []).forEach(key => {
+ options.alias[key].forEach(alias => {
+ if (descriptions[alias])
+ self.describe(key, descriptions[alias]);
+ if (alias in demandedOptions)
+ yargs.demandOption(key, demandedOptions[alias]);
+ if (options.boolean.includes(alias))
+ yargs.boolean(key);
+ if (options.count.includes(alias))
+ yargs.count(key);
+ if (options.string.includes(alias))
+ yargs.string(key);
+ if (options.normalize.includes(alias))
+ yargs.normalize(key);
+ if (options.array.includes(alias))
+ yargs.array(key);
+ if (options.number.includes(alias))
+ yargs.number(key);
+ });
+ });
+ }
+ let cachedHelpMessage;
+ self.cacheHelpMessage = function () {
+ cachedHelpMessage = this.help();
+ };
+ self.clearCachedHelpMessage = function () {
+ cachedHelpMessage = undefined;
+ };
+ self.hasCachedHelpMessage = function () {
+ return !!cachedHelpMessage;
+ };
+ function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
+ let groupedKeys = [];
+ let toCheck = null;
+ Object.keys(groups).forEach(group => {
+ groupedKeys = groupedKeys.concat(groups[group]);
+ });
+ keys.forEach(key => {
+ toCheck = [key].concat(aliases[key]);
+ if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
+ groups[defaultGroup].push(key);
+ }
+ });
+ return groupedKeys;
+ }
+ function filterHiddenOptions(key) {
+ return (yargs.getOptions().hiddenOptions.indexOf(key) < 0 ||
+ yargs.parsed.argv[yargs.getOptions().showHiddenOpt]);
+ }
+ self.showHelp = (level) => {
+ const logger = yargs.getInternalMethods().getLoggerInstance();
+ if (!level)
+ level = 'error';
+ const emit = typeof level === 'function' ? level : logger[level];
+ emit(self.help());
+ };
+ self.functionDescription = fn => {
+ const description = fn.name
+ ? shim.Parser.decamelize(fn.name, '-')
+ : __('generated-value');
+ return ['(', description, ')'].join('');
+ };
+ self.stringifiedValues = function stringifiedValues(values, separator) {
+ let string = '';
+ const sep = separator || ', ';
+ const array = [].concat(values);
+ if (!values || !array.length)
+ return string;
+ array.forEach(value => {
+ if (string.length)
+ string += sep;
+ string += JSON.stringify(value);
+ });
+ return string;
+ };
+ function defaultString(value, defaultDescription) {
+ let string = `[${__('default:')} `;
+ if (value === undefined && !defaultDescription)
+ return null;
+ if (defaultDescription) {
+ string += defaultDescription;
+ }
+ else {
+ switch (typeof value) {
+ case 'string':
+ string += `"${value}"`;
+ break;
+ case 'object':
+ string += JSON.stringify(value);
+ break;
+ default:
+ string += value;
+ }
+ }
+ return `${string}]`;
+ }
+ function windowWidth() {
+ const maxWidth = 80;
+ if (shim.process.stdColumns) {
+ return Math.min(maxWidth, shim.process.stdColumns);
+ }
+ else {
+ return maxWidth;
+ }
+ }
+ let version = null;
+ self.version = ver => {
+ version = ver;
+ };
+ self.showVersion = level => {
+ const logger = yargs.getInternalMethods().getLoggerInstance();
+ if (!level)
+ level = 'error';
+ const emit = typeof level === 'function' ? level : logger[level];
+ emit(version);
+ };
+ self.reset = function reset(localLookup) {
+ failMessage = null;
+ failureOutput = false;
+ usages = [];
+ usageDisabled = false;
+ epilogs = [];
+ examples = [];
+ commands = [];
+ descriptions = objFilter(descriptions, k => !localLookup[k]);
+ return self;
+ };
+ const frozens = [];
+ self.freeze = function freeze() {
+ frozens.push({
+ failMessage,
+ failureOutput,
+ usages,
+ usageDisabled,
+ epilogs,
+ examples,
+ commands,
+ descriptions,
+ });
+ };
+ self.unfreeze = function unfreeze() {
+ const frozen = frozens.pop();
+ if (!frozen)
+ return;
+ ({
+ failMessage,
+ failureOutput,
+ usages,
+ usageDisabled,
+ epilogs,
+ examples,
+ commands,
+ descriptions,
+ } = frozen);
+ };
+ return self;
+}
+function isIndentedText(text) {
+ return typeof text === 'object';
+}
+function addIndentation(text, indent) {
+ return isIndentedText(text)
+ ? { text: text.text, indentation: text.indentation + indent }
+ : { text, indentation: indent };
+}
+function getIndentation(text) {
+ return isIndentedText(text) ? text.indentation : 0;
+}
+function getText(text) {
+ return isIndentedText(text) ? text.text : text;
+}
diff --git a/node_modules/yargs/build/lib/utils/apply-extends.js b/node_modules/yargs/build/lib/utils/apply-extends.js
new file mode 100644
index 0000000..0e593b4
--- /dev/null
+++ b/node_modules/yargs/build/lib/utils/apply-extends.js
@@ -0,0 +1,59 @@
+import { YError } from '../yerror.js';
+let previouslyVisitedConfigs = [];
+let shim;
+export function applyExtends(config, cwd, mergeExtends, _shim) {
+ shim = _shim;
+ let defaultConfig = {};
+ if (Object.prototype.hasOwnProperty.call(config, 'extends')) {
+ if (typeof config.extends !== 'string')
+ return defaultConfig;
+ const isPath = /\.json|\..*rc$/.test(config.extends);
+ let pathToDefault = null;
+ if (!isPath) {
+ try {
+ pathToDefault = require.resolve(config.extends);
+ }
+ catch (_err) {
+ return config;
+ }
+ }
+ else {
+ pathToDefault = getPathToDefaultConfig(cwd, config.extends);
+ }
+ checkForCircularExtends(pathToDefault);
+ previouslyVisitedConfigs.push(pathToDefault);
+ defaultConfig = isPath
+ ? JSON.parse(shim.readFileSync(pathToDefault, 'utf8'))
+ : require(config.extends);
+ delete config.extends;
+ defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim);
+ }
+ previouslyVisitedConfigs = [];
+ return mergeExtends
+ ? mergeDeep(defaultConfig, config)
+ : Object.assign({}, defaultConfig, config);
+}
+function checkForCircularExtends(cfgPath) {
+ if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
+ throw new YError(`Circular extended configurations: '${cfgPath}'.`);
+ }
+}
+function getPathToDefaultConfig(cwd, pathToExtend) {
+ return shim.path.resolve(cwd, pathToExtend);
+}
+function mergeDeep(config1, config2) {
+ const target = {};
+ function isObject(obj) {
+ return obj && typeof obj === 'object' && !Array.isArray(obj);
+ }
+ Object.assign(target, config1);
+ for (const key of Object.keys(config2)) {
+ if (isObject(config2[key]) && isObject(target[key])) {
+ target[key] = mergeDeep(config1[key], config2[key]);
+ }
+ else {
+ target[key] = config2[key];
+ }
+ }
+ return target;
+}
diff --git a/node_modules/yargs/build/lib/utils/is-promise.js b/node_modules/yargs/build/lib/utils/is-promise.js
new file mode 100644
index 0000000..d250c08
--- /dev/null
+++ b/node_modules/yargs/build/lib/utils/is-promise.js
@@ -0,0 +1,5 @@
+export function isPromise(maybePromise) {
+ return (!!maybePromise &&
+ !!maybePromise.then &&
+ typeof maybePromise.then === 'function');
+}
diff --git a/node_modules/yargs/build/lib/utils/levenshtein.js b/node_modules/yargs/build/lib/utils/levenshtein.js
new file mode 100644
index 0000000..60575ef
--- /dev/null
+++ b/node_modules/yargs/build/lib/utils/levenshtein.js
@@ -0,0 +1,34 @@
+export function levenshtein(a, b) {
+ if (a.length === 0)
+ return b.length;
+ if (b.length === 0)
+ return a.length;
+ const matrix = [];
+ let i;
+ for (i = 0; i <= b.length; i++) {
+ matrix[i] = [i];
+ }
+ let j;
+ for (j = 0; j <= a.length; j++) {
+ matrix[0][j] = j;
+ }
+ for (i = 1; i <= b.length; i++) {
+ for (j = 1; j <= a.length; j++) {
+ if (b.charAt(i - 1) === a.charAt(j - 1)) {
+ matrix[i][j] = matrix[i - 1][j - 1];
+ }
+ else {
+ if (i > 1 &&
+ j > 1 &&
+ b.charAt(i - 2) === a.charAt(j - 1) &&
+ b.charAt(i - 1) === a.charAt(j - 2)) {
+ matrix[i][j] = matrix[i - 2][j - 2] + 1;
+ }
+ else {
+ matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1));
+ }
+ }
+ }
+ }
+ return matrix[b.length][a.length];
+}
diff --git a/node_modules/yargs/build/lib/utils/maybe-async-result.js b/node_modules/yargs/build/lib/utils/maybe-async-result.js
new file mode 100644
index 0000000..8c6a40c
--- /dev/null
+++ b/node_modules/yargs/build/lib/utils/maybe-async-result.js
@@ -0,0 +1,17 @@
+import { isPromise } from './is-promise.js';
+export function maybeAsyncResult(getResult, resultHandler, errorHandler = (err) => {
+ throw err;
+}) {
+ try {
+ const result = isFunction(getResult) ? getResult() : getResult;
+ return isPromise(result)
+ ? result.then((result) => resultHandler(result))
+ : resultHandler(result);
+ }
+ catch (err) {
+ return errorHandler(err);
+ }
+}
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
diff --git a/node_modules/yargs/build/lib/utils/obj-filter.js b/node_modules/yargs/build/lib/utils/obj-filter.js
new file mode 100644
index 0000000..cd68ad2
--- /dev/null
+++ b/node_modules/yargs/build/lib/utils/obj-filter.js
@@ -0,0 +1,10 @@
+import { objectKeys } from '../typings/common-types.js';
+export function objFilter(original = {}, filter = () => true) {
+ const obj = {};
+ objectKeys(original).forEach(key => {
+ if (filter(key, original[key])) {
+ obj[key] = original[key];
+ }
+ });
+ return obj;
+}
diff --git a/node_modules/yargs/build/lib/utils/process-argv.js b/node_modules/yargs/build/lib/utils/process-argv.js
new file mode 100644
index 0000000..74dc9e4
--- /dev/null
+++ b/node_modules/yargs/build/lib/utils/process-argv.js
@@ -0,0 +1,17 @@
+function getProcessArgvBinIndex() {
+ if (isBundledElectronApp())
+ return 0;
+ return 1;
+}
+function isBundledElectronApp() {
+ return isElectronApp() && !process.defaultApp;
+}
+function isElectronApp() {
+ return !!process.versions.electron;
+}
+export function hideBin(argv) {
+ return argv.slice(getProcessArgvBinIndex() + 1);
+}
+export function getProcessArgvBin() {
+ return process.argv[getProcessArgvBinIndex()];
+}
diff --git a/node_modules/yargs/build/lib/utils/set-blocking.js b/node_modules/yargs/build/lib/utils/set-blocking.js
new file mode 100644
index 0000000..88fb806
--- /dev/null
+++ b/node_modules/yargs/build/lib/utils/set-blocking.js
@@ -0,0 +1,12 @@
+export default function setBlocking(blocking) {
+ if (typeof process === 'undefined')
+ return;
+ [process.stdout, process.stderr].forEach(_stream => {
+ const stream = _stream;
+ if (stream._handle &&
+ stream.isTTY &&
+ typeof stream._handle.setBlocking === 'function') {
+ stream._handle.setBlocking(blocking);
+ }
+ });
+}
diff --git a/node_modules/yargs/build/lib/utils/which-module.js b/node_modules/yargs/build/lib/utils/which-module.js
new file mode 100644
index 0000000..5974e22
--- /dev/null
+++ b/node_modules/yargs/build/lib/utils/which-module.js
@@ -0,0 +1,10 @@
+export default function whichModule(exported) {
+ if (typeof require === 'undefined')
+ return null;
+ for (let i = 0, files = Object.keys(require.cache), mod; i < files.length; i++) {
+ mod = require.cache[files[i]];
+ if (mod.exports === exported)
+ return mod;
+ }
+ return null;
+}
diff --git a/node_modules/yargs/build/lib/validation.js b/node_modules/yargs/build/lib/validation.js
new file mode 100644
index 0000000..c6f0ab0
--- /dev/null
+++ b/node_modules/yargs/build/lib/validation.js
@@ -0,0 +1,305 @@
+import { argsert } from './argsert.js';
+import { assertNotStrictEqual, } from './typings/common-types.js';
+import { levenshtein as distance } from './utils/levenshtein.js';
+import { objFilter } from './utils/obj-filter.js';
+const specialKeys = ['$0', '--', '_'];
+export function validation(yargs, usage, shim) {
+ const __ = shim.y18n.__;
+ const __n = shim.y18n.__n;
+ const self = {};
+ self.nonOptionCount = function nonOptionCount(argv) {
+ const demandedCommands = yargs.getDemandedCommands();
+ const positionalCount = argv._.length + (argv['--'] ? argv['--'].length : 0);
+ const _s = positionalCount - yargs.getInternalMethods().getContext().commands.length;
+ if (demandedCommands._ &&
+ (_s < demandedCommands._.min || _s > demandedCommands._.max)) {
+ if (_s < demandedCommands._.min) {
+ if (demandedCommands._.minMsg !== undefined) {
+ usage.fail(demandedCommands._.minMsg
+ ? demandedCommands._.minMsg
+ .replace(/\$0/g, _s.toString())
+ .replace(/\$1/, demandedCommands._.min.toString())
+ : null);
+ }
+ else {
+ usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s.toString(), demandedCommands._.min.toString()));
+ }
+ }
+ else if (_s > demandedCommands._.max) {
+ if (demandedCommands._.maxMsg !== undefined) {
+ usage.fail(demandedCommands._.maxMsg
+ ? demandedCommands._.maxMsg
+ .replace(/\$0/g, _s.toString())
+ .replace(/\$1/, demandedCommands._.max.toString())
+ : null);
+ }
+ else {
+ usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s.toString(), demandedCommands._.max.toString()));
+ }
+ }
+ }
+ };
+ self.positionalCount = function positionalCount(required, observed) {
+ if (observed < required) {
+ usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed + '', required + ''));
+ }
+ };
+ self.requiredArguments = function requiredArguments(argv, demandedOptions) {
+ let missing = null;
+ for (const key of Object.keys(demandedOptions)) {
+ if (!Object.prototype.hasOwnProperty.call(argv, key) ||
+ typeof argv[key] === 'undefined') {
+ missing = missing || {};
+ missing[key] = demandedOptions[key];
+ }
+ }
+ if (missing) {
+ const customMsgs = [];
+ for (const key of Object.keys(missing)) {
+ const msg = missing[key];
+ if (msg && customMsgs.indexOf(msg) < 0) {
+ customMsgs.push(msg);
+ }
+ }
+ const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : '';
+ usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg));
+ }
+ };
+ self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) {
+ var _a;
+ const commandKeys = yargs
+ .getInternalMethods()
+ .getCommandInstance()
+ .getCommands();
+ const unknown = [];
+ const currentContext = yargs.getInternalMethods().getContext();
+ Object.keys(argv).forEach(key => {
+ if (!specialKeys.includes(key) &&
+ !Object.prototype.hasOwnProperty.call(positionalMap, key) &&
+ !Object.prototype.hasOwnProperty.call(yargs.getInternalMethods().getParseContext(), key) &&
+ !self.isValidAndSomeAliasIsNotNew(key, aliases)) {
+ unknown.push(key);
+ }
+ });
+ if (checkPositionals &&
+ (currentContext.commands.length > 0 ||
+ commandKeys.length > 0 ||
+ isDefaultCommand)) {
+ argv._.slice(currentContext.commands.length).forEach(key => {
+ if (!commandKeys.includes('' + key)) {
+ unknown.push('' + key);
+ }
+ });
+ }
+ if (checkPositionals) {
+ const demandedCommands = yargs.getDemandedCommands();
+ const maxNonOptDemanded = ((_a = demandedCommands._) === null || _a === void 0 ? void 0 : _a.max) || 0;
+ const expected = currentContext.commands.length + maxNonOptDemanded;
+ if (expected < argv._.length) {
+ argv._.slice(expected).forEach(key => {
+ key = String(key);
+ if (!currentContext.commands.includes(key) &&
+ !unknown.includes(key)) {
+ unknown.push(key);
+ }
+ });
+ }
+ }
+ if (unknown.length) {
+ usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.join(', ')));
+ }
+ };
+ self.unknownCommands = function unknownCommands(argv) {
+ const commandKeys = yargs
+ .getInternalMethods()
+ .getCommandInstance()
+ .getCommands();
+ const unknown = [];
+ const currentContext = yargs.getInternalMethods().getContext();
+ if (currentContext.commands.length > 0 || commandKeys.length > 0) {
+ argv._.slice(currentContext.commands.length).forEach(key => {
+ if (!commandKeys.includes('' + key)) {
+ unknown.push('' + key);
+ }
+ });
+ }
+ if (unknown.length > 0) {
+ usage.fail(__n('Unknown command: %s', 'Unknown commands: %s', unknown.length, unknown.join(', ')));
+ return true;
+ }
+ else {
+ return false;
+ }
+ };
+ self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) {
+ if (!Object.prototype.hasOwnProperty.call(aliases, key)) {
+ return false;
+ }
+ const newAliases = yargs.parsed.newAliases;
+ return [key, ...aliases[key]].some(a => !Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]);
+ };
+ self.limitedChoices = function limitedChoices(argv) {
+ const options = yargs.getOptions();
+ const invalid = {};
+ if (!Object.keys(options.choices).length)
+ return;
+ Object.keys(argv).forEach(key => {
+ if (specialKeys.indexOf(key) === -1 &&
+ Object.prototype.hasOwnProperty.call(options.choices, key)) {
+ [].concat(argv[key]).forEach(value => {
+ if (options.choices[key].indexOf(value) === -1 &&
+ value !== undefined) {
+ invalid[key] = (invalid[key] || []).concat(value);
+ }
+ });
+ }
+ });
+ const invalidKeys = Object.keys(invalid);
+ if (!invalidKeys.length)
+ return;
+ let msg = __('Invalid values:');
+ invalidKeys.forEach(key => {
+ msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`;
+ });
+ usage.fail(msg);
+ };
+ let implied = {};
+ self.implies = function implies(key, value) {
+ argsert('<string|object> [array|number|string]', [key, value], arguments.length);
+ if (typeof key === 'object') {
+ Object.keys(key).forEach(k => {
+ self.implies(k, key[k]);
+ });
+ }
+ else {
+ yargs.global(key);
+ if (!implied[key]) {
+ implied[key] = [];
+ }
+ if (Array.isArray(value)) {
+ value.forEach(i => self.implies(key, i));
+ }
+ else {
+ assertNotStrictEqual(value, undefined, shim);
+ implied[key].push(value);
+ }
+ }
+ };
+ self.getImplied = function getImplied() {
+ return implied;
+ };
+ function keyExists(argv, val) {
+ const num = Number(val);
+ val = isNaN(num) ? val : num;
+ if (typeof val === 'number') {
+ val = argv._.length >= val;
+ }
+ else if (val.match(/^--no-.+/)) {
+ val = val.match(/^--no-(.+)/)[1];
+ val = !Object.prototype.hasOwnProperty.call(argv, val);
+ }
+ else {
+ val = Object.prototype.hasOwnProperty.call(argv, val);
+ }
+ return val;
+ }
+ self.implications = function implications(argv) {
+ const implyFail = [];
+ Object.keys(implied).forEach(key => {
+ const origKey = key;
+ (implied[key] || []).forEach(value => {
+ let key = origKey;
+ const origValue = value;
+ key = keyExists(argv, key);
+ value = keyExists(argv, value);
+ if (key && !value) {
+ implyFail.push(` ${origKey} -> ${origValue}`);
+ }
+ });
+ });
+ if (implyFail.length) {
+ let msg = `${__('Implications failed:')}\n`;
+ implyFail.forEach(value => {
+ msg += value;
+ });
+ usage.fail(msg);
+ }
+ };
+ let conflicting = {};
+ self.conflicts = function conflicts(key, value) {
+ argsert('<string|object> [array|string]', [key, value], arguments.length);
+ if (typeof key === 'object') {
+ Object.keys(key).forEach(k => {
+ self.conflicts(k, key[k]);
+ });
+ }
+ else {
+ yargs.global(key);
+ if (!conflicting[key]) {
+ conflicting[key] = [];
+ }
+ if (Array.isArray(value)) {
+ value.forEach(i => self.conflicts(key, i));
+ }
+ else {
+ conflicting[key].push(value);
+ }
+ }
+ };
+ self.getConflicting = () => conflicting;
+ self.conflicting = function conflictingFn(argv) {
+ Object.keys(argv).forEach(key => {
+ if (conflicting[key]) {
+ conflicting[key].forEach(value => {
+ if (value && argv[key] !== undefined && argv[value] !== undefined) {
+ usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
+ }
+ });
+ }
+ });
+ if (yargs.getInternalMethods().getParserConfiguration()['strip-dashed']) {
+ Object.keys(conflicting).forEach(key => {
+ conflicting[key].forEach(value => {
+ if (value &&
+ argv[shim.Parser.camelCase(key)] !== undefined &&
+ argv[shim.Parser.camelCase(value)] !== undefined) {
+ usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
+ }
+ });
+ });
+ }
+ };
+ self.recommendCommands = function recommendCommands(cmd, potentialCommands) {
+ const threshold = 3;
+ potentialCommands = potentialCommands.sort((a, b) => b.length - a.length);
+ let recommended = null;
+ let bestDistance = Infinity;
+ for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
+ const d = distance(cmd, candidate);
+ if (d <= threshold && d < bestDistance) {
+ bestDistance = d;
+ recommended = candidate;
+ }
+ }
+ if (recommended)
+ usage.fail(__('Did you mean %s?', recommended));
+ };
+ self.reset = function reset(localLookup) {
+ implied = objFilter(implied, k => !localLookup[k]);
+ conflicting = objFilter(conflicting, k => !localLookup[k]);
+ return self;
+ };
+ const frozens = [];
+ self.freeze = function freeze() {
+ frozens.push({
+ implied,
+ conflicting,
+ });
+ };
+ self.unfreeze = function unfreeze() {
+ const frozen = frozens.pop();
+ assertNotStrictEqual(frozen, undefined, shim);
+ ({ implied, conflicting } = frozen);
+ };
+ return self;
+}
diff --git a/node_modules/yargs/build/lib/yargs-factory.js b/node_modules/yargs/build/lib/yargs-factory.js
new file mode 100644
index 0000000..f4e63e2
--- /dev/null
+++ b/node_modules/yargs/build/lib/yargs-factory.js
@@ -0,0 +1,1483 @@
+var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
+ if (kind === "m") throw new TypeError("Private method is not writable");
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
+};
+var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
+};
+var _YargsInstance_command, _YargsInstance_cwd, _YargsInstance_context, _YargsInstance_completion, _YargsInstance_completionCommand, _YargsInstance_defaultShowHiddenOpt, _YargsInstance_exitError, _YargsInstance_detectLocale, _YargsInstance_emittedWarnings, _YargsInstance_exitProcess, _YargsInstance_frozens, _YargsInstance_globalMiddleware, _YargsInstance_groups, _YargsInstance_hasOutput, _YargsInstance_helpOpt, _YargsInstance_logger, _YargsInstance_output, _YargsInstance_options, _YargsInstance_parentRequire, _YargsInstance_parserConfig, _YargsInstance_parseFn, _YargsInstance_parseContext, _YargsInstance_pkgs, _YargsInstance_preservedGroups, _YargsInstance_processArgs, _YargsInstance_recommendCommands, _YargsInstance_shim, _YargsInstance_strict, _YargsInstance_strictCommands, _YargsInstance_strictOptions, _YargsInstance_usage, _YargsInstance_versionOpt, _YargsInstance_validation;
+import { command as Command, } from './command.js';
+import { assertNotStrictEqual, assertSingleKey, objectKeys, } from './typings/common-types.js';
+import { YError } from './yerror.js';
+import { usage as Usage } from './usage.js';
+import { argsert } from './argsert.js';
+import { completion as Completion, } from './completion.js';
+import { validation as Validation, } from './validation.js';
+import { objFilter } from './utils/obj-filter.js';
+import { applyExtends } from './utils/apply-extends.js';
+import { applyMiddleware, GlobalMiddleware, } from './middleware.js';
+import { isPromise } from './utils/is-promise.js';
+import { maybeAsyncResult } from './utils/maybe-async-result.js';
+import setBlocking from './utils/set-blocking.js';
+export function YargsFactory(_shim) {
+ return (processArgs = [], cwd = _shim.process.cwd(), parentRequire) => {
+ const yargs = new YargsInstance(processArgs, cwd, parentRequire, _shim);
+ Object.defineProperty(yargs, 'argv', {
+ get: () => {
+ return yargs.parse();
+ },
+ enumerable: true,
+ });
+ yargs.help();
+ yargs.version();
+ return yargs;
+ };
+}
+const kCopyDoubleDash = Symbol('copyDoubleDash');
+const kCreateLogger = Symbol('copyDoubleDash');
+const kDeleteFromParserHintObject = Symbol('deleteFromParserHintObject');
+const kEmitWarning = Symbol('emitWarning');
+const kFreeze = Symbol('freeze');
+const kGetDollarZero = Symbol('getDollarZero');
+const kGetParserConfiguration = Symbol('getParserConfiguration');
+const kGuessLocale = Symbol('guessLocale');
+const kGuessVersion = Symbol('guessVersion');
+const kParsePositionalNumbers = Symbol('parsePositionalNumbers');
+const kPkgUp = Symbol('pkgUp');
+const kPopulateParserHintArray = Symbol('populateParserHintArray');
+const kPopulateParserHintSingleValueDictionary = Symbol('populateParserHintSingleValueDictionary');
+const kPopulateParserHintArrayDictionary = Symbol('populateParserHintArrayDictionary');
+const kPopulateParserHintDictionary = Symbol('populateParserHintDictionary');
+const kSanitizeKey = Symbol('sanitizeKey');
+const kSetKey = Symbol('setKey');
+const kUnfreeze = Symbol('unfreeze');
+const kValidateAsync = Symbol('validateAsync');
+const kGetCommandInstance = Symbol('getCommandInstance');
+const kGetContext = Symbol('getContext');
+const kGetHasOutput = Symbol('getHasOutput');
+const kGetLoggerInstance = Symbol('getLoggerInstance');
+const kGetParseContext = Symbol('getParseContext');
+const kGetUsageInstance = Symbol('getUsageInstance');
+const kGetValidationInstance = Symbol('getValidationInstance');
+const kHasParseCallback = Symbol('hasParseCallback');
+const kPostProcess = Symbol('postProcess');
+const kRebase = Symbol('rebase');
+const kReset = Symbol('reset');
+const kRunYargsParserAndExecuteCommands = Symbol('runYargsParserAndExecuteCommands');
+const kRunValidation = Symbol('runValidation');
+const kSetHasOutput = Symbol('setHasOutput');
+const kTrackManuallySetKeys = Symbol('kTrackManuallySetKeys');
+export class YargsInstance {
+ constructor(processArgs = [], cwd, parentRequire, shim) {
+ this.customScriptName = false;
+ this.parsed = false;
+ _YargsInstance_command.set(this, void 0);
+ _YargsInstance_cwd.set(this, void 0);
+ _YargsInstance_context.set(this, { commands: [], fullCommands: [] });
+ _YargsInstance_completion.set(this, null);
+ _YargsInstance_completionCommand.set(this, null);
+ _YargsInstance_defaultShowHiddenOpt.set(this, 'show-hidden');
+ _YargsInstance_exitError.set(this, null);
+ _YargsInstance_detectLocale.set(this, true);
+ _YargsInstance_emittedWarnings.set(this, {});
+ _YargsInstance_exitProcess.set(this, true);
+ _YargsInstance_frozens.set(this, []);
+ _YargsInstance_globalMiddleware.set(this, void 0);
+ _YargsInstance_groups.set(this, {});
+ _YargsInstance_hasOutput.set(this, false);
+ _YargsInstance_helpOpt.set(this, null);
+ _YargsInstance_logger.set(this, void 0);
+ _YargsInstance_output.set(this, '');
+ _YargsInstance_options.set(this, void 0);
+ _YargsInstance_parentRequire.set(this, void 0);
+ _YargsInstance_parserConfig.set(this, {});
+ _YargsInstance_parseFn.set(this, null);
+ _YargsInstance_parseContext.set(this, null);
+ _YargsInstance_pkgs.set(this, {});
+ _YargsInstance_preservedGroups.set(this, {});
+ _YargsInstance_processArgs.set(this, void 0);
+ _YargsInstance_recommendCommands.set(this, false);
+ _YargsInstance_shim.set(this, void 0);
+ _YargsInstance_strict.set(this, false);
+ _YargsInstance_strictCommands.set(this, false);
+ _YargsInstance_strictOptions.set(this, false);
+ _YargsInstance_usage.set(this, void 0);
+ _YargsInstance_versionOpt.set(this, null);
+ _YargsInstance_validation.set(this, void 0);
+ __classPrivateFieldSet(this, _YargsInstance_shim, shim, "f");
+ __classPrivateFieldSet(this, _YargsInstance_processArgs, processArgs, "f");
+ __classPrivateFieldSet(this, _YargsInstance_cwd, cwd, "f");
+ __classPrivateFieldSet(this, _YargsInstance_parentRequire, parentRequire, "f");
+ __classPrivateFieldSet(this, _YargsInstance_globalMiddleware, new GlobalMiddleware(this), "f");
+ this.$0 = this[kGetDollarZero]();
+ this[kReset]();
+ __classPrivateFieldSet(this, _YargsInstance_command, __classPrivateFieldGet(this, _YargsInstance_command, "f"), "f");
+ __classPrivateFieldSet(this, _YargsInstance_usage, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), "f");
+ __classPrivateFieldSet(this, _YargsInstance_validation, __classPrivateFieldGet(this, _YargsInstance_validation, "f"), "f");
+ __classPrivateFieldSet(this, _YargsInstance_options, __classPrivateFieldGet(this, _YargsInstance_options, "f"), "f");
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").showHiddenOpt = __classPrivateFieldGet(this, _YargsInstance_defaultShowHiddenOpt, "f");
+ __classPrivateFieldSet(this, _YargsInstance_logger, this[kCreateLogger](), "f");
+ }
+ addHelpOpt(opt, msg) {
+ const defaultHelpOpt = 'help';
+ argsert('[string|boolean] [string]', [opt, msg], arguments.length);
+ if (__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")) {
+ this[kDeleteFromParserHintObject](__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"));
+ __classPrivateFieldSet(this, _YargsInstance_helpOpt, null, "f");
+ }
+ if (opt === false && msg === undefined)
+ return this;
+ __classPrivateFieldSet(this, _YargsInstance_helpOpt, typeof opt === 'string' ? opt : defaultHelpOpt, "f");
+ this.boolean(__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"));
+ this.describe(__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"), msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Show help'));
+ return this;
+ }
+ help(opt, msg) {
+ return this.addHelpOpt(opt, msg);
+ }
+ addShowHiddenOpt(opt, msg) {
+ argsert('[string|boolean] [string]', [opt, msg], arguments.length);
+ if (opt === false && msg === undefined)
+ return this;
+ const showHiddenOpt = typeof opt === 'string' ? opt : __classPrivateFieldGet(this, _YargsInstance_defaultShowHiddenOpt, "f");
+ this.boolean(showHiddenOpt);
+ this.describe(showHiddenOpt, msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Show hidden options'));
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").showHiddenOpt = showHiddenOpt;
+ return this;
+ }
+ showHidden(opt, msg) {
+ return this.addShowHiddenOpt(opt, msg);
+ }
+ alias(key, value) {
+ argsert('<object|string|array> [string|array]', [key, value], arguments.length);
+ this[kPopulateParserHintArrayDictionary](this.alias.bind(this), 'alias', key, value);
+ return this;
+ }
+ array(keys) {
+ argsert('<array|string>', [keys], arguments.length);
+ this[kPopulateParserHintArray]('array', keys);
+ this[kTrackManuallySetKeys](keys);
+ return this;
+ }
+ boolean(keys) {
+ argsert('<array|string>', [keys], arguments.length);
+ this[kPopulateParserHintArray]('boolean', keys);
+ this[kTrackManuallySetKeys](keys);
+ return this;
+ }
+ check(f, global) {
+ argsert('<function> [boolean]', [f, global], arguments.length);
+ this.middleware((argv, _yargs) => {
+ return maybeAsyncResult(() => {
+ return f(argv, _yargs.getOptions());
+ }, (result) => {
+ if (!result) {
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(__classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__('Argument check failed: %s', f.toString()));
+ }
+ else if (typeof result === 'string' || result instanceof Error) {
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(result.toString(), result);
+ }
+ return argv;
+ }, (err) => {
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(err.message ? err.message : err.toString(), err);
+ return argv;
+ });
+ }, false, global);
+ return this;
+ }
+ choices(key, value) {
+ argsert('<object|string|array> [string|array]', [key, value], arguments.length);
+ this[kPopulateParserHintArrayDictionary](this.choices.bind(this), 'choices', key, value);
+ return this;
+ }
+ coerce(keys, value) {
+ argsert('<object|string|array> [function]', [keys, value], arguments.length);
+ if (Array.isArray(keys)) {
+ if (!value) {
+ throw new YError('coerce callback must be provided');
+ }
+ for (const key of keys) {
+ this.coerce(key, value);
+ }
+ return this;
+ }
+ else if (typeof keys === 'object') {
+ for (const key of Object.keys(keys)) {
+ this.coerce(key, keys[key]);
+ }
+ return this;
+ }
+ if (!value) {
+ throw new YError('coerce callback must be provided');
+ }
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true;
+ __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").addCoerceMiddleware((argv, yargs) => {
+ let aliases;
+ return maybeAsyncResult(() => {
+ aliases = yargs.getAliases();
+ return value(argv[keys]);
+ }, (result) => {
+ argv[keys] = result;
+ if (aliases[keys]) {
+ for (const alias of aliases[keys]) {
+ argv[alias] = result;
+ }
+ }
+ return argv;
+ }, (err) => {
+ throw new YError(err.message);
+ });
+ }, keys);
+ return this;
+ }
+ conflicts(key1, key2) {
+ argsert('<string|object> [string|array]', [key1, key2], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").conflicts(key1, key2);
+ return this;
+ }
+ config(key = 'config', msg, parseFn) {
+ argsert('[object|string] [string|function] [function]', [key, msg, parseFn], arguments.length);
+ if (typeof key === 'object' && !Array.isArray(key)) {
+ key = applyExtends(key, __classPrivateFieldGet(this, _YargsInstance_cwd, "f"), this[kGetParserConfiguration]()['deep-merge-config'] || false, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = (__classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || []).concat(key);
+ return this;
+ }
+ if (typeof msg === 'function') {
+ parseFn = msg;
+ msg = undefined;
+ }
+ this.describe(key, msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Path to JSON config file'));
+ (Array.isArray(key) ? key : [key]).forEach(k => {
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").config[k] = parseFn || true;
+ });
+ return this;
+ }
+ completion(cmd, desc, fn) {
+ argsert('[string] [string|boolean|function] [function]', [cmd, desc, fn], arguments.length);
+ if (typeof desc === 'function') {
+ fn = desc;
+ desc = undefined;
+ }
+ __classPrivateFieldSet(this, _YargsInstance_completionCommand, cmd || __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") || 'completion', "f");
+ if (!desc && desc !== false) {
+ desc = 'generate completion script';
+ }
+ this.command(__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f"), desc);
+ if (fn)
+ __classPrivateFieldGet(this, _YargsInstance_completion, "f").registerFunction(fn);
+ return this;
+ }
+ command(cmd, description, builder, handler, middlewares, deprecated) {
+ argsert('<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]', [cmd, description, builder, handler, middlewares, deprecated], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_command, "f").addHandler(cmd, description, builder, handler, middlewares, deprecated);
+ return this;
+ }
+ commands(cmd, description, builder, handler, middlewares, deprecated) {
+ return this.command(cmd, description, builder, handler, middlewares, deprecated);
+ }
+ commandDir(dir, opts) {
+ argsert('<string> [object]', [dir, opts], arguments.length);
+ const req = __classPrivateFieldGet(this, _YargsInstance_parentRequire, "f") || __classPrivateFieldGet(this, _YargsInstance_shim, "f").require;
+ __classPrivateFieldGet(this, _YargsInstance_command, "f").addDirectory(dir, req, __classPrivateFieldGet(this, _YargsInstance_shim, "f").getCallerFile(), opts);
+ return this;
+ }
+ count(keys) {
+ argsert('<array|string>', [keys], arguments.length);
+ this[kPopulateParserHintArray]('count', keys);
+ this[kTrackManuallySetKeys](keys);
+ return this;
+ }
+ default(key, value, defaultDescription) {
+ argsert('<object|string|array> [*] [string]', [key, value, defaultDescription], arguments.length);
+ if (defaultDescription) {
+ assertSingleKey(key, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] = defaultDescription;
+ }
+ if (typeof value === 'function') {
+ assertSingleKey(key, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ if (!__classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key])
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] =
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").functionDescription(value);
+ value = value.call();
+ }
+ this[kPopulateParserHintSingleValueDictionary](this.default.bind(this), 'default', key, value);
+ return this;
+ }
+ defaults(key, value, defaultDescription) {
+ return this.default(key, value, defaultDescription);
+ }
+ demandCommand(min = 1, max, minMsg, maxMsg) {
+ argsert('[number] [number|string] [string|null|undefined] [string|null|undefined]', [min, max, minMsg, maxMsg], arguments.length);
+ if (typeof max !== 'number') {
+ minMsg = max;
+ max = Infinity;
+ }
+ this.global('_', false);
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedCommands._ = {
+ min,
+ max,
+ minMsg,
+ maxMsg,
+ };
+ return this;
+ }
+ demand(keys, max, msg) {
+ if (Array.isArray(max)) {
+ max.forEach(key => {
+ assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ this.demandOption(key, msg);
+ });
+ max = Infinity;
+ }
+ else if (typeof max !== 'number') {
+ msg = max;
+ max = Infinity;
+ }
+ if (typeof keys === 'number') {
+ assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ this.demandCommand(keys, max, msg, msg);
+ }
+ else if (Array.isArray(keys)) {
+ keys.forEach(key => {
+ assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ this.demandOption(key, msg);
+ });
+ }
+ else {
+ if (typeof msg === 'string') {
+ this.demandOption(keys, msg);
+ }
+ else if (msg === true || typeof msg === 'undefined') {
+ this.demandOption(keys);
+ }
+ }
+ return this;
+ }
+ demandOption(keys, msg) {
+ argsert('<object|string|array> [string]', [keys, msg], arguments.length);
+ this[kPopulateParserHintSingleValueDictionary](this.demandOption.bind(this), 'demandedOptions', keys, msg);
+ return this;
+ }
+ deprecateOption(option, message) {
+ argsert('<string> [string|boolean]', [option, message], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").deprecatedOptions[option] = message;
+ return this;
+ }
+ describe(keys, description) {
+ argsert('<object|string|array> [string]', [keys, description], arguments.length);
+ this[kSetKey](keys, true);
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").describe(keys, description);
+ return this;
+ }
+ detectLocale(detect) {
+ argsert('<boolean>', [detect], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_detectLocale, detect, "f");
+ return this;
+ }
+ env(prefix) {
+ argsert('[string|boolean]', [prefix], arguments.length);
+ if (prefix === false)
+ delete __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix;
+ else
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix = prefix || '';
+ return this;
+ }
+ epilogue(msg) {
+ argsert('<string>', [msg], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").epilog(msg);
+ return this;
+ }
+ epilog(msg) {
+ return this.epilogue(msg);
+ }
+ example(cmd, description) {
+ argsert('<string|array> [string]', [cmd, description], arguments.length);
+ if (Array.isArray(cmd)) {
+ cmd.forEach(exampleParams => this.example(...exampleParams));
+ }
+ else {
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").example(cmd, description);
+ }
+ return this;
+ }
+ exit(code, err) {
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
+ __classPrivateFieldSet(this, _YargsInstance_exitError, err, "f");
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"))
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.exit(code);
+ }
+ exitProcess(enabled = true) {
+ argsert('[boolean]', [enabled], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_exitProcess, enabled, "f");
+ return this;
+ }
+ fail(f) {
+ argsert('<function|boolean>', [f], arguments.length);
+ if (typeof f === 'boolean' && f !== false) {
+ throw new YError("Invalid first argument. Expected function or boolean 'false'");
+ }
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").failFn(f);
+ return this;
+ }
+ getAliases() {
+ return this.parsed ? this.parsed.aliases : {};
+ }
+ async getCompletion(args, done) {
+ argsert('<array> [function]', [args, done], arguments.length);
+ if (!done) {
+ return new Promise((resolve, reject) => {
+ __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
+ if (err)
+ reject(err);
+ else
+ resolve(completions);
+ });
+ });
+ }
+ else {
+ return __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, done);
+ }
+ }
+ getDemandedOptions() {
+ argsert([], 0);
+ return __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedOptions;
+ }
+ getDemandedCommands() {
+ argsert([], 0);
+ return __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedCommands;
+ }
+ getDeprecatedOptions() {
+ argsert([], 0);
+ return __classPrivateFieldGet(this, _YargsInstance_options, "f").deprecatedOptions;
+ }
+ getDetectLocale() {
+ return __classPrivateFieldGet(this, _YargsInstance_detectLocale, "f");
+ }
+ getExitProcess() {
+ return __classPrivateFieldGet(this, _YargsInstance_exitProcess, "f");
+ }
+ getGroups() {
+ return Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_groups, "f"), __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f"));
+ }
+ getHelp() {
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
+ if (!__classPrivateFieldGet(this, _YargsInstance_usage, "f").hasCachedHelpMessage()) {
+ if (!this.parsed) {
+ const parse = this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this, _YargsInstance_processArgs, "f"), undefined, undefined, 0, true);
+ if (isPromise(parse)) {
+ return parse.then(() => {
+ return __classPrivateFieldGet(this, _YargsInstance_usage, "f").help();
+ });
+ }
+ }
+ const builderResponse = __classPrivateFieldGet(this, _YargsInstance_command, "f").runDefaultBuilderOn(this);
+ if (isPromise(builderResponse)) {
+ return builderResponse.then(() => {
+ return __classPrivateFieldGet(this, _YargsInstance_usage, "f").help();
+ });
+ }
+ }
+ return Promise.resolve(__classPrivateFieldGet(this, _YargsInstance_usage, "f").help());
+ }
+ getOptions() {
+ return __classPrivateFieldGet(this, _YargsInstance_options, "f");
+ }
+ getStrict() {
+ return __classPrivateFieldGet(this, _YargsInstance_strict, "f");
+ }
+ getStrictCommands() {
+ return __classPrivateFieldGet(this, _YargsInstance_strictCommands, "f");
+ }
+ getStrictOptions() {
+ return __classPrivateFieldGet(this, _YargsInstance_strictOptions, "f");
+ }
+ global(globals, global) {
+ argsert('<string|array> [boolean]', [globals, global], arguments.length);
+ globals = [].concat(globals);
+ if (global !== false) {
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").local = __classPrivateFieldGet(this, _YargsInstance_options, "f").local.filter(l => globals.indexOf(l) === -1);
+ }
+ else {
+ globals.forEach(g => {
+ if (!__classPrivateFieldGet(this, _YargsInstance_options, "f").local.includes(g))
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").local.push(g);
+ });
+ }
+ return this;
+ }
+ group(opts, groupName) {
+ argsert('<string|array> <string>', [opts, groupName], arguments.length);
+ const existing = __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName] || __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName];
+ if (__classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName]) {
+ delete __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName];
+ }
+ const seen = {};
+ __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName] = (existing || []).concat(opts).filter(key => {
+ if (seen[key])
+ return false;
+ return (seen[key] = true);
+ });
+ return this;
+ }
+ hide(key) {
+ argsert('<string>', [key], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").hiddenOptions.push(key);
+ return this;
+ }
+ implies(key, value) {
+ argsert('<string|object> [number|string|array]', [key, value], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").implies(key, value);
+ return this;
+ }
+ locale(locale) {
+ argsert('[string]', [locale], arguments.length);
+ if (!locale) {
+ this[kGuessLocale]();
+ return __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.getLocale();
+ }
+ __classPrivateFieldSet(this, _YargsInstance_detectLocale, false, "f");
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.setLocale(locale);
+ return this;
+ }
+ middleware(callback, applyBeforeValidation, global) {
+ return __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").addMiddleware(callback, !!applyBeforeValidation, global);
+ }
+ nargs(key, value) {
+ argsert('<string|object|array> [number]', [key, value], arguments.length);
+ this[kPopulateParserHintSingleValueDictionary](this.nargs.bind(this), 'narg', key, value);
+ return this;
+ }
+ normalize(keys) {
+ argsert('<array|string>', [keys], arguments.length);
+ this[kPopulateParserHintArray]('normalize', keys);
+ return this;
+ }
+ number(keys) {
+ argsert('<array|string>', [keys], arguments.length);
+ this[kPopulateParserHintArray]('number', keys);
+ this[kTrackManuallySetKeys](keys);
+ return this;
+ }
+ option(key, opt) {
+ argsert('<string|object> [object]', [key, opt], arguments.length);
+ if (typeof key === 'object') {
+ Object.keys(key).forEach(k => {
+ this.options(k, key[k]);
+ });
+ }
+ else {
+ if (typeof opt !== 'object') {
+ opt = {};
+ }
+ this[kTrackManuallySetKeys](key);
+ if (__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f") && (key === 'version' || (opt === null || opt === void 0 ? void 0 : opt.alias) === 'version')) {
+ this[kEmitWarning]([
+ '"version" is a reserved word.',
+ 'Please do one of the following:',
+ '- Disable version with `yargs.version(false)` if using "version" as an option',
+ '- Use the built-in `yargs.version` method instead (if applicable)',
+ '- Use a different option key',
+ 'https://yargs.js.org/docs/#api-reference-version',
+ ].join('\n'), undefined, 'versionWarning');
+ }
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").key[key] = true;
+ if (opt.alias)
+ this.alias(key, opt.alias);
+ const deprecate = opt.deprecate || opt.deprecated;
+ if (deprecate) {
+ this.deprecateOption(key, deprecate);
+ }
+ const demand = opt.demand || opt.required || opt.require;
+ if (demand) {
+ this.demand(key, demand);
+ }
+ if (opt.demandOption) {
+ this.demandOption(key, typeof opt.demandOption === 'string' ? opt.demandOption : undefined);
+ }
+ if (opt.conflicts) {
+ this.conflicts(key, opt.conflicts);
+ }
+ if ('default' in opt) {
+ this.default(key, opt.default);
+ }
+ if (opt.implies !== undefined) {
+ this.implies(key, opt.implies);
+ }
+ if (opt.nargs !== undefined) {
+ this.nargs(key, opt.nargs);
+ }
+ if (opt.config) {
+ this.config(key, opt.configParser);
+ }
+ if (opt.normalize) {
+ this.normalize(key);
+ }
+ if (opt.choices) {
+ this.choices(key, opt.choices);
+ }
+ if (opt.coerce) {
+ this.coerce(key, opt.coerce);
+ }
+ if (opt.group) {
+ this.group(key, opt.group);
+ }
+ if (opt.boolean || opt.type === 'boolean') {
+ this.boolean(key);
+ if (opt.alias)
+ this.boolean(opt.alias);
+ }
+ if (opt.array || opt.type === 'array') {
+ this.array(key);
+ if (opt.alias)
+ this.array(opt.alias);
+ }
+ if (opt.number || opt.type === 'number') {
+ this.number(key);
+ if (opt.alias)
+ this.number(opt.alias);
+ }
+ if (opt.string || opt.type === 'string') {
+ this.string(key);
+ if (opt.alias)
+ this.string(opt.alias);
+ }
+ if (opt.count || opt.type === 'count') {
+ this.count(key);
+ }
+ if (typeof opt.global === 'boolean') {
+ this.global(key, opt.global);
+ }
+ if (opt.defaultDescription) {
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] = opt.defaultDescription;
+ }
+ if (opt.skipValidation) {
+ this.skipValidation(key);
+ }
+ const desc = opt.describe || opt.description || opt.desc;
+ this.describe(key, desc);
+ if (opt.hidden) {
+ this.hide(key);
+ }
+ if (opt.requiresArg) {
+ this.requiresArg(key);
+ }
+ }
+ return this;
+ }
+ options(key, opt) {
+ return this.option(key, opt);
+ }
+ parse(args, shortCircuit, _parseFn) {
+ argsert('[string|array] [function|boolean|object] [function]', [args, shortCircuit, _parseFn], arguments.length);
+ this[kFreeze]();
+ if (typeof args === 'undefined') {
+ args = __classPrivateFieldGet(this, _YargsInstance_processArgs, "f");
+ }
+ if (typeof shortCircuit === 'object') {
+ __classPrivateFieldSet(this, _YargsInstance_parseContext, shortCircuit, "f");
+ shortCircuit = _parseFn;
+ }
+ if (typeof shortCircuit === 'function') {
+ __classPrivateFieldSet(this, _YargsInstance_parseFn, shortCircuit, "f");
+ shortCircuit = false;
+ }
+ if (!shortCircuit)
+ __classPrivateFieldSet(this, _YargsInstance_processArgs, args, "f");
+ if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f"))
+ __classPrivateFieldSet(this, _YargsInstance_exitProcess, false, "f");
+ const parsed = this[kRunYargsParserAndExecuteCommands](args, !!shortCircuit);
+ const tmpParsed = this.parsed;
+ __classPrivateFieldGet(this, _YargsInstance_completion, "f").setParsed(this.parsed);
+ if (isPromise(parsed)) {
+ return parsed
+ .then(argv => {
+ if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f"))
+ __classPrivateFieldGet(this, _YargsInstance_parseFn, "f").call(this, __classPrivateFieldGet(this, _YargsInstance_exitError, "f"), argv, __classPrivateFieldGet(this, _YargsInstance_output, "f"));
+ return argv;
+ })
+ .catch(err => {
+ if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) {
+ __classPrivateFieldGet(this, _YargsInstance_parseFn, "f")(err, this.parsed.argv, __classPrivateFieldGet(this, _YargsInstance_output, "f"));
+ }
+ throw err;
+ })
+ .finally(() => {
+ this[kUnfreeze]();
+ this.parsed = tmpParsed;
+ });
+ }
+ else {
+ if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f"))
+ __classPrivateFieldGet(this, _YargsInstance_parseFn, "f").call(this, __classPrivateFieldGet(this, _YargsInstance_exitError, "f"), parsed, __classPrivateFieldGet(this, _YargsInstance_output, "f"));
+ this[kUnfreeze]();
+ this.parsed = tmpParsed;
+ }
+ return parsed;
+ }
+ parseAsync(args, shortCircuit, _parseFn) {
+ const maybePromise = this.parse(args, shortCircuit, _parseFn);
+ return !isPromise(maybePromise)
+ ? Promise.resolve(maybePromise)
+ : maybePromise;
+ }
+ parseSync(args, shortCircuit, _parseFn) {
+ const maybePromise = this.parse(args, shortCircuit, _parseFn);
+ if (isPromise(maybePromise)) {
+ throw new YError('.parseSync() must not be used with asynchronous builders, handlers, or middleware');
+ }
+ return maybePromise;
+ }
+ parserConfiguration(config) {
+ argsert('<object>', [config], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_parserConfig, config, "f");
+ return this;
+ }
+ pkgConf(key, rootPath) {
+ argsert('<string> [string]', [key, rootPath], arguments.length);
+ let conf = null;
+ const obj = this[kPkgUp](rootPath || __classPrivateFieldGet(this, _YargsInstance_cwd, "f"));
+ if (obj[key] && typeof obj[key] === 'object') {
+ conf = applyExtends(obj[key], rootPath || __classPrivateFieldGet(this, _YargsInstance_cwd, "f"), this[kGetParserConfiguration]()['deep-merge-config'] || false, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = (__classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || []).concat(conf);
+ }
+ return this;
+ }
+ positional(key, opts) {
+ argsert('<string> <object>', [key, opts], arguments.length);
+ const supportedOpts = [
+ 'default',
+ 'defaultDescription',
+ 'implies',
+ 'normalize',
+ 'choices',
+ 'conflicts',
+ 'coerce',
+ 'type',
+ 'describe',
+ 'desc',
+ 'description',
+ 'alias',
+ ];
+ opts = objFilter(opts, (k, v) => {
+ if (k === 'type' && !['string', 'number', 'boolean'].includes(v))
+ return false;
+ return supportedOpts.includes(k);
+ });
+ const fullCommand = __classPrivateFieldGet(this, _YargsInstance_context, "f").fullCommands[__classPrivateFieldGet(this, _YargsInstance_context, "f").fullCommands.length - 1];
+ const parseOptions = fullCommand
+ ? __classPrivateFieldGet(this, _YargsInstance_command, "f").cmdToParseOptions(fullCommand)
+ : {
+ array: [],
+ alias: {},
+ default: {},
+ demand: {},
+ };
+ objectKeys(parseOptions).forEach(pk => {
+ const parseOption = parseOptions[pk];
+ if (Array.isArray(parseOption)) {
+ if (parseOption.indexOf(key) !== -1)
+ opts[pk] = true;
+ }
+ else {
+ if (parseOption[key] && !(pk in opts))
+ opts[pk] = parseOption[key];
+ }
+ });
+ this.group(key, __classPrivateFieldGet(this, _YargsInstance_usage, "f").getPositionalGroupName());
+ return this.option(key, opts);
+ }
+ recommendCommands(recommend = true) {
+ argsert('[boolean]', [recommend], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_recommendCommands, recommend, "f");
+ return this;
+ }
+ required(keys, max, msg) {
+ return this.demand(keys, max, msg);
+ }
+ require(keys, max, msg) {
+ return this.demand(keys, max, msg);
+ }
+ requiresArg(keys) {
+ argsert('<array|string|object> [number]', [keys], arguments.length);
+ if (typeof keys === 'string' && __classPrivateFieldGet(this, _YargsInstance_options, "f").narg[keys]) {
+ return this;
+ }
+ else {
+ this[kPopulateParserHintSingleValueDictionary](this.requiresArg.bind(this), 'narg', keys, NaN);
+ }
+ return this;
+ }
+ showCompletionScript($0, cmd) {
+ argsert('[string] [string]', [$0, cmd], arguments.length);
+ $0 = $0 || this.$0;
+ __classPrivateFieldGet(this, _YargsInstance_logger, "f").log(__classPrivateFieldGet(this, _YargsInstance_completion, "f").generateCompletionScript($0, cmd || __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") || 'completion'));
+ return this;
+ }
+ showHelp(level) {
+ argsert('[string|function]', [level], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
+ if (!__classPrivateFieldGet(this, _YargsInstance_usage, "f").hasCachedHelpMessage()) {
+ if (!this.parsed) {
+ const parse = this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this, _YargsInstance_processArgs, "f"), undefined, undefined, 0, true);
+ if (isPromise(parse)) {
+ parse.then(() => {
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level);
+ });
+ return this;
+ }
+ }
+ const builderResponse = __classPrivateFieldGet(this, _YargsInstance_command, "f").runDefaultBuilderOn(this);
+ if (isPromise(builderResponse)) {
+ builderResponse.then(() => {
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level);
+ });
+ return this;
+ }
+ }
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level);
+ return this;
+ }
+ scriptName(scriptName) {
+ this.customScriptName = true;
+ this.$0 = scriptName;
+ return this;
+ }
+ showHelpOnFail(enabled, message) {
+ argsert('[boolean|string] [string]', [enabled, message], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelpOnFail(enabled, message);
+ return this;
+ }
+ showVersion(level) {
+ argsert('[string|function]', [level], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showVersion(level);
+ return this;
+ }
+ skipValidation(keys) {
+ argsert('<array|string>', [keys], arguments.length);
+ this[kPopulateParserHintArray]('skipValidation', keys);
+ return this;
+ }
+ strict(enabled) {
+ argsert('[boolean]', [enabled], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_strict, enabled !== false, "f");
+ return this;
+ }
+ strictCommands(enabled) {
+ argsert('[boolean]', [enabled], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_strictCommands, enabled !== false, "f");
+ return this;
+ }
+ strictOptions(enabled) {
+ argsert('[boolean]', [enabled], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_strictOptions, enabled !== false, "f");
+ return this;
+ }
+ string(keys) {
+ argsert('<array|string>', [keys], arguments.length);
+ this[kPopulateParserHintArray]('string', keys);
+ this[kTrackManuallySetKeys](keys);
+ return this;
+ }
+ terminalWidth() {
+ argsert([], 0);
+ return __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.stdColumns;
+ }
+ updateLocale(obj) {
+ return this.updateStrings(obj);
+ }
+ updateStrings(obj) {
+ argsert('<object>', [obj], arguments.length);
+ __classPrivateFieldSet(this, _YargsInstance_detectLocale, false, "f");
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.updateLocale(obj);
+ return this;
+ }
+ usage(msg, description, builder, handler) {
+ argsert('<string|null|undefined> [string|boolean] [function|object] [function]', [msg, description, builder, handler], arguments.length);
+ if (description !== undefined) {
+ assertNotStrictEqual(msg, null, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ if ((msg || '').match(/^\$0( |$)/)) {
+ return this.command(msg, description, builder, handler);
+ }
+ else {
+ throw new YError('.usage() description must start with $0 if being used as alias for .command()');
+ }
+ }
+ else {
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").usage(msg);
+ return this;
+ }
+ }
+ version(opt, msg, ver) {
+ const defaultVersionOpt = 'version';
+ argsert('[boolean|string] [string] [string]', [opt, msg, ver], arguments.length);
+ if (__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f")) {
+ this[kDeleteFromParserHintObject](__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f"));
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").version(undefined);
+ __classPrivateFieldSet(this, _YargsInstance_versionOpt, null, "f");
+ }
+ if (arguments.length === 0) {
+ ver = this[kGuessVersion]();
+ opt = defaultVersionOpt;
+ }
+ else if (arguments.length === 1) {
+ if (opt === false) {
+ return this;
+ }
+ ver = opt;
+ opt = defaultVersionOpt;
+ }
+ else if (arguments.length === 2) {
+ ver = msg;
+ msg = undefined;
+ }
+ __classPrivateFieldSet(this, _YargsInstance_versionOpt, typeof opt === 'string' ? opt : defaultVersionOpt, "f");
+ msg = msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Show version number');
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").version(ver || undefined);
+ this.boolean(__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f"));
+ this.describe(__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f"), msg);
+ return this;
+ }
+ wrap(cols) {
+ argsert('<number|null|undefined>', [cols], arguments.length);
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").wrap(cols);
+ return this;
+ }
+ [(_YargsInstance_command = new WeakMap(), _YargsInstance_cwd = new WeakMap(), _YargsInstance_context = new WeakMap(), _YargsInstance_completion = new WeakMap(), _YargsInstance_completionCommand = new WeakMap(), _YargsInstance_defaultShowHiddenOpt = new WeakMap(), _YargsInstance_exitError = new WeakMap(), _YargsInstance_detectLocale = new WeakMap(), _YargsInstance_emittedWarnings = new WeakMap(), _YargsInstance_exitProcess = new WeakMap(), _YargsInstance_frozens = new WeakMap(), _YargsInstance_globalMiddleware = new WeakMap(), _YargsInstance_groups = new WeakMap(), _YargsInstance_hasOutput = new WeakMap(), _YargsInstance_helpOpt = new WeakMap(), _YargsInstance_logger = new WeakMap(), _YargsInstance_output = new WeakMap(), _YargsInstance_options = new WeakMap(), _YargsInstance_parentRequire = new WeakMap(), _YargsInstance_parserConfig = new WeakMap(), _YargsInstance_parseFn = new WeakMap(), _YargsInstance_parseContext = new WeakMap(), _YargsInstance_pkgs = new WeakMap(), _YargsInstance_preservedGroups = new WeakMap(), _YargsInstance_processArgs = new WeakMap(), _YargsInstance_recommendCommands = new WeakMap(), _YargsInstance_shim = new WeakMap(), _YargsInstance_strict = new WeakMap(), _YargsInstance_strictCommands = new WeakMap(), _YargsInstance_strictOptions = new WeakMap(), _YargsInstance_usage = new WeakMap(), _YargsInstance_versionOpt = new WeakMap(), _YargsInstance_validation = new WeakMap(), kCopyDoubleDash)](argv) {
+ if (!argv._ || !argv['--'])
+ return argv;
+ argv._.push.apply(argv._, argv['--']);
+ try {
+ delete argv['--'];
+ }
+ catch (_err) { }
+ return argv;
+ }
+ [kCreateLogger]() {
+ return {
+ log: (...args) => {
+ if (!this[kHasParseCallback]())
+ console.log(...args);
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
+ if (__classPrivateFieldGet(this, _YargsInstance_output, "f").length)
+ __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + '\n', "f");
+ __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + args.join(' '), "f");
+ },
+ error: (...args) => {
+ if (!this[kHasParseCallback]())
+ console.error(...args);
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
+ if (__classPrivateFieldGet(this, _YargsInstance_output, "f").length)
+ __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + '\n', "f");
+ __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + args.join(' '), "f");
+ },
+ };
+ }
+ [kDeleteFromParserHintObject](optionKey) {
+ objectKeys(__classPrivateFieldGet(this, _YargsInstance_options, "f")).forEach((hintKey) => {
+ if (((key) => key === 'configObjects')(hintKey))
+ return;
+ const hint = __classPrivateFieldGet(this, _YargsInstance_options, "f")[hintKey];
+ if (Array.isArray(hint)) {
+ if (hint.includes(optionKey))
+ hint.splice(hint.indexOf(optionKey), 1);
+ }
+ else if (typeof hint === 'object') {
+ delete hint[optionKey];
+ }
+ });
+ delete __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions()[optionKey];
+ }
+ [kEmitWarning](warning, type, deduplicationId) {
+ if (!__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId]) {
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.emitWarning(warning, type);
+ __classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId] = true;
+ }
+ }
+ [kFreeze]() {
+ __classPrivateFieldGet(this, _YargsInstance_frozens, "f").push({
+ options: __classPrivateFieldGet(this, _YargsInstance_options, "f"),
+ configObjects: __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects.slice(0),
+ exitProcess: __classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"),
+ groups: __classPrivateFieldGet(this, _YargsInstance_groups, "f"),
+ strict: __classPrivateFieldGet(this, _YargsInstance_strict, "f"),
+ strictCommands: __classPrivateFieldGet(this, _YargsInstance_strictCommands, "f"),
+ strictOptions: __classPrivateFieldGet(this, _YargsInstance_strictOptions, "f"),
+ completionCommand: __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f"),
+ output: __classPrivateFieldGet(this, _YargsInstance_output, "f"),
+ exitError: __classPrivateFieldGet(this, _YargsInstance_exitError, "f"),
+ hasOutput: __classPrivateFieldGet(this, _YargsInstance_hasOutput, "f"),
+ parsed: this.parsed,
+ parseFn: __classPrivateFieldGet(this, _YargsInstance_parseFn, "f"),
+ parseContext: __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"),
+ });
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").freeze();
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").freeze();
+ __classPrivateFieldGet(this, _YargsInstance_command, "f").freeze();
+ __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").freeze();
+ }
+ [kGetDollarZero]() {
+ let $0 = '';
+ let default$0;
+ if (/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv()[0])) {
+ default$0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv().slice(1, 2);
+ }
+ else {
+ default$0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv().slice(0, 1);
+ }
+ $0 = default$0
+ .map(x => {
+ const b = this[kRebase](__classPrivateFieldGet(this, _YargsInstance_cwd, "f"), x);
+ return x.match(/^(\/|([a-zA-Z]:)?\\)/) && b.length < x.length ? b : x;
+ })
+ .join(' ')
+ .trim();
+ if (__classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('_') &&
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").getProcessArgvBin() === __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('_')) {
+ $0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f")
+ .getEnv('_')
+ .replace(`${__classPrivateFieldGet(this, _YargsInstance_shim, "f").path.dirname(__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.execPath())}/`, '');
+ }
+ return $0;
+ }
+ [kGetParserConfiguration]() {
+ return __classPrivateFieldGet(this, _YargsInstance_parserConfig, "f");
+ }
+ [kGuessLocale]() {
+ if (!__classPrivateFieldGet(this, _YargsInstance_detectLocale, "f"))
+ return;
+ const locale = __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('LC_ALL') ||
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('LC_MESSAGES') ||
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('LANG') ||
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('LANGUAGE') ||
+ 'en_US';
+ this.locale(locale.replace(/[.:].*/, ''));
+ }
+ [kGuessVersion]() {
+ const obj = this[kPkgUp]();
+ return obj.version || 'unknown';
+ }
+ [kParsePositionalNumbers](argv) {
+ const args = argv['--'] ? argv['--'] : argv._;
+ for (let i = 0, arg; (arg = args[i]) !== undefined; i++) {
+ if (__classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.looksLikeNumber(arg) &&
+ Number.isSafeInteger(Math.floor(parseFloat(`${arg}`)))) {
+ args[i] = Number(arg);
+ }
+ }
+ return argv;
+ }
+ [kPkgUp](rootPath) {
+ const npath = rootPath || '*';
+ if (__classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath])
+ return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath];
+ let obj = {};
+ try {
+ let startDir = rootPath || __classPrivateFieldGet(this, _YargsInstance_shim, "f").mainFilename;
+ if (!rootPath && __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.extname(startDir)) {
+ startDir = __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.dirname(startDir);
+ }
+ const pkgJsonPath = __classPrivateFieldGet(this, _YargsInstance_shim, "f").findUp(startDir, (dir, names) => {
+ if (names.includes('package.json')) {
+ return 'package.json';
+ }
+ else {
+ return undefined;
+ }
+ });
+ assertNotStrictEqual(pkgJsonPath, undefined, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ obj = JSON.parse(__classPrivateFieldGet(this, _YargsInstance_shim, "f").readFileSync(pkgJsonPath, 'utf8'));
+ }
+ catch (_noop) { }
+ __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath] = obj || {};
+ return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath];
+ }
+ [kPopulateParserHintArray](type, keys) {
+ keys = [].concat(keys);
+ keys.forEach(key => {
+ key = this[kSanitizeKey](key);
+ __classPrivateFieldGet(this, _YargsInstance_options, "f")[type].push(key);
+ });
+ }
+ [kPopulateParserHintSingleValueDictionary](builder, type, key, value) {
+ this[kPopulateParserHintDictionary](builder, type, key, value, (type, key, value) => {
+ __classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] = value;
+ });
+ }
+ [kPopulateParserHintArrayDictionary](builder, type, key, value) {
+ this[kPopulateParserHintDictionary](builder, type, key, value, (type, key, value) => {
+ __classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] = (__classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] || []).concat(value);
+ });
+ }
+ [kPopulateParserHintDictionary](builder, type, key, value, singleKeyHandler) {
+ if (Array.isArray(key)) {
+ key.forEach(k => {
+ builder(k, value);
+ });
+ }
+ else if (((key) => typeof key === 'object')(key)) {
+ for (const k of objectKeys(key)) {
+ builder(k, key[k]);
+ }
+ }
+ else {
+ singleKeyHandler(type, this[kSanitizeKey](key), value);
+ }
+ }
+ [kSanitizeKey](key) {
+ if (key === '__proto__')
+ return '___proto___';
+ return key;
+ }
+ [kSetKey](key, set) {
+ this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this), 'key', key, set);
+ return this;
+ }
+ [kUnfreeze]() {
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
+ const frozen = __classPrivateFieldGet(this, _YargsInstance_frozens, "f").pop();
+ assertNotStrictEqual(frozen, undefined, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
+ let configObjects;
+ (_a = this, _b = this, _c = this, _d = this, _e = this, _f = this, _g = this, _h = this, _j = this, _k = this, _l = this, _m = this, {
+ options: ({ set value(_o) { __classPrivateFieldSet(_a, _YargsInstance_options, _o, "f"); } }).value,
+ configObjects,
+ exitProcess: ({ set value(_o) { __classPrivateFieldSet(_b, _YargsInstance_exitProcess, _o, "f"); } }).value,
+ groups: ({ set value(_o) { __classPrivateFieldSet(_c, _YargsInstance_groups, _o, "f"); } }).value,
+ output: ({ set value(_o) { __classPrivateFieldSet(_d, _YargsInstance_output, _o, "f"); } }).value,
+ exitError: ({ set value(_o) { __classPrivateFieldSet(_e, _YargsInstance_exitError, _o, "f"); } }).value,
+ hasOutput: ({ set value(_o) { __classPrivateFieldSet(_f, _YargsInstance_hasOutput, _o, "f"); } }).value,
+ parsed: this.parsed,
+ strict: ({ set value(_o) { __classPrivateFieldSet(_g, _YargsInstance_strict, _o, "f"); } }).value,
+ strictCommands: ({ set value(_o) { __classPrivateFieldSet(_h, _YargsInstance_strictCommands, _o, "f"); } }).value,
+ strictOptions: ({ set value(_o) { __classPrivateFieldSet(_j, _YargsInstance_strictOptions, _o, "f"); } }).value,
+ completionCommand: ({ set value(_o) { __classPrivateFieldSet(_k, _YargsInstance_completionCommand, _o, "f"); } }).value,
+ parseFn: ({ set value(_o) { __classPrivateFieldSet(_l, _YargsInstance_parseFn, _o, "f"); } }).value,
+ parseContext: ({ set value(_o) { __classPrivateFieldSet(_m, _YargsInstance_parseContext, _o, "f"); } }).value,
+ } = frozen);
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = configObjects;
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").unfreeze();
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").unfreeze();
+ __classPrivateFieldGet(this, _YargsInstance_command, "f").unfreeze();
+ __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").unfreeze();
+ }
+ [kValidateAsync](validation, argv) {
+ return maybeAsyncResult(argv, result => {
+ validation(result);
+ return result;
+ });
+ }
+ getInternalMethods() {
+ return {
+ getCommandInstance: this[kGetCommandInstance].bind(this),
+ getContext: this[kGetContext].bind(this),
+ getHasOutput: this[kGetHasOutput].bind(this),
+ getLoggerInstance: this[kGetLoggerInstance].bind(this),
+ getParseContext: this[kGetParseContext].bind(this),
+ getParserConfiguration: this[kGetParserConfiguration].bind(this),
+ getUsageInstance: this[kGetUsageInstance].bind(this),
+ getValidationInstance: this[kGetValidationInstance].bind(this),
+ hasParseCallback: this[kHasParseCallback].bind(this),
+ postProcess: this[kPostProcess].bind(this),
+ reset: this[kReset].bind(this),
+ runValidation: this[kRunValidation].bind(this),
+ runYargsParserAndExecuteCommands: this[kRunYargsParserAndExecuteCommands].bind(this),
+ setHasOutput: this[kSetHasOutput].bind(this),
+ };
+ }
+ [kGetCommandInstance]() {
+ return __classPrivateFieldGet(this, _YargsInstance_command, "f");
+ }
+ [kGetContext]() {
+ return __classPrivateFieldGet(this, _YargsInstance_context, "f");
+ }
+ [kGetHasOutput]() {
+ return __classPrivateFieldGet(this, _YargsInstance_hasOutput, "f");
+ }
+ [kGetLoggerInstance]() {
+ return __classPrivateFieldGet(this, _YargsInstance_logger, "f");
+ }
+ [kGetParseContext]() {
+ return __classPrivateFieldGet(this, _YargsInstance_parseContext, "f") || {};
+ }
+ [kGetUsageInstance]() {
+ return __classPrivateFieldGet(this, _YargsInstance_usage, "f");
+ }
+ [kGetValidationInstance]() {
+ return __classPrivateFieldGet(this, _YargsInstance_validation, "f");
+ }
+ [kHasParseCallback]() {
+ return !!__classPrivateFieldGet(this, _YargsInstance_parseFn, "f");
+ }
+ [kPostProcess](argv, populateDoubleDash, calledFromCommand, runGlobalMiddleware) {
+ if (calledFromCommand)
+ return argv;
+ if (isPromise(argv))
+ return argv;
+ if (!populateDoubleDash) {
+ argv = this[kCopyDoubleDash](argv);
+ }
+ const parsePositionalNumbers = this[kGetParserConfiguration]()['parse-positional-numbers'] ||
+ this[kGetParserConfiguration]()['parse-positional-numbers'] === undefined;
+ if (parsePositionalNumbers) {
+ argv = this[kParsePositionalNumbers](argv);
+ }
+ if (runGlobalMiddleware) {
+ argv = applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), false);
+ }
+ return argv;
+ }
+ [kReset](aliases = {}) {
+ __classPrivateFieldSet(this, _YargsInstance_options, __classPrivateFieldGet(this, _YargsInstance_options, "f") || {}, "f");
+ const tmpOptions = {};
+ tmpOptions.local = __classPrivateFieldGet(this, _YargsInstance_options, "f").local || [];
+ tmpOptions.configObjects = __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || [];
+ const localLookup = {};
+ tmpOptions.local.forEach(l => {
+ localLookup[l] = true;
+ (aliases[l] || []).forEach(a => {
+ localLookup[a] = true;
+ });
+ });
+ Object.assign(__classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f"), Object.keys(__classPrivateFieldGet(this, _YargsInstance_groups, "f")).reduce((acc, groupName) => {
+ const keys = __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName].filter(key => !(key in localLookup));
+ if (keys.length > 0) {
+ acc[groupName] = keys;
+ }
+ return acc;
+ }, {}));
+ __classPrivateFieldSet(this, _YargsInstance_groups, {}, "f");
+ const arrayOptions = [
+ 'array',
+ 'boolean',
+ 'string',
+ 'skipValidation',
+ 'count',
+ 'normalize',
+ 'number',
+ 'hiddenOptions',
+ ];
+ const objectOptions = [
+ 'narg',
+ 'key',
+ 'alias',
+ 'default',
+ 'defaultDescription',
+ 'config',
+ 'choices',
+ 'demandedOptions',
+ 'demandedCommands',
+ 'deprecatedOptions',
+ ];
+ arrayOptions.forEach(k => {
+ tmpOptions[k] = (__classPrivateFieldGet(this, _YargsInstance_options, "f")[k] || []).filter((k) => !localLookup[k]);
+ });
+ objectOptions.forEach((k) => {
+ tmpOptions[k] = objFilter(__classPrivateFieldGet(this, _YargsInstance_options, "f")[k], k => !localLookup[k]);
+ });
+ tmpOptions.envPrefix = __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix;
+ __classPrivateFieldSet(this, _YargsInstance_options, tmpOptions, "f");
+ __classPrivateFieldSet(this, _YargsInstance_usage, __classPrivateFieldGet(this, _YargsInstance_usage, "f")
+ ? __classPrivateFieldGet(this, _YargsInstance_usage, "f").reset(localLookup)
+ : Usage(this, __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f");
+ __classPrivateFieldSet(this, _YargsInstance_validation, __classPrivateFieldGet(this, _YargsInstance_validation, "f")
+ ? __classPrivateFieldGet(this, _YargsInstance_validation, "f").reset(localLookup)
+ : Validation(this, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f");
+ __classPrivateFieldSet(this, _YargsInstance_command, __classPrivateFieldGet(this, _YargsInstance_command, "f")
+ ? __classPrivateFieldGet(this, _YargsInstance_command, "f").reset()
+ : Command(__classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_validation, "f"), __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f");
+ if (!__classPrivateFieldGet(this, _YargsInstance_completion, "f"))
+ __classPrivateFieldSet(this, _YargsInstance_completion, Completion(this, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_command, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f");
+ __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").reset();
+ __classPrivateFieldSet(this, _YargsInstance_completionCommand, null, "f");
+ __classPrivateFieldSet(this, _YargsInstance_output, '', "f");
+ __classPrivateFieldSet(this, _YargsInstance_exitError, null, "f");
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, false, "f");
+ this.parsed = false;
+ return this;
+ }
+ [kRebase](base, dir) {
+ return __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.relative(base, dir);
+ }
+ [kRunYargsParserAndExecuteCommands](args, shortCircuit, calledFromCommand, commandIndex = 0, helpOnly = false) {
+ let skipValidation = !!calledFromCommand || helpOnly;
+ args = args || __classPrivateFieldGet(this, _YargsInstance_processArgs, "f");
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
+ const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration['populate--'];
+ const config = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
+ 'populate--': true,
+ });
+ const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
+ configuration: { 'parse-positional-numbers': false, ...config },
+ }));
+ const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
+ let argvPromise = undefined;
+ const aliases = parsed.aliases;
+ let helpOptSet = false;
+ let versionOptSet = false;
+ Object.keys(argv).forEach(key => {
+ if (key === __classPrivateFieldGet(this, _YargsInstance_helpOpt, "f") && argv[key]) {
+ helpOptSet = true;
+ }
+ else if (key === __classPrivateFieldGet(this, _YargsInstance_versionOpt, "f") && argv[key]) {
+ versionOptSet = true;
+ }
+ });
+ argv.$0 = this.$0;
+ this.parsed = parsed;
+ if (commandIndex === 0) {
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").clearCachedHelpMessage();
+ }
+ try {
+ this[kGuessLocale]();
+ if (shortCircuit) {
+ return this[kPostProcess](argv, populateDoubleDash, !!calledFromCommand, false);
+ }
+ if (__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")) {
+ const helpCmds = [__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")]
+ .concat(aliases[__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")] || [])
+ .filter(k => k.length > 1);
+ if (helpCmds.includes('' + argv._[argv._.length - 1])) {
+ argv._.pop();
+ helpOptSet = true;
+ }
+ }
+ const handlerKeys = __classPrivateFieldGet(this, _YargsInstance_command, "f").getCommands();
+ const requestCompletions = __classPrivateFieldGet(this, _YargsInstance_completion, "f").completionKey in argv;
+ const skipRecommendation = helpOptSet || requestCompletions || helpOnly;
+ if (argv._.length) {
+ if (handlerKeys.length) {
+ let firstUnknownCommand;
+ for (let i = commandIndex || 0, cmd; argv._[i] !== undefined; i++) {
+ cmd = String(argv._[i]);
+ if (handlerKeys.includes(cmd) && cmd !== __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) {
+ const innerArgv = __classPrivateFieldGet(this, _YargsInstance_command, "f").runCommand(cmd, this, parsed, i + 1, helpOnly, helpOptSet || versionOptSet || helpOnly);
+ return this[kPostProcess](innerArgv, populateDoubleDash, !!calledFromCommand, false);
+ }
+ else if (!firstUnknownCommand &&
+ cmd !== __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) {
+ firstUnknownCommand = cmd;
+ break;
+ }
+ }
+ if (!__classPrivateFieldGet(this, _YargsInstance_command, "f").hasDefaultCommand() &&
+ __classPrivateFieldGet(this, _YargsInstance_recommendCommands, "f") &&
+ firstUnknownCommand &&
+ !skipRecommendation) {
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").recommendCommands(firstUnknownCommand, handlerKeys);
+ }
+ }
+ if (__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") &&
+ argv._.includes(__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) &&
+ !requestCompletions) {
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"))
+ setBlocking(true);
+ this.showCompletionScript();
+ this.exit(0);
+ }
+ }
+ if (__classPrivateFieldGet(this, _YargsInstance_command, "f").hasDefaultCommand() && !skipRecommendation) {
+ const innerArgv = __classPrivateFieldGet(this, _YargsInstance_command, "f").runCommand(null, this, parsed, 0, helpOnly, helpOptSet || versionOptSet || helpOnly);
+ return this[kPostProcess](innerArgv, populateDoubleDash, !!calledFromCommand, false);
+ }
+ if (requestCompletions) {
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"))
+ setBlocking(true);
+ args = [].concat(args);
+ const completionArgs = args.slice(args.indexOf(`--${__classPrivateFieldGet(this, _YargsInstance_completion, "f").completionKey}`) + 1);
+ __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(completionArgs, (err, completions) => {
+ if (err)
+ throw new YError(err.message);
+ (completions || []).forEach(completion => {
+ __classPrivateFieldGet(this, _YargsInstance_logger, "f").log(completion);
+ });
+ this.exit(0);
+ });
+ return this[kPostProcess](argv, !populateDoubleDash, !!calledFromCommand, false);
+ }
+ if (!__classPrivateFieldGet(this, _YargsInstance_hasOutput, "f")) {
+ if (helpOptSet) {
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"))
+ setBlocking(true);
+ skipValidation = true;
+ this.showHelp('log');
+ this.exit(0);
+ }
+ else if (versionOptSet) {
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"))
+ setBlocking(true);
+ skipValidation = true;
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showVersion('log');
+ this.exit(0);
+ }
+ }
+ if (!skipValidation && __classPrivateFieldGet(this, _YargsInstance_options, "f").skipValidation.length > 0) {
+ skipValidation = Object.keys(argv).some(key => __classPrivateFieldGet(this, _YargsInstance_options, "f").skipValidation.indexOf(key) >= 0 && argv[key] === true);
+ }
+ if (!skipValidation) {
+ if (parsed.error)
+ throw new YError(parsed.error.message);
+ if (!requestCompletions) {
+ const validation = this[kRunValidation](aliases, {}, parsed.error);
+ if (!calledFromCommand) {
+ argvPromise = applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), true);
+ }
+ argvPromise = this[kValidateAsync](validation, argvPromise !== null && argvPromise !== void 0 ? argvPromise : argv);
+ if (isPromise(argvPromise) && !calledFromCommand) {
+ argvPromise = argvPromise.then(() => {
+ return applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), false);
+ });
+ }
+ }
+ }
+ }
+ catch (err) {
+ if (err instanceof YError)
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(err.message, err);
+ else
+ throw err;
+ }
+ return this[kPostProcess](argvPromise !== null && argvPromise !== void 0 ? argvPromise : argv, populateDoubleDash, !!calledFromCommand, true);
+ }
+ [kRunValidation](aliases, positionalMap, parseErrors, isDefaultCommand) {
+ const demandedOptions = { ...this.getDemandedOptions() };
+ return (argv) => {
+ if (parseErrors)
+ throw new YError(parseErrors.message);
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").nonOptionCount(argv);
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").requiredArguments(argv, demandedOptions);
+ let failedStrictCommands = false;
+ if (__classPrivateFieldGet(this, _YargsInstance_strictCommands, "f")) {
+ failedStrictCommands = __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownCommands(argv);
+ }
+ if (__classPrivateFieldGet(this, _YargsInstance_strict, "f") && !failedStrictCommands) {
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownArguments(argv, aliases, positionalMap, !!isDefaultCommand);
+ }
+ else if (__classPrivateFieldGet(this, _YargsInstance_strictOptions, "f")) {
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownArguments(argv, aliases, {}, false, false);
+ }
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").limitedChoices(argv);
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").implications(argv);
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").conflicting(argv);
+ };
+ }
+ [kSetHasOutput]() {
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
+ }
+ [kTrackManuallySetKeys](keys) {
+ if (typeof keys === 'string') {
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true;
+ }
+ else {
+ for (const k of keys) {
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").key[k] = true;
+ }
+ }
+ }
+}
+export function isYargsInstance(y) {
+ return !!y && typeof y.getInternalMethods === 'function';
+}
diff --git a/node_modules/yargs/build/lib/yerror.js b/node_modules/yargs/build/lib/yerror.js
new file mode 100644
index 0000000..4cfef75
--- /dev/null
+++ b/node_modules/yargs/build/lib/yerror.js
@@ -0,0 +1,7 @@
+export class YError extends Error {
+ constructor(msg) {
+ super(msg || 'yargs error');
+ this.name = 'YError';
+ Error.captureStackTrace(this, YError);
+ }
+}