yargs 17.1.1-candidate.0 → 17.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/build/index.cjs +1 -1
- package/build/lib/completion-templates.js +1 -1
- package/build/lib/completion.js +35 -2
- package/build/lib/middleware.js +1 -4
- package/build/lib/usage.js +2 -1
- package/build/lib/validation.js +11 -0
- package/build/lib/yargs-factory.js +41 -6
- package/index.cjs +17 -7
- package/lib/platform-shims/browser.mjs +1 -0
- package/lib/platform-shims/esm.mjs +9 -3
- package/locales/uz.json +52 -0
- package/package.json +5 -5
- package/CHANGELOG.md +0 -167
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs/
|
|
2
|
+
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs/main/yargs-logo.png">
|
|
3
3
|
</p>
|
|
4
4
|
<h1 align="center"> Yargs </h1>
|
|
5
5
|
<p align="center">
|
|
@@ -103,7 +103,7 @@ yargs(hideBin(process.argv))
|
|
|
103
103
|
type: 'boolean',
|
|
104
104
|
description: 'Run with verbose logging'
|
|
105
105
|
})
|
|
106
|
-
.
|
|
106
|
+
.parse()
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
Run the example above with `--help` to see the help for the application.
|
|
@@ -138,7 +138,7 @@ yargs(Deno.args)
|
|
|
138
138
|
})
|
|
139
139
|
.strictCommands()
|
|
140
140
|
.demandCommand(1)
|
|
141
|
-
.
|
|
141
|
+
.parse()
|
|
142
142
|
```
|
|
143
143
|
|
|
144
144
|
### ESM
|
|
@@ -154,7 +154,7 @@ yargs(hideBin(process.argv))
|
|
|
154
154
|
console.info(argv)
|
|
155
155
|
})
|
|
156
156
|
.demandCommand(1)
|
|
157
|
-
.
|
|
157
|
+
.parse()
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
### Usage in Browser
|
|
@@ -199,6 +199,6 @@ post on why we think this is important](https://medium.com/the-node-js-collectio
|
|
|
199
199
|
[conventional-commits-url]: https://conventionalcommits.org/
|
|
200
200
|
[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
|
|
201
201
|
[slack-url]: http://devtoolscommunity.herokuapp.com
|
|
202
|
-
[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/
|
|
202
|
+
[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/main/types/yargs
|
|
203
203
|
[coverage-image]: https://img.shields.io/nycrc/yargs/yargs
|
|
204
|
-
[coverage-url]: https://github.com/yargs/yargs/blob/
|
|
204
|
+
[coverage-url]: https://github.com/yargs/yargs/blob/main/.nycrc
|
package/build/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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,n=[];function i(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(n.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(h),n.push(h),l=r?JSON.parse(s.readFileSync(h,"utf8")):require(t.extends),delete t.extends,l=i(l,s.path.dirname(h),a,s)}return n=[],a?r(l,t):Object.assign({},l,t)}function r(t,e){const s={};function n(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const i of Object.keys(e))n(e[i])&&n(s[i])?s[i]=r(t[i],e[i]):s[i]=e[i];return s}function o(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,n=e.shift();if(!n)throw new Error(`No command found in: ${t}`);const i={cmd:n.replace(s,""),demanded:[],optional:[]};return e.forEach(((t,n)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&n===e.length-1&&(r=!0),/^\[/.test(t)?i.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):i.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})})),i}const a=["first","second","third","fourth","fifth","sixth"];function h(t,s,n){try{let i=0;const[r,a,h]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,n],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,i),i+=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,i),i+=1}))}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,n){throw new e(`Invalid ${a[n]||"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,n){s.assert.notStrictEqual(t,e,n)}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((n=>{e(n,t[n])&&(s[n]=t[n])})),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,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(t):n?n.value:e.get(t)}function O(t,e,s,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,s):i?i.value=s:e.set(t,s),s}class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,n=!1){if(h("<array|function> [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let n=0;n<t.length;n++){if("function"!=typeof t[n])throw Error("middleware must be a function");const i=t[n];i.applyBeforeValidation=e,i.global=s}Array.prototype.push.apply(this.globalMiddleware,t)}else if("function"==typeof t){const i=t;i.applyBeforeValidation=e,i.global=s,i.mutates=n,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const s=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((t=>{const n=[...s[e]||[],e];return!t.option||!n.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,n){return s.reduce(((t,s)=>{if(s.applyBeforeValidation!==n)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 n=s(t,e);return f(n)?n.then((e=>Object.assign(t,e))):Object.assign(t,n)}}),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,n){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=n,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,n){"boolean"!=typeof(n=n||{}).recurse&&(n.recurse=!1),Array.isArray(n.extensions)||(n.extensions=["js"]);const i="function"==typeof n.visit?n.visit:t=>t;n.visit=(t,e,s)=>{const n=i(t,e,s);if(n){if(this.requireCache.has(e))return n;this.requireCache.add(e),this.addHandler(n)}return n},this.shim.requireDirectory({require:e,filename:s},t,n)}addHandler(t,e,s,n,i,r){let a=[];const h=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(i);if(n=n||(()=>{}),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 i=o(t);a=a.map((t=>o(t).cmd));let l=!1;const c=[i.cmd].concat(a).filter((t=>!_.test(t)||(l=!0,!1)));0===c.length&&l&&c.push("$0"),l&&(i.cmd=c[0],a=c.slice(1),t=t.replace(_,i.cmd)),a.forEach((t=>{this.aliasMap[t]=i.cmd})),!1!==e&&this.usage.command(t,e,l,a,r),this.handlers[i.cmd]={original:t,description:e,handler:n,builder:s||{},middlewares:h,deprecated:r,demanded:i.demanded,optional:i.optional},l&&(this.defaultCommand=this.handlers[i.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,n,i,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,n,i,r);return f(c)?c.then((t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,i,t.aliases,e))):this.applyMiddlewareAndGetResult(l,o,c.innerArgv,a,i,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,n,i,r,o,a){const h=e.builder;let l=s;if(E(h)){const c=h(s.getInternalMethods().reset(n),a);if(f(c))return c.then((n=>{var a;return l=(a=n)&&"function"==typeof a.getInternalMethods?n:s,this.parseAndUpdateUsage(t,e,l,i,r,o)}))}else(function(t){return"object"==typeof t})(h)&&(l=s.getInternalMethods().reset(n),Object.keys(e.builder).forEach((t=>{l.option(t,h[t])})));return this.parseAndUpdateUsage(t,e,l,i,r,o)}parseAndUpdateUsage(t,e,s,n,i,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(n,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,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,n=t.filter((t=>!_.test(t)));return n.push(s),`$0 ${n.join(" ")}`}applyMiddlewareAndGetResult(t,e,s,n,i,r,o){let a={};if(i)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,n,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 n=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(s,n,!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||(n.commands.pop(),n.fullCommands.pop()),s}populatePositionals(t,e,s,n){e._=e._.slice(s.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const t=i.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),n),o}populatePositional(t,e,s){const n=t.cmd[0];t.variadic?s[n]=e._.splice(0).map(String):e._.length&&(s[n]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=o(t);return s.demanded.forEach((t=>{const[s,...n]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=n,e.demand[s]=!0})),s.optional.forEach((t=>{const[s,...n]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=n})),e}postProcessPositionals(t,e,s,n){const i=Object.assign({},n.getOptions());i.default=Object.assign(s.default,i.default);for(const t of Object.keys(s.alias))i.alias[t]=(i.alias[t]||[]).concat(s.alias[t]);i.array=i.array.concat(s.array),i.config={};const r=[];if(Object.keys(e).forEach((t=>{e[t].map((e=>{i.configuration["unknown-options-as-args"]&&(i.key[t]=!0),r.push(`--${t}`),r.push(e)}))})),!r.length)return;const o=Object.assign({},i.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:o}));if(a.error)n.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 i=n.getOptions().default;Object.keys(a.argv).forEach((n=>{s.includes(n)&&(e[n]||(e[n]=a.argv[n]),!Object.prototype.hasOwnProperty.call(i,n)&&Object.prototype.hasOwnProperty.call(t,n)&&Object.prototype.hasOwnProperty.call(a.argv,n)&&(Array.isArray(t[n])||Array.isArray(a.argv[n]))?t[n]=[].concat(t[n],a.argv[n]):t[n]=a.argv[n])}))}}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,n=Object.keys(require.cache);s<n.length;s++)if(e=require.cache[n[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 n of[t,e,s]){if("string"==typeof n||!1===n)return n;d(n,!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 S(t){return"boolean"==typeof t}function $(t,s){const n=s.y18n.__,i={},r=[];i.failFn=function(t){r.push(t)};let o=null,a=!0;i.showHelpOnFail=function(t=!0,e){const[s,n]="string"==typeof t?[!0,t]:[t,e];return o=n,a=s,i};let h=!1;i.fail=function(s,n){const l=t.getInternalMethods().getLoggerInstance();if(!r.length){if(t.getExitProcess()&&x(!0),h||(h=!0,a&&(t.showHelp("error"),l.error()),(s||n)&&l.error(s||n),o&&((s||n)&&l.error(""),l.error(o))),n=n||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,n);throw n}for(let t=r.length-1;t>=0;--t){const e=r[t];if(S(e)){if(n)throw n;if(s)throw Error(s)}else e(s,n,i)}};let l=[],c=!1;i.usage=(t,e)=>null===t?(c=!0,l=[],i):(c=!1,l.push([t,e||""]),i),i.getUsage=()=>l,i.getUsageDisabled=()=>c,i.getPositionalGroupName=()=>n("Positionals:");let f=[];i.example=(t,e)=>{f.push([t,e||""])};let d=[];i.command=function(t,e,s,n,i=!1){s&&(d=d.map((t=>(t[2]=!1,t)))),d.push([t,e||"",s,n,i])},i.getCommands=()=>d;let u={};i.describe=function(t,e){Array.isArray(t)?t.forEach((t=>{i.describe(t,e)})):"object"==typeof t?Object.keys(t).forEach((e=>{i.describe(e,t[e])})):u[t]=e},i.getDescriptions=()=>u;let p=[];i.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}i.wrap=t=>{y=!0,m=t};const v="__yargsString__:";function O(t,e,n){let i=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{i=Math.max(s.stringWidth(n?`${n} ${I(t[0])}`:I(t[0]))+P(t[0]),i)})),e&&(i=Math.min(i,parseInt((.5*e).toString(),10))),i}let w;function C(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function j(t,e){let s=`[${n("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}]`}i.deferY18nLookup=t=>v+t,i.help=function(){if(w)return w;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach((n=>{s.alias[n].forEach((r=>{u[r]&&i.describe(n,u[r]),r in e&&t.demandOption(n,e[r]),s.boolean.includes(r)&&t.boolean(n),s.count.includes(r)&&t.count(n),s.string.includes(r)&&t.string(n),s.normalize.includes(r)&&t.normalize(n),s.array.includes(r)&&t.array(n),s.number.includes(r)&&t.number(n)}))}))}();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} <${n("command")}>\n`:`${e} [${n("command")}]\n`,_.div(`${t}`)}if(d.length>1||1===d.length&&!d[0][2]){_.div(n("Commands:"));const s=t.getInternalMethods().getContext(),i=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(d=d.sort(((t,e)=>t[0].localeCompare(e[0])))),d.forEach((t=>{const s=`${e} ${i}${t[0].replace(/^\$0 ?/,"")}`;_.span({text:s,padding:[0,2,0,2],width:O(d,y,`${e}${i}`)+4},{text:t[1]});const r=[];t[2]&&r.push(`[${n("default")}]`),t[3]&&t[3].length&&r.push(`[${n("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?r.push(`[${n("deprecated: %s",t[4])}]`):r.push(`[${n("deprecated")}]`)),r.length?_.div({text:r.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=n("Options:");h[k]||(h[k]=[]),function(t,e,s,n){let i=[],r=null;Object.keys(s).forEach((t=>{i=i.concat(s[t])})),t.forEach((t=>{r=[t].concat(e[t]),r.some((t=>-1!==i.indexOf(t)))||s[n].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===i.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!==i.getPositionalGroupName())).some((({normalizedKeys:t,switches:e})=>!t.every((t=>E(e[t])))))&&x.filter((({groupName:t})=>t!==i.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:e})=>{t.forEach((t=>{var s,n;E(e[t])&&(e[t]=(s=e[t],n="-x, ".length,A(s)?{text:s.text,indentation:s.indentation+n}:{text:s,indentation:n}))}))})),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=n(o.substring(v.length))),g.boolean.includes(t)&&(h=`[${n("boolean")}]`),g.count.includes(t)&&(h=`[${n("count")}]`),g.string.includes(t)&&(h=`[${n("string")}]`),g.normalize.includes(t)&&(h=`[${n("string")}]`),g.array.includes(t)&&(h=`[${n("array")}]`),g.number.includes(t)&&(h=`[${n("number")}]`);const l=[t in a?(c=a[t],"string"==typeof c?`[${n("deprecated: %s",c)}]`:`[${n("deprecated")}]`):null,h,t in r?`[${n("required")}]`:null,g.choices&&g.choices[t]?`[${n("choices:")} ${i.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+P(e)],width:O(s,y)+4},o),l?_.div({text:l,padding:[0,0,0,2],align:"right"}):_.div()})),_.div()})),f.length&&(_.div(n("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*$/,"")},i.cacheHelpMessage=function(){w=this.help()},i.clearCachedHelpMessage=function(){w=void 0},i.hasCachedHelpMessage=function(){return!!w},i.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(i.help())},i.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):n("generated-value"),")"].join(""),i.stringifiedValues=function(t,e){let s="";const n=e||", ",i=[].concat(t);return t&&i.length?(i.forEach((t=>{s.length&&(s+=n),s+=JSON.stringify(t)})),s):s};let _=null;i.version=t=>{_=t},i.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(_)},i.reset=function(t){return o=null,h=!1,l=[],c=!1,p=[],f=[],d=[],u=g(u,(e=>!t[e])),i};const M=[];return i.freeze=function(){M.push({failMessage:o,failureOutput:h,usages:l,usageDisabled:c,epilogs:p,examples:f,commands:d,descriptions:u})},i.unfreeze=function(){const t=M.pop();t&&({failMessage:o,failureOutput:h,usages:l,usageDisabled:c,epilogs:p,examples:f,commands:d,descriptions:u}=t)},i}function A(t){return"object"==typeof t}function P(t){return A(t)?t.indentation:0}function I(t){return A(t)?t.text:t}class N{constructor(t,e,s,n){var i,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=n,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=null!==(o=(null===(i=this.shim.getEnv("SHELL"))||void 0===i?void 0:i.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,n){const i=this.command.getCommandHandlers();for(let e=0,s=t.length;e<s;++e)if(i[t[e]]&&i[t[e]].builder){const s=i[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),n(null,r)}commandCompletions(t,e,s){const n=this.yargs.getInternalMethods().getContext().commands;s.match(/^-/)||n[n.length-1]===s||this.usage.getCommands().forEach((s=>{const n=o(s[0]).cmd;if(-1===e.indexOf(n))if(this.zshShell){const e=s[1]||"";t.push(n.replace(/:/g,"\\:")+":"+e)}else t.push(n)}))}optionCompletions(t,e,s,n){if(n.match(/^-/)||""===n&&0===t.length){const i=this.yargs.getOptions(),r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(i.key).forEach((o=>{const a=!!i.configuration["boolean-negation"]&&i.boolean.includes(o);r.includes(o)||this.argsContainKey(e,s,o,a)||(this.completeOptionKey(o,t,n),a&&i.default[o]&&this.completeOptionKey(`no-${o}`,t,n))}))}}argsContainKey(t,e,s,n){if(-1!==t.indexOf(`--${s}`))return!0;if(n&&-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 n=this.usage.getDescriptions(),i=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";if(this.zshShell){const s=n[t]||"";e.push(i+`${t.replace(/:/g,"\\:")}:${s.replace("__yargsString__:","")}`)}else e.push(i+t)}customCompletion(t,e,s,n){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((()=>{n(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{n(t,void 0)}))})):n(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,((i=n)=>this.defaultCompletion(t,e,s,i)),(t=>{n(null,t)})):this.customCompletionFunction(s,e,(t=>{n(null,t)}))}getCompletion(t,e){const s=t.length?t[t.length-1]:"",n=this.yargs.parse(t,!0),i=this.customCompletionFunction?n=>this.customCompletion(t,n,s,e):n=>this.defaultCompletion(t,n,s,e);return f(n)?n.then(i):i(n)}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 default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const n=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,n),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 D(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let n,i;for(n=0;n<=e.length;n++)s[n]=[n];for(i=0;i<=t.length;i++)s[0][i]=i;for(n=1;n<=e.length;n++)for(i=1;i<=t.length;i++)e.charAt(n-1)===t.charAt(i-1)?s[n][i]=s[n-1][i-1]:n>1&&i>1&&e.charAt(n-2)===t.charAt(i-1)&&e.charAt(n-1)===t.charAt(i-2)?s[n][i]=s[n-2][i-2]+1:s[n][i]=Math.min(s[n-1][i-1]+1,Math.min(s[n][i-1]+1,s[n-1][i]+1));return s[e.length][t.length]}const z=["$0","--","_"];var q,H,F,U,W,L,V,R,T,G,B,K,Y,J,Z,X,Q,tt,et,st,nt,it,rt,ot,at,ht,lt,ct,ft,dt,ut,pt;const gt=Symbol("copyDoubleDash"),mt=Symbol("copyDoubleDash"),yt=Symbol("deleteFromParserHintObject"),bt=Symbol("freeze"),vt=Symbol("getDollarZero"),Ot=Symbol("getParserConfiguration"),wt=Symbol("guessLocale"),Ct=Symbol("guessVersion"),jt=Symbol("parsePositionalNumbers"),_t=Symbol("pkgUp"),Mt=Symbol("populateParserHintArray"),kt=Symbol("populateParserHintSingleValueDictionary"),Et=Symbol("populateParserHintArrayDictionary"),xt=Symbol("populateParserHintDictionary"),St=Symbol("sanitizeKey"),$t=Symbol("setKey"),At=Symbol("unfreeze"),Pt=Symbol("validateAsync"),It=Symbol("getCommandInstance"),Nt=Symbol("getContext"),Dt=Symbol("getHasOutput"),zt=Symbol("getLoggerInstance"),qt=Symbol("getParseContext"),Ht=Symbol("getUsageInstance"),Ft=Symbol("getValidationInstance"),Ut=Symbol("hasParseCallback"),Wt=Symbol("postProcess"),Lt=Symbol("rebase"),Vt=Symbol("reset"),Rt=Symbol("runYargsParserAndExecuteCommands"),Tt=Symbol("runValidation"),Gt=Symbol("setHasOutput");class Bt{constructor(t=[],e,s,n){this.customScriptName=!1,this.parsed=!1,q.set(this,void 0),H.set(this,void 0),F.set(this,{commands:[],fullCommands:[]}),U.set(this,null),W.set(this,null),L.set(this,"show-hidden"),V.set(this,null),R.set(this,!0),T.set(this,!0),G.set(this,[]),B.set(this,void 0),K.set(this,{}),Y.set(this,!1),J.set(this,null),Z.set(this,void 0),X.set(this,""),Q.set(this,void 0),tt.set(this,void 0),et.set(this,{}),st.set(this,null),nt.set(this,null),it.set(this,{}),rt.set(this,{}),ot.set(this,void 0),at.set(this,!1),ht.set(this,void 0),lt.set(this,!1),ct.set(this,!1),ft.set(this,!1),dt.set(this,void 0),ut.set(this,null),pt.set(this,void 0),O(this,ht,n,"f"),O(this,ot,t,"f"),O(this,H,e,"f"),O(this,tt,s,"f"),O(this,B,new w(this),"f"),this.$0=this[vt](),this[Vt](),O(this,q,v(this,q,"f"),"f"),O(this,dt,v(this,dt,"f"),"f"),O(this,pt,v(this,pt,"f"),"f"),O(this,Q,v(this,Q,"f"),"f"),v(this,Q,"f").showHiddenOpt=v(this,L,"f"),O(this,Z,this[mt](),"f")}addHelpOpt(t,e){return h("[string|boolean] [string]",[t,e],arguments.length),v(this,J,"f")&&(this[yt](v(this,J,"f")),O(this,J,null,"f")),!1===t&&void 0===e||(O(this,J,"string"==typeof t?t:"help","f"),this.boolean(v(this,J,"f")),this.describe(v(this,J,"f"),e||v(this,dt,"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,dt,"f").deferY18nLookup("Show hidden options")),v(this,Q,"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[Et](this.alias.bind(this),"alias",t,e),this}array(t){return h("<array|string>",[t],arguments.length),this[Mt]("array",t),this}boolean(t){return h("<array|string>",[t],arguments.length),this[Mt]("boolean",t),this}check(t,e){return h("<function> [boolean]",[t,e],arguments.length),this.middleware(((e,s)=>j((()=>t(e)),(s=>(s?("string"==typeof s||s instanceof Error)&&v(this,dt,"f").fail(s.toString(),s):v(this,dt,"f").fail(v(this,ht,"f").y18n.__("Argument check failed: %s",t.toString())),e)),(t=>(v(this,dt,"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[Et](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,Q,"f").key[t]=!0,v(this,B,"f").addCoerceMiddleware(((n,i)=>{let r;return j((()=>(r=i.getAliases(),s(n[t]))),(e=>{if(n[t]=e,r[t])for(const s of r[t])n[s]=e;return n}),(t=>{throw new e(t.message)}))}),t),this}conflicts(t,e){return h("<string|object> [string|array]",[t,e],arguments.length),v(this,pt,"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,dt,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{v(this,Q,"f").config[t]=s||!0})),this):(t=i(t,v(this,H,"f"),this[Ot]()["deep-merge-config"]||!1,v(this,ht,"f")),v(this,Q,"f").configObjects=(v(this,Q,"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,W,t||v(this,W,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(v(this,W,"f"),e),s&&v(this,U,"f").registerFunction(s),this}command(t,e,s,n,i,r){return h("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,n,i,r],arguments.length),v(this,q,"f").addHandler(t,e,s,n,i,r),this}commands(t,e,s,n,i,r){return this.command(t,e,s,n,i,r)}commandDir(t,e){h("<string> [object]",[t,e],arguments.length);const s=v(this,tt,"f")||v(this,ht,"f").require;return v(this,q,"f").addDirectory(t,s,v(this,ht,"f").getCallerFile(),e),this}count(t){return h("<array|string>",[t],arguments.length),this[Mt]("count",t),this}default(t,e,s){return h("<object|string|array> [*] [string]",[t,e,s],arguments.length),s&&(u(t,v(this,ht,"f")),v(this,Q,"f").defaultDescription[t]=s),"function"==typeof e&&(u(t,v(this,ht,"f")),v(this,Q,"f").defaultDescription[t]||(v(this,Q,"f").defaultDescription[t]=v(this,dt,"f").functionDescription(e)),e=e.call()),this[kt](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,n){return h("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,n],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),v(this,Q,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:n},this}demand(t,e,s){return Array.isArray(e)?(e.forEach((t=>{d(s,!0,v(this,ht,"f")),this.demandOption(t,s)})),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(d(s,!0,v(this,ht,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach((t=>{d(s,!0,v(this,ht,"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[kt](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return h("<string> [string|boolean]",[t,e],arguments.length),v(this,Q,"f").deprecatedOptions[t]=e,this}describe(t,e){return h("<object|string|array> [string]",[t,e],arguments.length),this[$t](t,!0),v(this,dt,"f").describe(t,e),this}detectLocale(t){return h("<boolean>",[t],arguments.length),O(this,R,t,"f"),this}env(t){return h("[string|boolean]",[t],arguments.length),!1===t?delete v(this,Q,"f").envPrefix:v(this,Q,"f").envPrefix=t||"",this}epilogue(t){return h("<string>",[t],arguments.length),v(this,dt,"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,dt,"f").example(t,e),this}exit(t,e){O(this,Y,!0,"f"),O(this,V,e,"f"),v(this,T,"f")&&v(this,ht,"f").process.exit(t)}exitProcess(t=!0){return h("[boolean]",[t],arguments.length),O(this,T,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,dt,"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,n)=>{t?s(t):e(n)}))}))}getDemandedOptions(){return h([],0),v(this,Q,"f").demandedOptions}getDemandedCommands(){return h([],0),v(this,Q,"f").demandedCommands}getDeprecatedOptions(){return h([],0),v(this,Q,"f").deprecatedOptions}getDetectLocale(){return v(this,R,"f")}getExitProcess(){return v(this,T,"f")}getGroups(){return Object.assign({},v(this,K,"f"),v(this,rt,"f"))}getHelp(){if(O(this,Y,!0,"f"),!v(this,dt,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Rt](v(this,ot,"f"),void 0,void 0,0,!0);if(f(t))return t.then((()=>v(this,dt,"f").help()))}const t=v(this,q,"f").runDefaultBuilderOn(this);if(f(t))return t.then((()=>v(this,dt,"f").help()))}return Promise.resolve(v(this,dt,"f").help())}getOptions(){return v(this,Q,"f")}getStrict(){return v(this,lt,"f")}getStrictCommands(){return v(this,ct,"f")}getStrictOptions(){return v(this,ft,"f")}global(t,e){return h("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?v(this,Q,"f").local=v(this,Q,"f").local.filter((e=>-1===t.indexOf(e))):t.forEach((t=>{v(this,Q,"f").local.includes(t)||v(this,Q,"f").local.push(t)})),this}group(t,e){h("<string|array> <string>",[t,e],arguments.length);const s=v(this,rt,"f")[e]||v(this,K,"f")[e];v(this,rt,"f")[e]&&delete v(this,rt,"f")[e];const n={};return v(this,K,"f")[e]=(s||[]).concat(t).filter((t=>!n[t]&&(n[t]=!0))),this}hide(t){return h("<string>",[t],arguments.length),v(this,Q,"f").hiddenOptions.push(t),this}implies(t,e){return h("<string|object> [number|string|array]",[t,e],arguments.length),v(this,pt,"f").implies(t,e),this}locale(t){return h("[string]",[t],arguments.length),t?(O(this,R,!1,"f"),v(this,ht,"f").y18n.setLocale(t),this):(this[wt](),v(this,ht,"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[kt](this.nargs.bind(this),"narg",t,e),this}normalize(t){return h("<array|string>",[t],arguments.length),this[Mt]("normalize",t),this}number(t){return h("<array|string>",[t],arguments.length),this[Mt]("number",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={}),v(this,Q,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const n=e.demand||e.required||e.require;n&&this.demand(t,n),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,Q,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const i=e.describe||e.description||e.desc;this.describe(t,i),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[bt](),void 0===t&&(t=v(this,ot,"f")),"object"==typeof e&&(O(this,nt,e,"f"),e=s),"function"==typeof e&&(O(this,st,e,"f"),e=!1),e||O(this,ot,t,"f"),v(this,st,"f")&&O(this,T,!1,"f");const n=this[Rt](t,!!e),i=this.parsed;return v(this,U,"f").setParsed(this.parsed),f(n)?n.then((t=>(v(this,st,"f")&&v(this,st,"f").call(this,v(this,V,"f"),t,v(this,X,"f")),t))).catch((t=>{throw v(this,st,"f")&&v(this,st,"f")(t,this.parsed.argv,v(this,X,"f")),t})).finally((()=>{this[At](),this.parsed=i})):(v(this,st,"f")&&v(this,st,"f").call(this,v(this,V,"f"),n,v(this,X,"f")),this[At](),this.parsed=i,n)}parseAsync(t,e,s){const n=this.parse(t,e,s);return f(n)?n:Promise.resolve(n)}parseSync(t,s,n){const i=this.parse(t,s,n);if(f(i))throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return h("<object>",[t],arguments.length),O(this,et,t,"f"),this}pkgConf(t,e){h("<string> [string]",[t,e],arguments.length);let s=null;const n=this[_t](e||v(this,H,"f"));return n[t]&&"object"==typeof n[t]&&(s=i(n[t],e||v(this,H,"f"),this[Ot]()["deep-merge-config"]||!1,v(this,ht,"f")),v(this,Q,"f").configObjects=(v(this,Q,"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 n=v(this,F,"f").fullCommands[v(this,F,"f").fullCommands.length-1],i=n?v(this,q,"f").cmdToParseOptions(n):{array:[],alias:{},default:{},demand:{}};return p(i).forEach((s=>{const n=i[s];Array.isArray(n)?-1!==n.indexOf(t)&&(e[s]=!0):n[t]&&!(s in e)&&(e[s]=n[t])})),this.group(t,v(this,dt,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return h("[boolean]",[t],arguments.length),O(this,at,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,Q,"f").narg[t]||this[kt](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,Z,"f").log(v(this,U,"f").generateCompletionScript(t,e||v(this,W,"f")||"completion")),this}showHelp(t){if(h("[string|function]",[t],arguments.length),O(this,Y,!0,"f"),!v(this,dt,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Rt](v(this,ot,"f"),void 0,void 0,0,!0);if(f(e))return e.then((()=>{v(this,dt,"f").showHelp(t)})),this}const e=v(this,q,"f").runDefaultBuilderOn(this);if(f(e))return e.then((()=>{v(this,dt,"f").showHelp(t)})),this}return v(this,dt,"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,dt,"f").showHelpOnFail(t,e),this}showVersion(t){return h("[string|function]",[t],arguments.length),v(this,dt,"f").showVersion(t),this}skipValidation(t){return h("<array|string>",[t],arguments.length),this[Mt]("skipValidation",t),this}strict(t){return h("[boolean]",[t],arguments.length),O(this,lt,!1!==t,"f"),this}strictCommands(t){return h("[boolean]",[t],arguments.length),O(this,ct,!1!==t,"f"),this}strictOptions(t){return h("[boolean]",[t],arguments.length),O(this,ft,!1!==t,"f"),this}string(t){return h("<array|string>",[t],arguments.length),this[Mt]("string",t),this}terminalWidth(){return h([],0),v(this,ht,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return h("<object>",[t],arguments.length),O(this,R,!1,"f"),v(this,ht,"f").y18n.updateLocale(t),this}usage(t,s,n,i){if(h("<string|null|undefined> [string|boolean] [function|object] [function]",[t,s,n,i],arguments.length),void 0!==s){if(d(t,null,v(this,ht,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,s,n,i);throw new e(".usage() description must start with $0 if being used as alias for .command()")}return v(this,dt,"f").usage(t),this}version(t,e,s){const n="version";if(h("[boolean|string] [string] [string]",[t,e,s],arguments.length),v(this,ut,"f")&&(this[yt](v(this,ut,"f")),v(this,dt,"f").version(void 0),O(this,ut,null,"f")),0===arguments.length)s=this[Ct](),t=n;else if(1===arguments.length){if(!1===t)return this;s=t,t=n}else 2===arguments.length&&(s=e,e=void 0);return O(this,ut,"string"==typeof t?t:n,"f"),e=e||v(this,dt,"f").deferY18nLookup("Show version number"),v(this,dt,"f").version(s||void 0),this.boolean(v(this,ut,"f")),this.describe(v(this,ut,"f"),e),this}wrap(t){return h("<number|null|undefined>",[t],arguments.length),v(this,dt,"f").wrap(t),this}[(q=new WeakMap,H=new WeakMap,F=new WeakMap,U=new WeakMap,W=new WeakMap,L=new WeakMap,V=new WeakMap,R=new WeakMap,T=new WeakMap,G=new WeakMap,B=new WeakMap,K=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,nt=new WeakMap,it=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)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[mt](){return{log:(...t)=>{this[Ut]()||console.log(...t),O(this,Y,!0,"f"),v(this,X,"f").length&&O(this,X,v(this,X,"f")+"\n","f"),O(this,X,v(this,X,"f")+t.join(" "),"f")},error:(...t)=>{this[Ut]()||console.error(...t),O(this,Y,!0,"f"),v(this,X,"f").length&&O(this,X,v(this,X,"f")+"\n","f"),O(this,X,v(this,X,"f")+t.join(" "),"f")}}}[yt](t){p(v(this,Q,"f")).forEach((e=>{if("configObjects"===e)return;const s=v(this,Q,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]})),delete v(this,dt,"f").getDescriptions()[t]}[bt](){v(this,G,"f").push({options:v(this,Q,"f"),configObjects:v(this,Q,"f").configObjects.slice(0),exitProcess:v(this,T,"f"),groups:v(this,K,"f"),strict:v(this,lt,"f"),strictCommands:v(this,ct,"f"),strictOptions:v(this,ft,"f"),completionCommand:v(this,W,"f"),output:v(this,X,"f"),exitError:v(this,V,"f"),hasOutput:v(this,Y,"f"),parsed:this.parsed,parseFn:v(this,st,"f"),parseContext:v(this,nt,"f")}),v(this,dt,"f").freeze(),v(this,pt,"f").freeze(),v(this,q,"f").freeze(),v(this,B,"f").freeze()}[vt](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(v(this,ht,"f").process.argv()[0])?v(this,ht,"f").process.argv().slice(1,2):v(this,ht,"f").process.argv().slice(0,1),e=t.map((t=>{const e=this[Lt](v(this,H,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.length<t.length?e:t})).join(" ").trim(),v(this,ht,"f").getEnv("_")&&v(this,ht,"f").getProcessArgvBin()===v(this,ht,"f").getEnv("_")&&(e=v(this,ht,"f").getEnv("_").replace(`${v(this,ht,"f").path.dirname(v(this,ht,"f").process.execPath())}/`,"")),e}[Ot](){return v(this,et,"f")}[wt](){if(!v(this,R,"f"))return;const t=v(this,ht,"f").getEnv("LC_ALL")||v(this,ht,"f").getEnv("LC_MESSAGES")||v(this,ht,"f").getEnv("LANG")||v(this,ht,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Ct](){return this[_t]().version||"unknown"}[jt](t){const e=t["--"]?t["--"]:t._;for(let t,s=0;void 0!==(t=e[s]);s++)v(this,ht,"f").Parser.looksLikeNumber(t)&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))&&(e[s]=Number(t));return t}[_t](t){const e=t||"*";if(v(this,it,"f")[e])return v(this,it,"f")[e];let s={};try{let e=t||v(this,ht,"f").mainFilename;!t&&v(this,ht,"f").path.extname(e)&&(e=v(this,ht,"f").path.dirname(e));const n=v(this,ht,"f").findUp(e,((t,e)=>e.includes("package.json")?"package.json":void 0));d(n,void 0,v(this,ht,"f")),s=JSON.parse(v(this,ht,"f").readFileSync(n,"utf8"))}catch(t){}return v(this,it,"f")[e]=s||{},v(this,it,"f")[e]}[Mt](t,e){(e=[].concat(e)).forEach((e=>{e=this[St](e),v(this,Q,"f")[t].push(e)}))}[kt](t,e,s,n){this[xt](t,e,s,n,((t,e,s)=>{v(this,Q,"f")[t][e]=s}))}[Et](t,e,s,n){this[xt](t,e,s,n,((t,e,s)=>{v(this,Q,"f")[t][e]=(v(this,Q,"f")[t][e]||[]).concat(s)}))}[xt](t,e,s,n,i){if(Array.isArray(s))s.forEach((e=>{t(e,n)}));else if((t=>"object"==typeof t)(s))for(const e of p(s))t(e,s[e]);else i(e,this[St](s),n)}[St](t){return"__proto__"===t?"___proto___":t}[$t](t,e){return this[kt](this[$t].bind(this),"key",t,e),this}[At](){var t,e,s,n,i,r,o,a,h,l,c,f;const u=v(this,G,"f").pop();let p;d(u,void 0,v(this,ht,"f")),t=this,e=this,s=this,n=this,i=this,r=this,o=this,a=this,h=this,l=this,c=this,f=this,({options:{set value(e){O(t,Q,e,"f")}}.value,configObjects:p,exitProcess:{set value(t){O(e,T,t,"f")}}.value,groups:{set value(t){O(s,K,t,"f")}}.value,output:{set value(t){O(n,X,t,"f")}}.value,exitError:{set value(t){O(i,V,t,"f")}}.value,hasOutput:{set value(t){O(r,Y,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){O(o,lt,t,"f")}}.value,strictCommands:{set value(t){O(a,ct,t,"f")}}.value,strictOptions:{set value(t){O(h,ft,t,"f")}}.value,completionCommand:{set value(t){O(l,W,t,"f")}}.value,parseFn:{set value(t){O(c,st,t,"f")}}.value,parseContext:{set value(t){O(f,nt,t,"f")}}.value}=u),v(this,Q,"f").configObjects=p,v(this,dt,"f").unfreeze(),v(this,pt,"f").unfreeze(),v(this,q,"f").unfreeze(),v(this,B,"f").unfreeze()}[Pt](t,e){return j(e,(e=>(t(e),e)))}getInternalMethods(){return{getCommandInstance:this[It].bind(this),getContext:this[Nt].bind(this),getHasOutput:this[Dt].bind(this),getLoggerInstance:this[zt].bind(this),getParseContext:this[qt].bind(this),getParserConfiguration:this[Ot].bind(this),getUsageInstance:this[Ht].bind(this),getValidationInstance:this[Ft].bind(this),hasParseCallback:this[Ut].bind(this),postProcess:this[Wt].bind(this),reset:this[Vt].bind(this),runValidation:this[Tt].bind(this),runYargsParserAndExecuteCommands:this[Rt].bind(this),setHasOutput:this[Gt].bind(this)}}[It](){return v(this,q,"f")}[Nt](){return v(this,F,"f")}[Dt](){return v(this,Y,"f")}[zt](){return v(this,Z,"f")}[qt](){return v(this,nt,"f")||{}}[Ht](){return v(this,dt,"f")}[Ft](){return v(this,pt,"f")}[Ut](){return!!v(this,st,"f")}[Wt](t,e,s,n){if(s)return t;if(f(t))return t;e||(t=this[gt](t));return(this[Ot]()["parse-positional-numbers"]||void 0===this[Ot]()["parse-positional-numbers"])&&(t=this[jt](t)),n&&(t=C(t,this,v(this,B,"f").getMiddleware(),!1)),t}[Vt](t={}){O(this,Q,v(this,Q,"f")||{},"f");const e={};e.local=v(this,Q,"f").local||[],e.configObjects=v(this,Q,"f").configObjects||[];const s={};e.local.forEach((e=>{s[e]=!0,(t[e]||[]).forEach((t=>{s[t]=!0}))})),Object.assign(v(this,rt,"f"),Object.keys(v(this,K,"f")).reduce(((t,e)=>{const n=v(this,K,"f")[e].filter((t=>!(t in s)));return n.length>0&&(t[e]=n),t}),{})),O(this,K,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{e[t]=(v(this,Q,"f")[t]||[]).filter((t=>!s[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{e[t]=g(v(this,Q,"f")[t],(t=>!s[t]))})),e.envPrefix=v(this,Q,"f").envPrefix,O(this,Q,e,"f"),O(this,dt,v(this,dt,"f")?v(this,dt,"f").reset(s):$(this,v(this,ht,"f")),"f"),O(this,pt,v(this,pt,"f")?v(this,pt,"f").reset(s):function(t,e,s){const n=s.y18n.__,i=s.y18n.__n,r={nonOptionCount:function(s){const n=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;n._&&(r<n._.min||r>n._.max)&&(r<n._.min?void 0!==n._.minMsg?e.fail(n._.minMsg?n._.minMsg.replace(/\$0/g,r.toString()).replace(/\$1/,n._.min.toString()):null):e.fail(i("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(),n._.min.toString())):r>n._.max&&(void 0!==n._.maxMsg?e.fail(n._.maxMsg?n._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,n._.max.toString()):null):e.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),n._.max.toString()))))},positionalCount:function(t,s){s<t&&e.fail(i("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 n=null;for(const e of Object.keys(s))Object.prototype.hasOwnProperty.call(t,e)&&void 0!==t[e]||(n=n||{},n[e]=s[e]);if(n){const t=[];for(const e of Object.keys(n)){const s=n[e];s&&t.indexOf(s)<0&&t.push(s)}const s=t.length?`\n${t.join("\n")}`:"";e.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(n).length,Object.keys(n).join(", ")+s))}},unknownArguments:function(s,n,o,a,h=!0){var l;const c=t.getInternalMethods().getCommandInstance().getCommands(),f=[],d=t.getInternalMethods().getContext();if(Object.keys(s).forEach((e=>{z.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,n)||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,n=d.commands.length+e;n<s._.length&&s._.slice(n).forEach((t=>{t=String(t),d.commands.includes(t)||f.includes(t)||f.push(t)}))}f.length&&e.fail(i("Unknown argument: %s","Unknown arguments: %s",f.length,f.join(", ")))},unknownCommands:function(s){const n=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||n.length>0)&&s._.slice(o.commands.length).forEach((t=>{n.includes(""+t)||r.push(""+t)})),r.length>0&&(e.fail(i("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 n=t.parsed.newAliases;return[e,...s[e]].some((t=>!Object.prototype.hasOwnProperty.call(n,t)||!n[e]))},limitedChoices:function(s){const i=t.getOptions(),r={};if(!Object.keys(i.choices).length)return;Object.keys(s).forEach((t=>{-1===z.indexOf(t)&&Object.prototype.hasOwnProperty.call(i.choices,t)&&[].concat(s[t]).forEach((e=>{-1===i.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))}))}));const o=Object.keys(r);if(!o.length)return;let a=n("Invalid values:");o.forEach((t=>{a+=`\n ${n("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(i.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,n){h("<string|object> [array|number|string]",[e,n],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.implies(t,e[t])})):(t.global(e),o[e]||(o[e]=[]),Array.isArray(n)?n.forEach((t=>r.implies(e,t))):(d(n,void 0,s),o[e].push(n)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach((e=>{const n=e;(o[e]||[]).forEach((e=>{let i=n;const r=e;i=a(t,i),e=a(t,e),i&&!e&&s.push(` ${n} -> ${r}`)}))})),s.length){let t=`${n("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(t){Object.keys(t).forEach((s=>{l[s]&&l[s].forEach((i=>{i&&void 0!==t[s]&&void 0!==t[i]&&e.fail(n("Arguments %s and %s are mutually exclusive",s,i))}))}))},r.recommendCommands=function(t,s){s=s.sort(((t,e)=>e.length-t.length));let i=null,r=1/0;for(let e,n=0;void 0!==(e=s[n]);n++){const s=D(t,e);s<=3&&s<r&&(r=s,i=e)}i&&e.fail(n("Did you mean %s?",i))},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,dt,"f"),v(this,ht,"f")),"f"),O(this,q,v(this,q,"f")?v(this,q,"f").reset():function(t,e,s,n){return new M(t,e,s,n)}(v(this,dt,"f"),v(this,pt,"f"),v(this,B,"f"),v(this,ht,"f")),"f"),v(this,U,"f")||O(this,U,function(t,e,s,n){return new N(t,e,s,n)}(this,v(this,dt,"f"),v(this,q,"f"),v(this,ht,"f")),"f"),v(this,B,"f").reset(),O(this,W,null,"f"),O(this,X,"","f"),O(this,V,null,"f"),O(this,Y,!1,"f"),this.parsed=!1,this}[Lt](t,e){return v(this,ht,"f").path.relative(t,e)}[Rt](t,s,n,i=0,r=!1){let o=!!n||r;t=t||v(this,ot,"f"),v(this,Q,"f").__=v(this,ht,"f").y18n.__,v(this,Q,"f").configuration=this[Ot]();const a=!!v(this,Q,"f").configuration["populate--"],h=Object.assign({},v(this,Q,"f").configuration,{"populate--":!0}),l=v(this,ht,"f").Parser.detailed(t,Object.assign({},v(this,Q,"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,J,"f")&&c[t]?p=!0:t===v(this,ut,"f")&&c[t]&&(g=!0)})),c.$0=this.$0,this.parsed=l,0===i&&v(this,dt,"f").clearCachedHelpMessage();try{if(this[wt](),s)return this[Wt](c,a,!!n,!1);if(v(this,J,"f")){[v(this,J,"f")].concat(u[v(this,J,"f")]||[]).filter((t=>t.length>1)).includes(""+c._[c._.length-1])&&(c._.pop(),p=!0)}const h=v(this,q,"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=i||0;void 0!==c._[s];s++){if(e=String(c._[s]),h.includes(e)&&e!==v(this,W,"f")){const t=v(this,q,"f").runCommand(e,this,l,s+1,r,p||g||r);return this[Wt](t,a,!!n,!1)}if(!t&&e!==v(this,W,"f")){t=e;break}}!v(this,q,"f").hasDefaultCommand()&&v(this,at,"f")&&t&&!y&&v(this,pt,"f").recommendCommands(t,h)}v(this,W,"f")&&c._.includes(v(this,W,"f"))&&!m&&(v(this,T,"f")&&x(!0),this.showCompletionScript(),this.exit(0))}if(v(this,q,"f").hasDefaultCommand()&&!y){const t=v(this,q,"f").runCommand(null,this,l,0,r,p||g||r);return this[Wt](t,a,!!n,!1)}if(m){v(this,T,"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,Z,"f").log(t)})),this.exit(0)})),this[Wt](c,!a,!!n,!1)}if(v(this,Y,"f")||(p?(v(this,T,"f")&&x(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(v(this,T,"f")&&x(!0),o=!0,v(this,dt,"f").showVersion("log"),this.exit(0))),!o&&v(this,Q,"f").skipValidation.length>0&&(o=Object.keys(c).some((t=>v(this,Q,"f").skipValidation.indexOf(t)>=0&&!0===c[t]))),!o){if(l.error)throw new e(l.error.message);if(!m){const t=this[Tt](u,{},l.error);n||(d=C(c,this,v(this,B,"f").getMiddleware(),!0)),d=this[Pt](t,null!=d?d:c),f(d)&&!n&&(d=d.then((()=>C(c,this,v(this,B,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof e))throw t;v(this,dt,"f").fail(t.message,t)}return this[Wt](null!=d?d:c,a,!!n,!0)}[Tt](t,s,n,i){const r={...this.getDemandedOptions()};return o=>{if(n)throw new e(n.message);v(this,pt,"f").nonOptionCount(o),v(this,pt,"f").requiredArguments(o,r);let a=!1;v(this,ct,"f")&&(a=v(this,pt,"f").unknownCommands(o)),v(this,lt,"f")&&!a?v(this,pt,"f").unknownArguments(o,t,s,!!i):v(this,ft,"f")&&v(this,pt,"f").unknownArguments(o,t,{},!1,!1),v(this,pt,"f").limitedChoices(o),v(this,pt,"f").implications(o),v(this,pt,"f").conflicting(o)}}[Gt](){O(this,Y,!0,"f")}}var Kt,Yt;const{readFileSync:Jt}=require("fs"),{inspect:Zt}=require("util"),{resolve:Xt}=require("path"),Qt=require("y18n"),te=require("yargs-parser");var ee,se={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:Zt,mainFilename:null!==(Yt=null===(Kt=null===require||void 0===require?void 0:require.main)||void 0===Kt?void 0:Kt.filename)&&void 0!==Yt?Yt:process.cwd(),Parser:te,path:require("path"),process:{argv:()=>process.argv,cwd:process.cwd,execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:Jt,require:require,requireDirectory:require("require-directory"),stringWidth:require("string-width"),y18n:Qt({directory:Xt(__dirname,"../locales"),updateFiles:!1})};const ne=(null===(ee=null===process||void 0===process?void 0:process.env)||void 0===ee?void 0:ee.YARGS_MIN_NODE_VERSION)?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version){if(Number(process.version.match(/v([^.]+)/)[1])<ne)throw Error(`yargs supports a minimum Node.js version of ${ne}. Read our version support policy: https://github.com/yargs/yargs#supported-nodejs-versions`)}const ie=require("yargs-parser");var re,oe={applyExtends:i,cjsPlatformShim:se,Yargs:(re=se,(t=[],e=re.process.cwd(),s)=>{const n=new Bt(t,e,s,re);return Object.defineProperty(n,"argv",{get:()=>n.parse(),enumerable:!0}),n.help(),n.version(),n}),argsert:h,isPromise:f,objFilter:g,parseCommand:o,Parser:ie,processArgv:b,YError:e};module.exports=oe;
|
|
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;
|
|
@@ -24,7 +24,7 @@ _{{app_name}}_yargs_completions()
|
|
|
24
24
|
|
|
25
25
|
return 0
|
|
26
26
|
}
|
|
27
|
-
complete -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
27
|
+
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
28
28
|
###-end-{{app_name}}-completions-###
|
|
29
29
|
`;
|
|
30
30
|
export const completionZshTemplate = `#compdef {{app_name}}
|
package/build/lib/completion.js
CHANGED
|
@@ -32,6 +32,7 @@ export class Completion {
|
|
|
32
32
|
const completions = [];
|
|
33
33
|
this.commandCompletions(completions, args, current);
|
|
34
34
|
this.optionCompletions(completions, args, argv, current);
|
|
35
|
+
this.choicesCompletions(completions, args, argv, current);
|
|
35
36
|
done(null, completions);
|
|
36
37
|
}
|
|
37
38
|
commandCompletions(completions, args, current) {
|
|
@@ -39,7 +40,8 @@ export class Completion {
|
|
|
39
40
|
.getInternalMethods()
|
|
40
41
|
.getContext().commands;
|
|
41
42
|
if (!current.match(/^-/) &&
|
|
42
|
-
parentCommands[parentCommands.length - 1] !== current
|
|
43
|
+
parentCommands[parentCommands.length - 1] !== current &&
|
|
44
|
+
!this.previousArgHasChoices(args)) {
|
|
43
45
|
this.usage.getCommands().forEach(usageCommand => {
|
|
44
46
|
const commandName = parseCommand(usageCommand[0]).cmd;
|
|
45
47
|
if (args.indexOf(commandName) === -1) {
|
|
@@ -55,7 +57,8 @@ export class Completion {
|
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
optionCompletions(completions, args, argv, current) {
|
|
58
|
-
if (current.match(/^-/) || (current === '' && completions.length === 0))
|
|
60
|
+
if ((current.match(/^-/) || (current === '' && completions.length === 0)) &&
|
|
61
|
+
!this.previousArgHasChoices(args)) {
|
|
59
62
|
const options = this.yargs.getOptions();
|
|
60
63
|
const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [];
|
|
61
64
|
Object.keys(options.key).forEach(key => {
|
|
@@ -71,6 +74,36 @@ export class Completion {
|
|
|
71
74
|
});
|
|
72
75
|
}
|
|
73
76
|
}
|
|
77
|
+
choicesCompletions(completions, args, argv, current) {
|
|
78
|
+
if (this.previousArgHasChoices(args)) {
|
|
79
|
+
const choices = this.getPreviousArgChoices(args);
|
|
80
|
+
if (choices && choices.length > 0) {
|
|
81
|
+
completions.push(...choices);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
getPreviousArgChoices(args) {
|
|
86
|
+
if (args.length < 1)
|
|
87
|
+
return;
|
|
88
|
+
let previousArg = args[args.length - 1];
|
|
89
|
+
let filter = '';
|
|
90
|
+
if (!previousArg.startsWith('--') && args.length > 1) {
|
|
91
|
+
filter = previousArg;
|
|
92
|
+
previousArg = args[args.length - 2];
|
|
93
|
+
}
|
|
94
|
+
if (!previousArg.startsWith('--'))
|
|
95
|
+
return;
|
|
96
|
+
const previousArgKey = previousArg.replace(/-/g, '');
|
|
97
|
+
const options = this.yargs.getOptions();
|
|
98
|
+
if (Object.keys(options.key).some(key => key === previousArgKey) &&
|
|
99
|
+
Array.isArray(options.choices[previousArgKey])) {
|
|
100
|
+
return options.choices[previousArgKey].filter(choice => !filter || choice.startsWith(filter));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
previousArgHasChoices(args) {
|
|
104
|
+
const choices = this.getPreviousArgChoices(args);
|
|
105
|
+
return choices !== undefined && choices.length > 0;
|
|
106
|
+
}
|
|
74
107
|
argsContainKey(args, argv, key, negable) {
|
|
75
108
|
if (args.indexOf(`--${key}`) !== -1)
|
|
76
109
|
return true;
|
package/build/lib/middleware.js
CHANGED
|
@@ -75,10 +75,7 @@ export function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
|
|
|
75
75
|
}
|
|
76
76
|
if (isPromise(acc)) {
|
|
77
77
|
return acc
|
|
78
|
-
.then(initialObj => Promise.all([
|
|
79
|
-
initialObj,
|
|
80
|
-
middleware(initialObj, yargs),
|
|
81
|
-
]))
|
|
78
|
+
.then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)]))
|
|
82
79
|
.then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
|
|
83
80
|
}
|
|
84
81
|
else {
|
package/build/lib/usage.js
CHANGED
|
@@ -199,8 +199,9 @@ export function usage(yargs, shim) {
|
|
|
199
199
|
true) {
|
|
200
200
|
commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
|
|
201
201
|
}
|
|
202
|
+
const prefix = base$0 ? `${base$0} ` : '';
|
|
202
203
|
commands.forEach(command => {
|
|
203
|
-
const commandString = `${
|
|
204
|
+
const commandString = `${prefix}${parentCommands}${command[0].replace(/^\$0 ?/, '')}`;
|
|
204
205
|
ui.span({
|
|
205
206
|
text: commandString,
|
|
206
207
|
padding: [0, 2, 0, 2],
|
package/build/lib/validation.js
CHANGED
|
@@ -257,6 +257,17 @@ export function validation(yargs, usage, shim) {
|
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
|
+
if (yargs.getInternalMethods().getParserConfiguration()['strip-dashed']) {
|
|
261
|
+
Object.keys(conflicting).forEach(key => {
|
|
262
|
+
conflicting[key].forEach(value => {
|
|
263
|
+
if (value &&
|
|
264
|
+
argv[shim.Parser.camelCase(key)] !== undefined &&
|
|
265
|
+
argv[shim.Parser.camelCase(value)] !== undefined) {
|
|
266
|
+
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
}
|
|
260
271
|
};
|
|
261
272
|
self.recommendCommands = function recommendCommands(cmd, potentialCommands) {
|
|
262
273
|
const threshold = 3;
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
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");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _YargsInstance_command, _YargsInstance_cwd, _YargsInstance_context, _YargsInstance_completion, _YargsInstance_completionCommand, _YargsInstance_defaultShowHiddenOpt, _YargsInstance_exitError, _YargsInstance_detectLocale, _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;
|
|
12
|
+
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;
|
|
13
13
|
import { command as Command, } from './command.js';
|
|
14
14
|
import { assertNotStrictEqual, assertSingleKey, objectKeys, } from './typings/common-types.js';
|
|
15
15
|
import { YError } from './yerror.js';
|
|
@@ -40,6 +40,7 @@ export function YargsFactory(_shim) {
|
|
|
40
40
|
const kCopyDoubleDash = Symbol('copyDoubleDash');
|
|
41
41
|
const kCreateLogger = Symbol('copyDoubleDash');
|
|
42
42
|
const kDeleteFromParserHintObject = Symbol('deleteFromParserHintObject');
|
|
43
|
+
const kEmitWarning = Symbol('emitWarning');
|
|
43
44
|
const kFreeze = Symbol('freeze');
|
|
44
45
|
const kGetDollarZero = Symbol('getDollarZero');
|
|
45
46
|
const kGetParserConfiguration = Symbol('getParserConfiguration');
|
|
@@ -69,6 +70,7 @@ const kReset = Symbol('reset');
|
|
|
69
70
|
const kRunYargsParserAndExecuteCommands = Symbol('runYargsParserAndExecuteCommands');
|
|
70
71
|
const kRunValidation = Symbol('runValidation');
|
|
71
72
|
const kSetHasOutput = Symbol('setHasOutput');
|
|
73
|
+
const kTrackManuallySetKeys = Symbol('kTrackManuallySetKeys');
|
|
72
74
|
export class YargsInstance {
|
|
73
75
|
constructor(processArgs = [], cwd, parentRequire, shim) {
|
|
74
76
|
this.customScriptName = false;
|
|
@@ -81,6 +83,7 @@ export class YargsInstance {
|
|
|
81
83
|
_YargsInstance_defaultShowHiddenOpt.set(this, 'show-hidden');
|
|
82
84
|
_YargsInstance_exitError.set(this, null);
|
|
83
85
|
_YargsInstance_detectLocale.set(this, true);
|
|
86
|
+
_YargsInstance_emittedWarnings.set(this, {});
|
|
84
87
|
_YargsInstance_exitProcess.set(this, true);
|
|
85
88
|
_YargsInstance_frozens.set(this, []);
|
|
86
89
|
_YargsInstance_globalMiddleware.set(this, void 0);
|
|
@@ -157,18 +160,20 @@ export class YargsInstance {
|
|
|
157
160
|
array(keys) {
|
|
158
161
|
argsert('<array|string>', [keys], arguments.length);
|
|
159
162
|
this[kPopulateParserHintArray]('array', keys);
|
|
163
|
+
this[kTrackManuallySetKeys](keys);
|
|
160
164
|
return this;
|
|
161
165
|
}
|
|
162
166
|
boolean(keys) {
|
|
163
167
|
argsert('<array|string>', [keys], arguments.length);
|
|
164
168
|
this[kPopulateParserHintArray]('boolean', keys);
|
|
169
|
+
this[kTrackManuallySetKeys](keys);
|
|
165
170
|
return this;
|
|
166
171
|
}
|
|
167
172
|
check(f, global) {
|
|
168
173
|
argsert('<function> [boolean]', [f, global], arguments.length);
|
|
169
174
|
this.middleware((argv, _yargs) => {
|
|
170
175
|
return maybeAsyncResult(() => {
|
|
171
|
-
return f(argv);
|
|
176
|
+
return f(argv, _yargs.getOptions());
|
|
172
177
|
}, (result) => {
|
|
173
178
|
if (!result) {
|
|
174
179
|
__classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(__classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__('Argument check failed: %s', f.toString()));
|
|
@@ -283,6 +288,7 @@ export class YargsInstance {
|
|
|
283
288
|
count(keys) {
|
|
284
289
|
argsert('<array|string>', [keys], arguments.length);
|
|
285
290
|
this[kPopulateParserHintArray]('count', keys);
|
|
291
|
+
this[kTrackManuallySetKeys](keys);
|
|
286
292
|
return this;
|
|
287
293
|
}
|
|
288
294
|
default(key, value, defaultDescription) {
|
|
@@ -553,6 +559,7 @@ export class YargsInstance {
|
|
|
553
559
|
number(keys) {
|
|
554
560
|
argsert('<array|string>', [keys], arguments.length);
|
|
555
561
|
this[kPopulateParserHintArray]('number', keys);
|
|
562
|
+
this[kTrackManuallySetKeys](keys);
|
|
556
563
|
return this;
|
|
557
564
|
}
|
|
558
565
|
option(key, opt) {
|
|
@@ -566,6 +573,17 @@ export class YargsInstance {
|
|
|
566
573
|
if (typeof opt !== 'object') {
|
|
567
574
|
opt = {};
|
|
568
575
|
}
|
|
576
|
+
this[kTrackManuallySetKeys](key);
|
|
577
|
+
if (__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f") && (key === 'version' || (opt === null || opt === void 0 ? void 0 : opt.alias) === 'version')) {
|
|
578
|
+
this[kEmitWarning]([
|
|
579
|
+
'"version" is a reserved word.',
|
|
580
|
+
'Please do one of the following:',
|
|
581
|
+
'- Disable version with `yargs.version(false)` if using "version" as an option',
|
|
582
|
+
'- Use the built-in `yargs.version` method instead (if applicable)',
|
|
583
|
+
'- Use a different option key',
|
|
584
|
+
'https://yargs.js.org/docs/#api-reference-version',
|
|
585
|
+
].join('\n'), undefined, 'versionWarning');
|
|
586
|
+
}
|
|
569
587
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").key[key] = true;
|
|
570
588
|
if (opt.alias)
|
|
571
589
|
this.alias(key, opt.alias);
|
|
@@ -858,9 +876,10 @@ export class YargsInstance {
|
|
|
858
876
|
__classPrivateFieldSet(this, _YargsInstance_strictOptions, enabled !== false, "f");
|
|
859
877
|
return this;
|
|
860
878
|
}
|
|
861
|
-
string(
|
|
862
|
-
argsert('<array|string>', [
|
|
863
|
-
this[kPopulateParserHintArray]('string',
|
|
879
|
+
string(keys) {
|
|
880
|
+
argsert('<array|string>', [keys], arguments.length);
|
|
881
|
+
this[kPopulateParserHintArray]('string', keys);
|
|
882
|
+
this[kTrackManuallySetKeys](keys);
|
|
864
883
|
return this;
|
|
865
884
|
}
|
|
866
885
|
terminalWidth() {
|
|
@@ -927,7 +946,7 @@ export class YargsInstance {
|
|
|
927
946
|
__classPrivateFieldGet(this, _YargsInstance_usage, "f").wrap(cols);
|
|
928
947
|
return this;
|
|
929
948
|
}
|
|
930
|
-
[(_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_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) {
|
|
949
|
+
[(_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) {
|
|
931
950
|
if (!argv._ || !argv['--'])
|
|
932
951
|
return argv;
|
|
933
952
|
argv._.push.apply(argv._, argv['--']);
|
|
@@ -972,6 +991,12 @@ export class YargsInstance {
|
|
|
972
991
|
});
|
|
973
992
|
delete __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions()[optionKey];
|
|
974
993
|
}
|
|
994
|
+
[kEmitWarning](warning, type, deduplicationId) {
|
|
995
|
+
if (!__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId]) {
|
|
996
|
+
__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.emitWarning(warning, type);
|
|
997
|
+
__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId] = true;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
975
1000
|
[kFreeze]() {
|
|
976
1001
|
__classPrivateFieldGet(this, _YargsInstance_frozens, "f").push({
|
|
977
1002
|
options: __classPrivateFieldGet(this, _YargsInstance_options, "f"),
|
|
@@ -1442,6 +1467,16 @@ export class YargsInstance {
|
|
|
1442
1467
|
[kSetHasOutput]() {
|
|
1443
1468
|
__classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
|
|
1444
1469
|
}
|
|
1470
|
+
[kTrackManuallySetKeys](keys) {
|
|
1471
|
+
if (typeof keys === 'string') {
|
|
1472
|
+
__classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true;
|
|
1473
|
+
}
|
|
1474
|
+
else {
|
|
1475
|
+
for (const k of keys) {
|
|
1476
|
+
__classPrivateFieldGet(this, _YargsInstance_options, "f").key[k] = true;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1445
1480
|
}
|
|
1446
1481
|
export function isYargsInstance(y) {
|
|
1447
1482
|
return !!y && typeof y.getInternalMethods === 'function';
|
package/index.cjs
CHANGED
|
@@ -15,6 +15,20 @@ function Argv(processArgs, cwd) {
|
|
|
15
15
|
return argv;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
function defineGetter(obj, key, getter) {
|
|
19
|
+
Object.defineProperty(obj, key, {
|
|
20
|
+
configurable: true,
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: getter,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function lookupGetter(obj, key) {
|
|
26
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
27
|
+
if (typeof desc !== 'undefined') {
|
|
28
|
+
return desc.get;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
18
32
|
/* Hack an instance of Argv with process.argv into Argv
|
|
19
33
|
so people can do
|
|
20
34
|
require('yargs')(['--beeble=1','-z','zizzle']).argv
|
|
@@ -28,16 +42,12 @@ function singletonify(inst) {
|
|
|
28
42
|
...Object.getOwnPropertyNames(inst.constructor.prototype),
|
|
29
43
|
].forEach(key => {
|
|
30
44
|
if (key === 'argv') {
|
|
31
|
-
Argv
|
|
45
|
+
defineGetter(Argv, key, lookupGetter(inst, key));
|
|
32
46
|
} else if (typeof inst[key] === 'function') {
|
|
33
47
|
Argv[key] = inst[key].bind(inst);
|
|
34
48
|
} else {
|
|
35
|
-
Argv
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
Argv.__defineGetter__('parsed', () => {
|
|
39
|
-
return inst.parsed;
|
|
40
|
-
});
|
|
49
|
+
defineGetter(Argv, '$0', () => inst.$0);
|
|
50
|
+
defineGetter(Argv, 'parsed', () => inst.parsed);
|
|
41
51
|
}
|
|
42
52
|
});
|
|
43
53
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { notStrictEqual, strictEqual } from 'assert'
|
|
4
4
|
import cliui from 'cliui'
|
|
5
5
|
import escalade from 'escalade/sync'
|
|
6
|
-
import {
|
|
6
|
+
import { inspect } from 'util'
|
|
7
7
|
import { readFileSync } from 'fs'
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
9
|
import Parser from 'yargs-parser'
|
|
@@ -15,8 +15,13 @@ import y18n from 'y18n'
|
|
|
15
15
|
const REQUIRE_ERROR = 'require is not supported by ESM'
|
|
16
16
|
const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM'
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
let __dirname;
|
|
19
|
+
try {
|
|
20
|
+
__dirname = fileURLToPath(import.meta.url);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
__dirname = process.cwd();
|
|
23
|
+
}
|
|
24
|
+
const mainFilename = __dirname.split('node_modules')[0]
|
|
20
25
|
|
|
21
26
|
export default {
|
|
22
27
|
assert: {
|
|
@@ -45,6 +50,7 @@ export default {
|
|
|
45
50
|
process: {
|
|
46
51
|
argv: () => process.argv,
|
|
47
52
|
cwd: process.cwd,
|
|
53
|
+
emitWarning: (warning, type) => process.emitWarning(warning, type),
|
|
48
54
|
execPath: () => process.execPath,
|
|
49
55
|
exit: process.exit,
|
|
50
56
|
nextTick: process.nextTick,
|
package/locales/uz.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Commands:": "Buyruqlar:",
|
|
3
|
+
"Options:": "Imkoniyatlar:",
|
|
4
|
+
"Examples:": "Misollar:",
|
|
5
|
+
"boolean": "boolean",
|
|
6
|
+
"count": "sanoq",
|
|
7
|
+
"string": "satr",
|
|
8
|
+
"number": "raqam",
|
|
9
|
+
"array": "massiv",
|
|
10
|
+
"required": "majburiy",
|
|
11
|
+
"default": "boshlang'ich",
|
|
12
|
+
"default:": "boshlang'ich:",
|
|
13
|
+
"choices:": "tanlovlar:",
|
|
14
|
+
"aliases:": "taxalluslar:",
|
|
15
|
+
"generated-value": "yaratilgan-qiymat",
|
|
16
|
+
"Not enough non-option arguments: got %s, need at least %s": {
|
|
17
|
+
"one": "No-imkoniyat argumentlar yetarli emas: berilgan %s, minimum %s",
|
|
18
|
+
"other": "No-imkoniyat argumentlar yetarli emas: berilgan %s, minimum %s"
|
|
19
|
+
},
|
|
20
|
+
"Too many non-option arguments: got %s, maximum of %s": {
|
|
21
|
+
"one": "No-imkoniyat argumentlar juda ko'p: berilgan %s, maksimum %s",
|
|
22
|
+
"other": "No-imkoniyat argumentlar juda ko'p: got %s, maksimum %s"
|
|
23
|
+
},
|
|
24
|
+
"Missing argument value: %s": {
|
|
25
|
+
"one": "Argument qiymati berilmagan: %s",
|
|
26
|
+
"other": "Argument qiymatlari berilmagan: %s"
|
|
27
|
+
},
|
|
28
|
+
"Missing required argument: %s": {
|
|
29
|
+
"one": "Majburiy argument berilmagan: %s",
|
|
30
|
+
"other": "Majburiy argumentlar berilmagan: %s"
|
|
31
|
+
},
|
|
32
|
+
"Unknown argument: %s": {
|
|
33
|
+
"one": "Noma'lum argument berilmagan: %s",
|
|
34
|
+
"other": "Noma'lum argumentlar berilmagan: %s"
|
|
35
|
+
},
|
|
36
|
+
"Invalid values:": "Nosoz qiymatlar:",
|
|
37
|
+
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Berilgan: %s, Tanlovlar: %s",
|
|
38
|
+
"Argument check failed: %s": "Muvaffaqiyatsiz argument tekshiruvi: %s",
|
|
39
|
+
"Implications failed:": "Bog'liq argumentlar berilmagan:",
|
|
40
|
+
"Not enough arguments following: %s": "Quyidagi argumentlar yetarli emas: %s",
|
|
41
|
+
"Invalid JSON config file: %s": "Nosoz JSON konfiguratsiya fayli: %s",
|
|
42
|
+
"Path to JSON config file": "JSON konfiguratsiya fayli joylashuvi",
|
|
43
|
+
"Show help": "Yordam ko'rsatish",
|
|
44
|
+
"Show version number": "Versiyani ko'rsatish",
|
|
45
|
+
"Did you mean %s?": "%s ni nazarda tutyapsizmi?",
|
|
46
|
+
"Arguments %s and %s are mutually exclusive" : "%s va %s argumentlari alohida",
|
|
47
|
+
"Positionals:": "Positsionallar:",
|
|
48
|
+
"command": "buyruq",
|
|
49
|
+
"deprecated": "eskirgan",
|
|
50
|
+
"deprecated: %s": "eskirgan: %s"
|
|
51
|
+
}
|
|
52
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yargs",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
4
4
|
"description": "yargs the modern, pirate-themed, successor to optimist.",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"exports": {
|
|
@@ -50,15 +50,14 @@
|
|
|
50
50
|
"escalade": "^3.1.1",
|
|
51
51
|
"get-caller-file": "^2.0.5",
|
|
52
52
|
"require-directory": "^2.1.1",
|
|
53
|
-
"string-width": "^4.2.
|
|
53
|
+
"string-width": "^4.2.3",
|
|
54
54
|
"y18n": "^5.0.5",
|
|
55
|
-
"yargs-parser": "^
|
|
55
|
+
"yargs-parser": "^21.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/chai": "^4.2.11",
|
|
59
59
|
"@types/mocha": "^9.0.0",
|
|
60
|
-
"@types/node": "^
|
|
61
|
-
"@wessberg/rollup-plugin-ts": "^1.3.2",
|
|
60
|
+
"@types/node": "^16.11.4",
|
|
62
61
|
"c8": "^7.7.0",
|
|
63
62
|
"chai": "^4.2.0",
|
|
64
63
|
"chalk": "^4.0.0",
|
|
@@ -74,6 +73,7 @@
|
|
|
74
73
|
"rollup": "^2.23.0",
|
|
75
74
|
"rollup-plugin-cleanup": "^3.1.1",
|
|
76
75
|
"rollup-plugin-terser": "^7.0.2",
|
|
76
|
+
"rollup-plugin-ts": "^2.0.4",
|
|
77
77
|
"typescript": "^4.0.2",
|
|
78
78
|
"which": "^2.0.0",
|
|
79
79
|
"yargs-test-extends": "^1.0.1"
|
package/CHANGELOG.md
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
## [17.1.0](https://www.github.com/yargs/yargs/compare/v17.0.1...v17.1.0) (2021-08-04)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Features
|
|
9
|
-
|
|
10
|
-
* update Levenshtein to Damerau-Levenshtein ([#1973](https://www.github.com/yargs/yargs/issues/1973)) ([d2c121b](https://www.github.com/yargs/yargs/commit/d2c121b00f2e1eb2ea8cc3a23a5039b3a4425bea))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* coerce middleware should be applied once ([#1978](https://www.github.com/yargs/yargs/issues/1978)) ([14bd6be](https://www.github.com/yargs/yargs/commit/14bd6bebc3027ae929106b20dd198b9dccdeec31))
|
|
16
|
-
* implies should not fail when implied key's value is 0, false or empty string ([#1985](https://www.github.com/yargs/yargs/issues/1985)) ([8010472](https://www.github.com/yargs/yargs/commit/80104727d5f2ec4c5b491c1bdec4c94b2db95d9c))
|
|
17
|
-
* positionals should not overwrite options ([#1992](https://www.github.com/yargs/yargs/issues/1992)) ([9d84309](https://www.github.com/yargs/yargs/commit/9d84309e53ce1d30b1c61035ed5c78827a89df86))
|
|
18
|
-
* strict should fail unknown arguments ([#1977](https://www.github.com/yargs/yargs/issues/1977)) ([c804f0d](https://www.github.com/yargs/yargs/commit/c804f0db78e56b44341cc7a91878c27b1b68b9f2))
|
|
19
|
-
* wrap(null) no longer causes strange indentation behavior ([#1988](https://www.github.com/yargs/yargs/issues/1988)) ([e1871aa](https://www.github.com/yargs/yargs/commit/e1871aa792de219b221179417d410931af70d405))
|
|
20
|
-
|
|
21
|
-
### [17.0.1](https://www.github.com/yargs/yargs/compare/v17.0.0...v17.0.1) (2021-05-03)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Bug Fixes
|
|
25
|
-
|
|
26
|
-
* **build:** Node 12 is now minimum version ([#1936](https://www.github.com/yargs/yargs/issues/1936)) ([0924566](https://www.github.com/yargs/yargs/commit/09245666e57facb140e0b45a9e45ca704883e5dd))
|
|
27
|
-
|
|
28
|
-
## [17.0.0](https://www.github.com/yargs/yargs/compare/v16.2.0...v17.0.0) (2021-05-02)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### ⚠ BREAKING CHANGES
|
|
32
|
-
|
|
33
|
-
* **node:** drop Node 10 (#1919)
|
|
34
|
-
* implicitly private methods are now actually private
|
|
35
|
-
* deprecated reset() method is now private (call yargs() instead).
|
|
36
|
-
* **yargs-factory:** refactor yargs-factory to use class (#1895)
|
|
37
|
-
* .positional() now allowed at root level of yargs.
|
|
38
|
-
* **coerce:** coerce is now applied before validation.
|
|
39
|
-
* **async:** yargs now returns a promise if async or check are asynchronous.
|
|
40
|
-
* **middleware:** global middleware now applied when no command is configured.
|
|
41
|
-
* #1823 contains the following breaking API changes:
|
|
42
|
-
* now returns a promise if handler is async.
|
|
43
|
-
* onFinishCommand removed, in favor of being able to await promise.
|
|
44
|
-
* getCompletion now invokes callback with err and `completions, returns promise of completions.
|
|
45
|
-
|
|
46
|
-
### Features
|
|
47
|
-
|
|
48
|
-
* add commands alias (similar to options function) ([#1850](https://www.github.com/yargs/yargs/issues/1850)) ([00b74ad](https://www.github.com/yargs/yargs/commit/00b74adcb30ab89b4450ef7105ef1ad32d820ebf))
|
|
49
|
-
* add parseSync/parseAsync method ([#1898](https://www.github.com/yargs/yargs/issues/1898)) ([6130ad8](https://www.github.com/yargs/yargs/commit/6130ad89b85dc49e34190e596e14a2fd3e668781))
|
|
50
|
-
* add support for `showVersion`, similar to `showHelp` ([#1831](https://www.github.com/yargs/yargs/issues/1831)) ([1a1e2d5](https://www.github.com/yargs/yargs/commit/1a1e2d554dca3566bc174584394419be0120d207))
|
|
51
|
-
* adds support for async builder ([#1888](https://www.github.com/yargs/yargs/issues/1888)) ([ade29b8](https://www.github.com/yargs/yargs/commit/ade29b864abecaa8c4f8dcc3493f5eb24fb73d84)), closes [#1042](https://www.github.com/yargs/yargs/issues/1042)
|
|
52
|
-
* allow calling standard completion function from custom one ([#1855](https://www.github.com/yargs/yargs/issues/1855)) ([31765cb](https://www.github.com/yargs/yargs/commit/31765cbdce812ee5c16aaae70ab523a2c7e0fcec))
|
|
53
|
-
* allow default completion to be referenced and modified, in custom completion ([#1878](https://www.github.com/yargs/yargs/issues/1878)) ([01619f6](https://www.github.com/yargs/yargs/commit/01619f6191a3ab16bf6b77456d4e9dfa80533907))
|
|
54
|
-
* **async:** add support for async check and coerce ([#1872](https://www.github.com/yargs/yargs/issues/1872)) ([8b95f57](https://www.github.com/yargs/yargs/commit/8b95f57bb2a49b098c6bf23cea88c6f900a34f89))
|
|
55
|
-
* improve support for async/await ([#1823](https://www.github.com/yargs/yargs/issues/1823)) ([169b815](https://www.github.com/yargs/yargs/commit/169b815df7ae190965f04030f28adc3ab92bb4b5))
|
|
56
|
-
* **locale:** add Ukrainian locale ([#1893](https://www.github.com/yargs/yargs/issues/1893)) ([c872dfc](https://www.github.com/yargs/yargs/commit/c872dfc1d87ebaa7fcc79801f649318a16195495))
|
|
57
|
-
* **middleware:** async middleware can now be used before validation. ([e0f9363](https://www.github.com/yargs/yargs/commit/e0f93636e04fa7e02a2c3b1fe465b6a14aa1f06d))
|
|
58
|
-
* **middleware:** global middleware now applied when no command is configured. ([e0f9363](https://www.github.com/yargs/yargs/commit/e0f93636e04fa7e02a2c3b1fe465b6a14aa1f06d))
|
|
59
|
-
* **node:** drop Node 10 ([#1919](https://www.github.com/yargs/yargs/issues/1919)) ([5edeb9e](https://www.github.com/yargs/yargs/commit/5edeb9ea17b1f0190a3590508f2e7911b5f70659))
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### Bug Fixes
|
|
63
|
-
|
|
64
|
-
* always cache help message when running commands ([#1865](https://www.github.com/yargs/yargs/issues/1865)) ([d57ca77](https://www.github.com/yargs/yargs/commit/d57ca7751d533d7e0f216cd9fbf7c2b0ec98f791)), closes [#1853](https://www.github.com/yargs/yargs/issues/1853)
|
|
65
|
-
* **async:** don't call parse callback until async ops complete ([#1896](https://www.github.com/yargs/yargs/issues/1896)) ([a93f5ff](https://www.github.com/yargs/yargs/commit/a93f5ff35d7c09b01e0ca93d7d855d2b26593165)), closes [#1888](https://www.github.com/yargs/yargs/issues/1888)
|
|
66
|
-
* **builder:** apply default builder for showHelp/getHelp ([#1913](https://www.github.com/yargs/yargs/issues/1913)) ([395bb67](https://www.github.com/yargs/yargs/commit/395bb67749787d269cabe80ffc3133c2f6958aeb)), closes [#1912](https://www.github.com/yargs/yargs/issues/1912)
|
|
67
|
-
* **builder:** nested builder is now awaited ([#1925](https://www.github.com/yargs/yargs/issues/1925)) ([b5accd6](https://www.github.com/yargs/yargs/commit/b5accd64ccbd3ffb800517fb40d0f59382515fbb))
|
|
68
|
-
* **coerce:** options using coerce now displayed in help ([#1911](https://www.github.com/yargs/yargs/issues/1911)) ([d2128cc](https://www.github.com/yargs/yargs/commit/d2128cc4ffd411eed7111e6a3c561948330e4f6f)), closes [#1909](https://www.github.com/yargs/yargs/issues/1909)
|
|
69
|
-
* completion script name clashing on bash ([#1903](https://www.github.com/yargs/yargs/issues/1903)) ([8f62d9a](https://www.github.com/yargs/yargs/commit/8f62d9a9e8bebf86f988c100ad3c417dc32b2471))
|
|
70
|
-
* **deno:** use actual names for keys instead of inferring ([#1891](https://www.github.com/yargs/yargs/issues/1891)) ([b96ef01](https://www.github.com/yargs/yargs/commit/b96ef01b16bc5377b79d7914dd5495068037fe7b))
|
|
71
|
-
* exclude positionals from default completion ([#1881](https://www.github.com/yargs/yargs/issues/1881)) ([0175677](https://www.github.com/yargs/yargs/commit/0175677b79ffe50a9c5477631288ae10120b8a32))
|
|
72
|
-
* https://github.com/yargs/yargs/issues/1841#issuecomment-804770453 ([b96ef01](https://www.github.com/yargs/yargs/commit/b96ef01b16bc5377b79d7914dd5495068037fe7b))
|
|
73
|
-
* showHelp() and .getHelp() now return same output for commands as --help ([#1826](https://www.github.com/yargs/yargs/issues/1826)) ([36abf26](https://www.github.com/yargs/yargs/commit/36abf26919b5a19f3adec08598539851c34b7086))
|
|
74
|
-
* zsh completion is now autoloadable ([#1856](https://www.github.com/yargs/yargs/issues/1856)) ([d731f9f](https://www.github.com/yargs/yargs/commit/d731f9f9adbc11f918e918443c5bff4149fc6681))
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### Code Refactoring
|
|
78
|
-
|
|
79
|
-
* **coerce:** coerce is now applied before validation. ([8b95f57](https://www.github.com/yargs/yargs/commit/8b95f57bb2a49b098c6bf23cea88c6f900a34f89))
|
|
80
|
-
* deprecated reset() method is now private (call yargs() instead). ([376f892](https://www.github.com/yargs/yargs/commit/376f89242733dcd4ecb8040685c40ae1d622931d))
|
|
81
|
-
* implicitly private methods are now actually private ([376f892](https://www.github.com/yargs/yargs/commit/376f89242733dcd4ecb8040685c40ae1d622931d))
|
|
82
|
-
* **yargs-factory:** refactor yargs-factory to use class ([#1895](https://www.github.com/yargs/yargs/issues/1895)) ([376f892](https://www.github.com/yargs/yargs/commit/376f89242733dcd4ecb8040685c40ae1d622931d))
|
|
83
|
-
|
|
84
|
-
## [16.2.0](https://www.github.com/yargs/yargs/compare/v16.1.1...v16.2.0) (2020-12-05)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### Features
|
|
88
|
-
|
|
89
|
-
* command() now accepts an array of modules ([f415388](https://www.github.com/yargs/yargs/commit/f415388cc454d02786c65c50dd6c7a0cf9d8b842))
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
### Bug Fixes
|
|
93
|
-
|
|
94
|
-
* add package.json to module exports ([#1818](https://www.github.com/yargs/yargs/issues/1818)) ([d783a49](https://www.github.com/yargs/yargs/commit/d783a49a7f21c9bbd4eec2990268f3244c4d5662)), closes [#1817](https://www.github.com/yargs/yargs/issues/1817)
|
|
95
|
-
|
|
96
|
-
### [16.1.1](https://www.github.com/yargs/yargs/compare/v16.1.0...v16.1.1) (2020-11-15)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
### Bug Fixes
|
|
100
|
-
|
|
101
|
-
* expose helpers for legacy versions of Node.js ([#1801](https://www.github.com/yargs/yargs/issues/1801)) ([107deaa](https://www.github.com/yargs/yargs/commit/107deaa4f68b7bc3f2386041e1f4fe0272b29c0a))
|
|
102
|
-
* **deno:** get yargs working on deno@1.5.x ([#1799](https://www.github.com/yargs/yargs/issues/1799)) ([cb01c98](https://www.github.com/yargs/yargs/commit/cb01c98c44e30f55c2dc9434caef524ae433d9a4))
|
|
103
|
-
|
|
104
|
-
## [16.1.0](https://www.github.com/yargs/yargs/compare/v16.0.3...v16.1.0) (2020-10-15)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
### Features
|
|
108
|
-
|
|
109
|
-
* expose hideBin helper for CJS ([#1768](https://www.github.com/yargs/yargs/issues/1768)) ([63e1173](https://www.github.com/yargs/yargs/commit/63e1173bb47dc651c151973a16ef659082a9ae66))
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### Bug Fixes
|
|
113
|
-
|
|
114
|
-
* **deno:** update types for deno ^1.4.0 ([#1772](https://www.github.com/yargs/yargs/issues/1772)) ([0801752](https://www.github.com/yargs/yargs/commit/080175207d281be63edf90adfe4f0568700b0bf5))
|
|
115
|
-
* **exports:** node 13.0-13.6 require a string fallback ([#1776](https://www.github.com/yargs/yargs/issues/1776)) ([b45c43a](https://www.github.com/yargs/yargs/commit/b45c43a5f64b565c3794f9792150eaeec4e00b69))
|
|
116
|
-
* **modules:** module path was incorrect ([#1759](https://www.github.com/yargs/yargs/issues/1759)) ([95a4a0a](https://www.github.com/yargs/yargs/commit/95a4a0ac573cfe158e6e4bc8c8682ebd1644a198))
|
|
117
|
-
* **positional:** positional strings no longer drop decimals ([#1761](https://www.github.com/yargs/yargs/issues/1761)) ([e1a300f](https://www.github.com/yargs/yargs/commit/e1a300f1293ad821c900284616337f080b207980))
|
|
118
|
-
* make positionals in -- count towards validation ([#1752](https://www.github.com/yargs/yargs/issues/1752)) ([eb2b29d](https://www.github.com/yargs/yargs/commit/eb2b29d34f1a41e0fd6c4e841960e5bfc329dc3c))
|
|
119
|
-
|
|
120
|
-
### [16.0.3](https://www.github.com/yargs/yargs/compare/v16.0.2...v16.0.3) (2020-09-10)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
### Bug Fixes
|
|
124
|
-
|
|
125
|
-
* move yargs.cjs to yargs to fix Node 10 imports ([#1747](https://www.github.com/yargs/yargs/issues/1747)) ([5bfb85b](https://www.github.com/yargs/yargs/commit/5bfb85b33b85db8a44b5f7a700a8e4dbaf022df0))
|
|
126
|
-
|
|
127
|
-
### [16.0.2](https://www.github.com/yargs/yargs/compare/v16.0.1...v16.0.2) (2020-09-09)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
### Bug Fixes
|
|
131
|
-
|
|
132
|
-
* **typescript:** yargs-parser was breaking @types/yargs ([#1745](https://www.github.com/yargs/yargs/issues/1745)) ([2253284](https://www.github.com/yargs/yargs/commit/2253284b233cceabd8db677b81c5bf1755eef230))
|
|
133
|
-
|
|
134
|
-
### [16.0.1](https://www.github.com/yargs/yargs/compare/v16.0.0...v16.0.1) (2020-09-09)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
### Bug Fixes
|
|
138
|
-
|
|
139
|
-
* code was not passed to process.exit ([#1742](https://www.github.com/yargs/yargs/issues/1742)) ([d1a9930](https://www.github.com/yargs/yargs/commit/d1a993035a2f76c138460052cf19425f9684b637))
|
|
140
|
-
|
|
141
|
-
## [16.0.0](https://www.github.com/yargs/yargs/compare/v15.4.2...v16.0.0) (2020-09-09)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
### ⚠ BREAKING CHANGES
|
|
145
|
-
|
|
146
|
-
* tweaks to ESM/Deno API surface: now exports yargs function by default; getProcessArgvWithoutBin becomes hideBin; types now exported for Deno.
|
|
147
|
-
* find-up replaced with escalade; export map added (limits importable files in Node >= 12); yarser-parser@19.x.x (new decamelize/camelcase implementation).
|
|
148
|
-
* **usage:** single character aliases are now shown first in help output
|
|
149
|
-
* rebase helper is no longer provided on yargs instance.
|
|
150
|
-
* drop support for EOL Node 8 (#1686)
|
|
151
|
-
|
|
152
|
-
### Features
|
|
153
|
-
|
|
154
|
-
* adds strictOptions() ([#1738](https://www.github.com/yargs/yargs/issues/1738)) ([b215fba](https://www.github.com/yargs/yargs/commit/b215fba0ed6e124e5aad6cf22c8d5875661c63a3))
|
|
155
|
-
* **helpers:** rebase, Parser, applyExtends now blessed helpers ([#1733](https://www.github.com/yargs/yargs/issues/1733)) ([c7debe8](https://www.github.com/yargs/yargs/commit/c7debe8eb1e5bc6ea20b5ed68026c56e5ebec9e1))
|
|
156
|
-
* adds support for ESM and Deno ([#1708](https://www.github.com/yargs/yargs/issues/1708)) ([ac6d5d1](https://www.github.com/yargs/yargs/commit/ac6d5d105a75711fe703f6a39dad5181b383d6c6))
|
|
157
|
-
* drop support for EOL Node 8 ([#1686](https://www.github.com/yargs/yargs/issues/1686)) ([863937f](https://www.github.com/yargs/yargs/commit/863937f23c3102f804cdea78ee3097e28c7c289f))
|
|
158
|
-
* i18n for ESM and Deno ([#1735](https://www.github.com/yargs/yargs/issues/1735)) ([c71783a](https://www.github.com/yargs/yargs/commit/c71783a5a898a0c0e92ac501c939a3ec411ac0c1))
|
|
159
|
-
* tweaks to API surface based on user feedback ([#1726](https://www.github.com/yargs/yargs/issues/1726)) ([4151fee](https://www.github.com/yargs/yargs/commit/4151fee4c33a97d26bc40de7e623e5b0eb87e9bb))
|
|
160
|
-
* **usage:** single char aliases first in help ([#1574](https://www.github.com/yargs/yargs/issues/1574)) ([a552990](https://www.github.com/yargs/yargs/commit/a552990c120646c2d85a5c9b628e1ce92a68e797))
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
### Bug Fixes
|
|
164
|
-
|
|
165
|
-
* **yargs:** add missing command(module) signature ([#1707](https://www.github.com/yargs/yargs/issues/1707)) ([0f81024](https://www.github.com/yargs/yargs/commit/0f810245494ccf13a35b7786d021b30fc95ecad5)), closes [#1704](https://www.github.com/yargs/yargs/issues/1704)
|
|
166
|
-
|
|
167
|
-
[Older CHANGELOG Entries](https://github.com/yargs/yargs/blob/master/docs/CHANGELOG-historical.md)
|