Comparing version 0.0.3 to 0.0.4
import 'colors'; | ||
import { argsParser } from './parser'; | ||
export interface Options { | ||
strict?: boolean; | ||
/** | ||
* ```js | ||
* // strict on | ||
* const app = program('my-app', { strict: true }); | ||
* app.option("--bundle, -b", "...") | ||
* app.command("build").action((options) => { | ||
* console.log(options.bundle) | ||
* }) | ||
* // $ my-app build --bundle => true | ||
* // $ my-app build -b => true | ||
* // $ my-app build -B => false | ||
* ``` | ||
*/ | ||
strict?: boolean; | ||
} | ||
declare class Program { | ||
__name: string; | ||
__version: string; | ||
__cfg: Options; | ||
__options: Record<string, string[]>; | ||
__optionsDetails: Record< | ||
string, | ||
{ | ||
des: string; | ||
default?: any; | ||
raw: string; | ||
} | ||
>; | ||
__optionsDefault: Record<string, any>; | ||
private currentCommand; | ||
private commands; | ||
constructor(name: string, opts?: Options); | ||
name(name: string): this; | ||
version(version: string): this; | ||
option(opt: string, description: string, defaultValue?: any): this; | ||
command(cmd: string, alias?: string[]): this; | ||
/** | ||
* describe specific command | ||
* @param des | ||
* @returns | ||
*/ | ||
describe(des: string): this; | ||
/** | ||
* add a callback to the specific command | ||
* @param action Handler | ||
* @returns | ||
*/ | ||
action(action: Function): this; | ||
/** | ||
* print help | ||
* @param command command for more information | ||
* @returns this | ||
*/ | ||
showHelp(command?: string): this; | ||
/** | ||
* print current version | ||
*/ | ||
showVersion(): void; | ||
/** | ||
* parse args and run application | ||
* ```js | ||
* program.parse(process.argv); | ||
* ``` | ||
* @param args argv | ||
*/ | ||
parse(args: string[]): this; | ||
__name: string; | ||
__version: string; | ||
__cfg: Options; | ||
__options: Record<string, string[]>; | ||
__optionsDetails: Record<string, { | ||
des: string; | ||
default?: any; | ||
raw: string; | ||
}>; | ||
__optionsDefault: Record<string, any>; | ||
private currentCommand; | ||
private commands; | ||
constructor(name: string, opts?: Options); | ||
name(name: string): this; | ||
version(version: string): this; | ||
option(opt: string, description: string, defaultValue?: any): this; | ||
command(cmd: string, alias?: string[]): this; | ||
/** | ||
* describe specific command | ||
* @param des | ||
* @returns | ||
*/ | ||
describe(des: string): this; | ||
/** | ||
* add a callback to the specific command | ||
* @param action Handler | ||
* @returns | ||
*/ | ||
action(action: Function): this; | ||
/** | ||
* print help | ||
* @param command command for more information | ||
* @returns this | ||
*/ | ||
showHelp(command?: string): this; | ||
/** | ||
* print current version | ||
*/ | ||
showVersion(): void; | ||
/** | ||
* parse args and run application | ||
* ```js | ||
* program.parse(process.argv); | ||
* ``` | ||
* @param args argv | ||
*/ | ||
parse(args: string[]): this; | ||
} | ||
declare function cli(name: string): Program; | ||
declare namespace cli { | ||
var Program: { | ||
new (name: string, opts?: Options): Program; | ||
}; | ||
var parser: typeof argsParser; | ||
var Program: { | ||
new (name: string, opts?: Options): Program; | ||
}; | ||
var parser: typeof argsParser; | ||
} | ||
export default cli; |
@@ -1,1 +0,1 @@ | ||
import"colors";function s(s,t={}){const o={current:null},e={__:[]},n=(s,o)=>{if(!s)return;s=Object.keys(t.names||{}).filter((o=>t.strict?t.names[o]===s||Array.isArray(t.names[o])&&t.names[o].includes(s):Array.isArray(t.names[o])&&t.names[o].map((s=>s.toLowerCase())).includes(s.toLowerCase())||"string"==typeof t.names[o]&&t.names[o].toLowerCase()===s.toLowerCase()))[0]||s,e[s]?Array.isArray(e[s])||(e[s]=[e[s]]):e[s]=null;const n=t=>{Array.isArray(e[s])?e[s].push(t):e[s]=t};"string"==typeof o?isNaN(o)?n("true"===o||"false"!==o&&o):n(Number(o)):n(o)};return s.forEach((s=>{if(s.startsWith("--"))if("--"===s)o.current=null;else{const t=s.slice(2).split("=");1===t.length?o.current=t[0]:n(t[0],t[1])}else if(s.startsWith("-")){for(let t=1;t<s.length-1;t+=1)o.current=s[t],n(o.current,!0);o.current=s[s.length-1]}else o.current?(n(o.current,s),o.current=null):""!==s&&n("__",s)})),o.current&&n(o.current,!0),e}class t{constructor(s,t){this.__name=s,this.__cfg=t||{},this.commands=[{command:"__default",args:[],des:null,default:null,action:null,alias:[]}],this.__options={help:["help","h"],version:["version","v"]},this.__optionsDetails={help:{des:"Displays help information.",raw:"--help, -h"},version:{des:"Displays current version.",raw:"--version, -v"}},this.__optionsDefault={}}name(s){return this.__name=s,this}version(s){return this.__version=s,this}option(s,t,o){const e=s.split(",").map((s=>s.trim())).map((s=>s.startsWith("--")?s.slice(2):s.startsWith("-")?s.slice(1):s));return this.__options[e[0]]=e,this.__optionsDetails[e[0]]={des:t,default:o,raw:s},this.__optionsDefault[e[0]]=o,this}command(s,t){const o=s.split(" "),e={command:o[0],args:o.slice(1),des:"",default:s,action:null,alias:t||[]};return e.args=e.args.map((s=>(s.startsWith("<")&&s.endsWith(">")||(console.error(`Parsing Error - ${s}`),process.exit(1)),s.slice(1,-1)))),this.currentCommand=e.command,this.commands.push(e),this}describe(s){const t=this.commands.filter((s=>s.command===this.currentCommand))[0]||0;return 0===t?this.commands[0].des=s:t.des=s,this}action(s){const t=this.commands.filter((s=>s.command===this.currentCommand))[0]||0;return 0===t?this.commands[0].action=s:t.action=s,this}showHelp(s){const t="$".gray;if(s){let o=0;Object.keys(this.__options).forEach((s=>{const t=this.__optionsDetails[s].raw;t.length>o&&(o=t.length)}));const e=this.commands.filter((t=>t.command===s))[0];if(!e)return this;console.log(),console.log(" Usage".bold),console.log(` ${t} ${this.__name} ${e.default}`),console.log(),console.log(` ${e.des||"no description".gray}`),0!==e.alias.length&&(console.log(),console.log(" Alias".bold),e.alias.forEach((s=>{console.log(` ${t} ${this.__name} ${s}`)})),console.log(` ${t} ${this.__name} ${e.command}`)),console.log(),console.log(" Options".bold),Object.keys(this.__options).forEach((s=>{console.log(` ${this.__optionsDetails[s].raw} ${" ".repeat(o-this.__optionsDetails[s].raw.length)}${(this.__optionsDetails[s].des||"").gray}${this.__optionsDetails[s].default?` (default ${this.__optionsDetails[s].default})`.cyan:""}`)}))}else{let s=0;this.commands.forEach((t=>{t.command.length>s&&(s=t.command.length)}));let o=0;Object.keys(this.__options).forEach((s=>{const t=this.__optionsDetails[s].raw;t.length>o&&(o=t.length)})),console.log(),console.log(" Usage".bold),console.log(` ${t} ${this.__name} <command> [options]`),console.log(),console.log(" Commands".bold),this.commands.forEach((t=>{"__default"!==t.command&&console.log(` ${t.command} ${" ".repeat(s-t.command.length)}${(t.des||"").gray}`)})),console.log(),console.log(" Options".bold),Object.keys(this.__options).forEach((s=>{console.log(` ${this.__optionsDetails[s].raw} ${" ".repeat(o-this.__optionsDetails[s].raw.length)}${(this.__optionsDetails[s].des||"").gray}${this.__optionsDetails[s].default?` (default ${this.__optionsDetails[s].default})`.cyan:""}`)})),console.log(),console.log(` Run \`${this.__name} <command> --help\` for more information.`)}console.log()}showVersion(){console.log(`${"$".gray} v${this.__version}`)}parse(t){const o=s(t.slice(2),{names:Object.assign(Object.assign({},this.__options),{help:"h",version:"v"}),strict:this.__cfg.strict||!0});let e=o.__[0]||"";const n=this.commands.filter((s=>s.command===e||!!s.alias.includes(e.trim())&&(e=s.command,!0)))[0]||0;if(!0===o.help)return this.showHelp(e),this;if(!0===o.version)return this.showVersion(),this;if(0===n)this.commands[0].action&&this.commands[0].action();else{const s=o.__.slice(1),t=Object.assign(Object.assign({},this.__optionsDefault),o);n.action(...s,t)}return this}}function o(s){return new t(s)}o.Program=t,o.parser=s;export{o as default}; | ||
import"colors";function s(s,t={}){const o={current:null},e={__:[]},n=(s,o)=>{if(!s)return;s=Object.keys(t.names||{}).filter((o=>t.strict?t.names[o]===s||Array.isArray(t.names[o])&&t.names[o].includes(s):Array.isArray(t.names[o])&&t.names[o].map((s=>s.toLowerCase())).includes(s.toLowerCase())||"string"==typeof t.names[o]&&t.names[o].toLowerCase()===s.toLowerCase()))[0]||s,e[s]?Array.isArray(e[s])||(e[s]=[e[s]]):e[s]=null;const n=t=>{Array.isArray(e[s])?e[s].push(t):e[s]=t};"string"==typeof o?isNaN(o)?n("true"===o||"false"!==o&&o):n(Number(o)):n(o)};return s.forEach((s=>{if(s.startsWith("--"))if("--"===s)o.current=null;else{const t=s.slice(2).split("=");1===t.length?o.current=t[0]:n(t[0],t[1])}else if(s.startsWith("-")){for(let t=1;t<s.length-1;t+=1)o.current=s[t],n(o.current,!0);o.current=s[s.length-1]}else o.current?(n(o.current,s),o.current=null):""!==s&&n("__",s)})),o.current&&n(o.current,!0),e}class t{constructor(s,t){this.__name=s,this.__cfg=t||{},this.commands=[{command:"__default",args:[],des:null,default:null,action:null,alias:[]}],this.__options={help:["help","h"],version:["version","v"]},this.__optionsDetails={help:{des:"Displays help information.",raw:"--help, -h"},version:{des:"Displays current version.",raw:"--version, -v"}},this.__optionsDefault={}}name(s){return this.__name=s,this}version(s){return this.__version=s,this}option(s,t,o){const e=s.split(",").map((s=>s.trim())).map((s=>s.startsWith("--")?s.slice(2):s.startsWith("-")?s.slice(1):s));return this.__options[e[0]]=e,this.__optionsDetails[e[0]]={des:t,default:o,raw:s},this.__optionsDefault[e[0]]=o,this}command(s,t){const o=s.split(" "),e={command:o[0],args:o.slice(1),des:"",default:s,action:null,alias:t||[]};return e.args=e.args.map((s=>(s.startsWith("<")&&s.endsWith(">")||(console.error(`Parsing Error - ${s}`),process.exit(1)),s.slice(1,-1)))),this.currentCommand=e.command,this.commands.push(e),this}describe(s){const t=this.commands.filter((s=>s.command===this.currentCommand))[0]||0;return 0===t?this.commands[0].des=s:t.des=s,this}action(s){const t=this.commands.filter((s=>s.command===this.currentCommand))[0]||0;return 0===t?this.commands[0].action=s:t.action=s,this}showHelp(s){const t="$".gray;if(s){let o=0;Object.keys(this.__options).forEach((s=>{const t=this.__optionsDetails[s].raw;t.length>o&&(o=t.length)}));const e=this.commands.filter((t=>t.command===s))[0];if(!e)return this;console.log(),console.log(" Usage".bold),console.log(` ${t} ${this.__name} ${e.default}`),console.log(),console.log(` ${e.des||"no description".gray}`),0!==e.alias.length&&(console.log(),console.log(" Alias".bold),e.alias.forEach((s=>{console.log(` ${t} ${this.__name} ${s}`)})),console.log(` ${t} ${this.__name} ${e.command}`)),console.log(),console.log(" Options".bold),Object.keys(this.__options).forEach((s=>{console.log(` ${this.__optionsDetails[s].raw} ${" ".repeat(o-this.__optionsDetails[s].raw.length)}${(this.__optionsDetails[s].des||"").gray}${this.__optionsDetails[s].default?` (default ${this.__optionsDetails[s].default})`.cyan:""}`)}))}else{let s=0;this.commands.forEach((t=>{t.command.length>s&&(s=t.command.length)}));let o=0;Object.keys(this.__options).forEach((s=>{const t=this.__optionsDetails[s].raw;t.length>o&&(o=t.length)})),console.log(),console.log(" Usage".bold),console.log(` ${t} ${this.__name} <command> [options]`),console.log(),console.log(" Commands".bold),this.commands.forEach((t=>{"__default"!==t.command&&console.log(` ${t.command} ${" ".repeat(s-t.command.length)}${(t.des||"").gray}`)})),console.log(),console.log(" Options".bold),Object.keys(this.__options).forEach((s=>{console.log(` ${this.__optionsDetails[s].raw} ${" ".repeat(o-this.__optionsDetails[s].raw.length)}${(this.__optionsDetails[s].des||"").gray}${this.__optionsDetails[s].default?` (default ${this.__optionsDetails[s].default})`.cyan:""}`)})),console.log(),console.log(` Run \`${this.__name} <command> --help\` for more information.`)}console.log()}showVersion(){console.log(`${"$".gray} v${this.__version}`)}parse(t){const o=s(t.slice(2),{names:Object.assign(Object.assign({},this.__options),{help:"h",version:"v"}),strict:this.__cfg.strict||!0});let e=o.__[0]||"";const n=this.commands.filter((s=>s.command===e||!!s.alias.includes(e.trim())&&(e=s.command,!0)))[0]||0;if(!0===o.help)return this.showHelp(e),this;if(!0===o.version)return this.showVersion(),this;if(0===n)this.commands[0].action&&this.commands[0].action(o);else{const s=o.__.slice(1),t=Object.assign(Object.assign({},this.__optionsDefault),o);n.action(...s,t)}return this}}function o(s){return new t(s)}o.Program=t,o.parser=s;export{o as default}; |
@@ -1,1 +0,1 @@ | ||
function s(s,t={}){const o={current:null},e={__:[]},n=(s,o)=>{if(!s)return;s=Object.keys(t.names||{}).filter((o=>t.strict?t.names[o]===s||Array.isArray(t.names[o])&&t.names[o].includes(s):Array.isArray(t.names[o])&&t.names[o].map((s=>s.toLowerCase())).includes(s.toLowerCase())||"string"==typeof t.names[o]&&t.names[o].toLowerCase()===s.toLowerCase()))[0]||s,e[s]?Array.isArray(e[s])||(e[s]=[e[s]]):e[s]=null;const n=t=>{Array.isArray(e[s])?e[s].push(t):e[s]=t};"string"==typeof o?isNaN(o)?n("true"===o||"false"!==o&&o):n(Number(o)):n(o)};return s.forEach((s=>{if(s.startsWith("--"))if("--"===s)o.current=null;else{const t=s.slice(2).split("=");1===t.length?o.current=t[0]:n(t[0],t[1])}else if(s.startsWith("-")){for(let t=1;t<s.length-1;t+=1)o.current=s[t],n(o.current,!0);o.current=s[s.length-1]}else o.current?(n(o.current,s),o.current=null):""!==s&&n("__",s)})),o.current&&n(o.current,!0),e}require("colors");class t{constructor(s,t){this.__name=s,this.__cfg=t||{},this.commands=[{command:"__default",args:[],des:null,default:null,action:null,alias:[]}],this.__options={help:["help","h"],version:["version","v"]},this.__optionsDetails={help:{des:"Displays help information.",raw:"--help, -h"},version:{des:"Displays current version.",raw:"--version, -v"}},this.__optionsDefault={}}name(s){return this.__name=s,this}version(s){return this.__version=s,this}option(s,t,o){const e=s.split(",").map((s=>s.trim())).map((s=>s.startsWith("--")?s.slice(2):s.startsWith("-")?s.slice(1):s));return this.__options[e[0]]=e,this.__optionsDetails[e[0]]={des:t,default:o,raw:s},this.__optionsDefault[e[0]]=o,this}command(s,t){const o=s.split(" "),e={command:o[0],args:o.slice(1),des:"",default:s,action:null,alias:t||[]};return e.args=e.args.map((s=>(s.startsWith("<")&&s.endsWith(">")||(console.error(`Parsing Error - ${s}`),process.exit(1)),s.slice(1,-1)))),this.currentCommand=e.command,this.commands.push(e),this}describe(s){const t=this.commands.filter((s=>s.command===this.currentCommand))[0]||0;return 0===t?this.commands[0].des=s:t.des=s,this}action(s){const t=this.commands.filter((s=>s.command===this.currentCommand))[0]||0;return 0===t?this.commands[0].action=s:t.action=s,this}showHelp(s){const t="$".gray;if(s){let o=0;Object.keys(this.__options).forEach((s=>{const t=this.__optionsDetails[s].raw;t.length>o&&(o=t.length)}));const e=this.commands.filter((t=>t.command===s))[0];if(!e)return this;console.log(),console.log(" Usage".bold),console.log(` ${t} ${this.__name} ${e.default}`),console.log(),console.log(` ${e.des||"no description".gray}`),0!==e.alias.length&&(console.log(),console.log(" Alias".bold),e.alias.forEach((s=>{console.log(` ${t} ${this.__name} ${s}`)})),console.log(` ${t} ${this.__name} ${e.command}`)),console.log(),console.log(" Options".bold),Object.keys(this.__options).forEach((s=>{console.log(` ${this.__optionsDetails[s].raw} ${" ".repeat(o-this.__optionsDetails[s].raw.length)}${(this.__optionsDetails[s].des||"").gray}${this.__optionsDetails[s].default?` (default ${this.__optionsDetails[s].default})`.cyan:""}`)}))}else{let s=0;this.commands.forEach((t=>{t.command.length>s&&(s=t.command.length)}));let o=0;Object.keys(this.__options).forEach((s=>{const t=this.__optionsDetails[s].raw;t.length>o&&(o=t.length)})),console.log(),console.log(" Usage".bold),console.log(` ${t} ${this.__name} <command> [options]`),console.log(),console.log(" Commands".bold),this.commands.forEach((t=>{"__default"!==t.command&&console.log(` ${t.command} ${" ".repeat(s-t.command.length)}${(t.des||"").gray}`)})),console.log(),console.log(" Options".bold),Object.keys(this.__options).forEach((s=>{console.log(` ${this.__optionsDetails[s].raw} ${" ".repeat(o-this.__optionsDetails[s].raw.length)}${(this.__optionsDetails[s].des||"").gray}${this.__optionsDetails[s].default?` (default ${this.__optionsDetails[s].default})`.cyan:""}`)})),console.log(),console.log(` Run \`${this.__name} <command> --help\` for more information.`)}console.log()}showVersion(){console.log(`${"$".gray} v${this.__version}`)}parse(t){const o=s(t.slice(2),{names:Object.assign(Object.assign({},this.__options),{help:"h",version:"v"}),strict:this.__cfg.strict||!0});let e=o.__[0]||"";const n=this.commands.filter((s=>s.command===e||!!s.alias.includes(e.trim())&&(e=s.command,!0)))[0]||0;if(!0===o.help)return this.showHelp(e),this;if(!0===o.version)return this.showVersion(),this;if(0===n)this.commands[0].action&&this.commands[0].action();else{const s=o.__.slice(1),t=Object.assign(Object.assign({},this.__optionsDefault),o);n.action(...s,t)}return this}}function o(s){return new t(s)}o.Program=t,o.parser=s,module.exports=o; | ||
function s(s,t={}){const o={current:null},e={__:[]},n=(s,o)=>{if(!s)return;s=Object.keys(t.names||{}).filter((o=>t.strict?t.names[o]===s||Array.isArray(t.names[o])&&t.names[o].includes(s):Array.isArray(t.names[o])&&t.names[o].map((s=>s.toLowerCase())).includes(s.toLowerCase())||"string"==typeof t.names[o]&&t.names[o].toLowerCase()===s.toLowerCase()))[0]||s,e[s]?Array.isArray(e[s])||(e[s]=[e[s]]):e[s]=null;const n=t=>{Array.isArray(e[s])?e[s].push(t):e[s]=t};"string"==typeof o?isNaN(o)?n("true"===o||"false"!==o&&o):n(Number(o)):n(o)};return s.forEach((s=>{if(s.startsWith("--"))if("--"===s)o.current=null;else{const t=s.slice(2).split("=");1===t.length?o.current=t[0]:n(t[0],t[1])}else if(s.startsWith("-")){for(let t=1;t<s.length-1;t+=1)o.current=s[t],n(o.current,!0);o.current=s[s.length-1]}else o.current?(n(o.current,s),o.current=null):""!==s&&n("__",s)})),o.current&&n(o.current,!0),e}require("colors");class t{constructor(s,t){this.__name=s,this.__cfg=t||{},this.commands=[{command:"__default",args:[],des:null,default:null,action:null,alias:[]}],this.__options={help:["help","h"],version:["version","v"]},this.__optionsDetails={help:{des:"Displays help information.",raw:"--help, -h"},version:{des:"Displays current version.",raw:"--version, -v"}},this.__optionsDefault={}}name(s){return this.__name=s,this}version(s){return this.__version=s,this}option(s,t,o){const e=s.split(",").map((s=>s.trim())).map((s=>s.startsWith("--")?s.slice(2):s.startsWith("-")?s.slice(1):s));return this.__options[e[0]]=e,this.__optionsDetails[e[0]]={des:t,default:o,raw:s},this.__optionsDefault[e[0]]=o,this}command(s,t){const o=s.split(" "),e={command:o[0],args:o.slice(1),des:"",default:s,action:null,alias:t||[]};return e.args=e.args.map((s=>(s.startsWith("<")&&s.endsWith(">")||(console.error(`Parsing Error - ${s}`),process.exit(1)),s.slice(1,-1)))),this.currentCommand=e.command,this.commands.push(e),this}describe(s){const t=this.commands.filter((s=>s.command===this.currentCommand))[0]||0;return 0===t?this.commands[0].des=s:t.des=s,this}action(s){const t=this.commands.filter((s=>s.command===this.currentCommand))[0]||0;return 0===t?this.commands[0].action=s:t.action=s,this}showHelp(s){const t="$".gray;if(s){let o=0;Object.keys(this.__options).forEach((s=>{const t=this.__optionsDetails[s].raw;t.length>o&&(o=t.length)}));const e=this.commands.filter((t=>t.command===s))[0];if(!e)return this;console.log(),console.log(" Usage".bold),console.log(` ${t} ${this.__name} ${e.default}`),console.log(),console.log(` ${e.des||"no description".gray}`),0!==e.alias.length&&(console.log(),console.log(" Alias".bold),e.alias.forEach((s=>{console.log(` ${t} ${this.__name} ${s}`)})),console.log(` ${t} ${this.__name} ${e.command}`)),console.log(),console.log(" Options".bold),Object.keys(this.__options).forEach((s=>{console.log(` ${this.__optionsDetails[s].raw} ${" ".repeat(o-this.__optionsDetails[s].raw.length)}${(this.__optionsDetails[s].des||"").gray}${this.__optionsDetails[s].default?` (default ${this.__optionsDetails[s].default})`.cyan:""}`)}))}else{let s=0;this.commands.forEach((t=>{t.command.length>s&&(s=t.command.length)}));let o=0;Object.keys(this.__options).forEach((s=>{const t=this.__optionsDetails[s].raw;t.length>o&&(o=t.length)})),console.log(),console.log(" Usage".bold),console.log(` ${t} ${this.__name} <command> [options]`),console.log(),console.log(" Commands".bold),this.commands.forEach((t=>{"__default"!==t.command&&console.log(` ${t.command} ${" ".repeat(s-t.command.length)}${(t.des||"").gray}`)})),console.log(),console.log(" Options".bold),Object.keys(this.__options).forEach((s=>{console.log(` ${this.__optionsDetails[s].raw} ${" ".repeat(o-this.__optionsDetails[s].raw.length)}${(this.__optionsDetails[s].des||"").gray}${this.__optionsDetails[s].default?` (default ${this.__optionsDetails[s].default})`.cyan:""}`)})),console.log(),console.log(` Run \`${this.__name} <command> --help\` for more information.`)}console.log()}showVersion(){console.log(`${"$".gray} v${this.__version}`)}parse(t){const o=s(t.slice(2),{names:Object.assign(Object.assign({},this.__options),{help:"h",version:"v"}),strict:this.__cfg.strict||!0});let e=o.__[0]||"";const n=this.commands.filter((s=>s.command===e||!!s.alias.includes(e.trim())&&(e=s.command,!0)))[0]||0;if(!0===o.help)return this.showHelp(e),this;if(!0===o.version)return this.showVersion(),this;if(0===n)this.commands[0].action&&this.commands[0].action(o);else{const s=o.__.slice(1),t=Object.assign(Object.assign({},this.__optionsDefault),o);n.action(...s,t)}return this}}function o(s){return new t(s)}o.Program=t,o.parser=s,module.exports=o; |
{ | ||
"name": "animaux", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Javascript Library for CLI applications.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
15133
116