country-flag-cli 0.0.1 → 0.0.5

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 CHANGED
@@ -1,24 +1,3 @@
1
- # typescript-cli-starter
2
-
3
- A simple and zero-opinion typescript starter template for building cross-platform command line applications.
4
-
5
- ![GitHub package.json dynamic](https://img.shields.io/github/package-json/keywords/khalidx/typescript-cli-starter.svg?style=flat-square)
6
-
7
- ![GitHub](https://img.shields.io/github/license/khalidx/typescript-cli-starter.svg?style=flat-square)
8
- ![GitHub package.json version](https://img.shields.io/github/package-json/v/khalidx/typescript-cli-starter.svg?style=flat-square)
9
- ![GitHub top language](https://img.shields.io/github/languages/top/khalidx/typescript-cli-starter.svg?style=flat-square)
10
-
11
- ![GitHub last commit](https://img.shields.io/github/last-commit/khalidx/typescript-cli-starter.svg?style=flat-square)
12
-
13
- Includes:
14
-
15
- - [TypeScript](https://www.typescriptlang.org/), for writing good code
16
- - [Ava](https://www.npmjs.com/package/ava), for writing good tests
17
- - [Commander](https://www.npmjs.com/package/commander), for building CLI applications
18
- - [Pkg](https://www.npmjs.com/package/pkg), for building cross-platform native executables
19
-
20
- Your application will be installable from `npm` or by sharing your native executables.
21
-
22
1
  ## Usage
23
2
 
24
3
  ### **dev**
package/dist/cli.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ var k=Object.create;var v=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var I=t=>v(t,"__esModule",{value:!0});var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var U=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of H(e))!j.call(t,o)&&(n||o!=="default")&&v(t,o,{get:()=>e[o],enumerable:!(i=q(e,o))||i.enumerable});return t},F=(t,e)=>U(I(v(t!=null?k(N(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var A=L((d,E)=>{var M=require("events").EventEmitter,_=require("child_process").spawn,m=require("path"),D=m.dirname,b=m.basename,w=require("fs");require("util").inherits(s,M);d=E.exports=new s;d.Command=s;d.Option=c;function c(t,e){this.flags=t,this.required=t.indexOf("<")>=0,this.optional=t.indexOf("[")>=0,this.bool=t.indexOf("-no-")===-1,t=t.split(/[ ,|]+/),t.length>1&&!/^[[<]/.test(t[1])&&(this.short=t.shift()),this.long=t.shift(),this.description=e||""}c.prototype.name=function(){return this.long.replace("--","").replace("no-","")};c.prototype.attributeName=function(){return G(this.name())};c.prototype.is=function(t){return this.short===t||this.long===t};function s(t){this.commands=[],this.options=[],this._execs={},this._allowUnknownOption=!1,this._args=[],this._name=t||""}s.prototype.command=function(t,e,n){typeof e=="object"&&e!==null&&(n=e,e=null),n=n||{};var i=t.split(/ +/),o=new s(i.shift());return e&&(o.description(e),this.executables=!0,this._execs[o._name]=!0,n.isDefault&&(this.defaultExecutable=o._name)),o._noHelp=!!n.noHelp,this.commands.push(o),o.parseExpectedArgs(i),o.parent=this,e?this:o};s.prototype.arguments=function(t){return this.parseExpectedArgs(t.split(/ +/))};s.prototype.addImplicitHelpCommand=function(){this.command("help [cmd]","display help for [cmd]")};s.prototype.parseExpectedArgs=function(t){if(!!t.length){var e=this;return t.forEach(function(n){var i={required:!1,name:"",variadic:!1};switch(n[0]){case"<":i.required=!0,i.name=n.slice(1,-1);break;case"[":i.name=n.slice(1,-1);break}i.name.length>3&&i.name.slice(-3)==="..."&&(i.variadic=!0,i.name=i.name.slice(0,-3)),i.name&&e._args.push(i)}),this}};s.prototype.action=function(t){var e=this,n=function(r,h){r=r||[],h=h||[];var a=e.parseOptions(h);O(e,a.unknown),a.unknown.length>0&&e.unknownOption(a.unknown[0]),a.args.length&&(r=a.args.concat(r)),e._args.forEach(function(p,u){p.required&&r[u]==null?e.missingArgument(p.name):p.variadic&&(u!==e._args.length-1&&e.variadicArgNotLast(p.name),r[u]=r.splice(u))}),e._args.length?r[e._args.length]=e:r.push(e),t.apply(e,r)},i=this.parent||this,o=i===this?"*":this._name;return i.on("command:"+o,n),this._alias&&i.on("command:"+this._alias,n),this};s.prototype.option=function(t,e,n,i){var o=this,r=new c(t,e),h=r.name(),a=r.attributeName();if(typeof n!="function")if(n instanceof RegExp){var p=n;n=function(u,g){var l=p.exec(u);return l?l[0]:g}}else i=n,n=null;return(!r.bool||r.optional||r.required)&&(r.bool||(i=!0),i!==void 0&&(o[a]=i,r.defaultValue=i)),this.options.push(r),this.on("option:"+h,function(u){u!==null&&n&&(u=n(u,o[a]===void 0?i:o[a])),typeof o[a]=="boolean"||typeof o[a]=="undefined"?u==null?o[a]=r.bool?i||!0:!1:o[a]=u:u!==null&&(o[a]=u)}),this};s.prototype.allowUnknownOption=function(t){return this._allowUnknownOption=arguments.length===0||t,this};s.prototype.parse=function(t){this.executables&&this.addImplicitHelpCommand(),this.rawArgs=t,this._name=this._name||b(t[1],".js"),this.executables&&t.length<3&&!this.defaultExecutable&&t.push("--help");var e=this.parseOptions(this.normalize(t.slice(2))),n=this.args=e.args,i=this.parseArgs(this.args,e.unknown),o=i.args[0],r=null;return o&&(r=this.commands.filter(function(h){return h.alias()===o})[0]),this._execs[o]===!0?this.executeSubCommand(t,n,e.unknown):r?(n[0]=r._name,this.executeSubCommand(t,n,e.unknown)):this.defaultExecutable?(n.unshift(this.defaultExecutable),this.executeSubCommand(t,n,e.unknown)):i};s.prototype.executeSubCommand=function(t,e,n){e=e.concat(n),e.length||this.help(),e[0]==="help"&&e.length===1&&this.help(),e[0]==="help"&&(e[0]=e[1],e[1]="--help");var i=t[1],o=b(i,m.extname(i))+"-"+e[0],r,h=w.realpathSync(i);r=D(h);var a=m.join(r,o),p=!1;y(a+".js")?(o=a+".js",p=!0):y(a+".ts")?(o=a+".ts",p=!0):y(a)&&(o=a),e=e.slice(1);var u;process.platform!=="win32"?p?(e.unshift(o),e=(process.execArgv||[]).concat(e),u=_(process.argv[0],e,{stdio:"inherit",customFds:[0,1,2]})):u=_(o,e,{stdio:"inherit",customFds:[0,1,2]}):(e.unshift(o),u=_(process.execPath,e,{stdio:"inherit"}));var g=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];g.forEach(function(l){process.on(l,function(){u.killed===!1&&u.exitCode===null&&u.kill(l)})}),u.on("close",process.exit.bind(process)),u.on("error",function(l){l.code==="ENOENT"?console.error("error: %s(1) does not exist, try --help",o):l.code==="EACCES"&&console.error("error: %s(1) not executable. try chmod or run with root",o),process.exit(1)}),this.runningCommand=u};s.prototype.normalize=function(t){for(var e=[],n,i,o,r=0,h=t.length;r<h;++r)if(n=t[r],r>0&&(i=this.optionFor(t[r-1])),n==="--"){e=e.concat(t.slice(r));break}else i&&i.required?e.push(n):n.length>1&&n[0]==="-"&&n[1]!=="-"?n.slice(1).split("").forEach(function(a){e.push("-"+a)}):/^--/.test(n)&&~(o=n.indexOf("="))?e.push(n.slice(0,o),n.slice(o+1)):e.push(n);return e};s.prototype.parseArgs=function(t,e){var n;return t.length?(n=t[0],this.listeners("command:"+n).length?this.emit("command:"+t.shift(),t,e):this.emit("command:*",t)):(O(this,e),e.length>0&&this.unknownOption(e[0]),this.commands.length===0&&this._args.filter(function(i){return i.required}).length===0&&this.emit("command:*")),this};s.prototype.optionFor=function(t){for(var e=0,n=this.options.length;e<n;++e)if(this.options[e].is(t))return this.options[e]};s.prototype.parseOptions=function(t){for(var e=[],n=t.length,i,o,r,h=[],a=0;a<n;++a){if(r=t[a],i){e.push(r);continue}if(r==="--"){i=!0;continue}if(o=this.optionFor(r),o){if(o.required){if(r=t[++a],r==null)return this.optionMissingArgument(o);this.emit("option:"+o.name(),r)}else o.optional?(r=t[a+1],r==null||r[0]==="-"&&r!=="-"?r=null:++a,this.emit("option:"+o.name(),r)):this.emit("option:"+o.name());continue}if(r.length>1&&r[0]==="-"){h.push(r),a+1<t.length&&t[a+1][0]!=="-"&&h.push(t[++a]);continue}e.push(r)}return{args:e,unknown:h}};s.prototype.opts=function(){for(var t={},e=this.options.length,n=0;n<e;n++){var i=this.options[n].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t};s.prototype.missingArgument=function(t){console.error("error: missing required argument `%s'",t),process.exit(1)};s.prototype.optionMissingArgument=function(t,e){e?console.error("error: option `%s' argument missing, got `%s'",t.flags,e):console.error("error: option `%s' argument missing",t.flags),process.exit(1)};s.prototype.unknownOption=function(t){this._allowUnknownOption||(console.error("error: unknown option `%s'",t),process.exit(1))};s.prototype.variadicArgNotLast=function(t){console.error("error: variadic arguments must be last `%s'",t),process.exit(1)};s.prototype.version=function(t,e){if(arguments.length===0)return this._version;this._version=t,e=e||"-V, --version";var n=new c(e,"output the version number");return this._versionOptionName=n.long.substr(2)||"version",this.options.push(n),this.on("option:"+this._versionOptionName,function(){process.stdout.write(t+`
3
+ `),process.exit(0)}),this};s.prototype.description=function(t,e){return arguments.length===0?this._description:(this._description=t,this._argsDescription=e,this)};s.prototype.alias=function(t){var e=this;if(this.commands.length!==0&&(e=this.commands[this.commands.length-1]),arguments.length===0)return e._alias;if(t===e._name)throw new Error("Command alias can't be the same as its name");return e._alias=t,this};s.prototype.usage=function(t){var e=this._args.map(function(i){return C(i)}),n="[options]"+(this.commands.length?" [command]":"")+(this._args.length?" "+e.join(" "):"");return arguments.length===0?this._usage||n:(this._usage=t,this)};s.prototype.name=function(t){return arguments.length===0?this._name:(this._name=t,this)};s.prototype.prepareCommands=function(){return this.commands.filter(function(t){return!t._noHelp}).map(function(t){var e=t._args.map(function(n){return C(n)}).join(" ");return[t._name+(t._alias?"|"+t._alias:"")+(t.options.length?" [options]":"")+(e?" "+e:""),t._description]})};s.prototype.largestCommandLength=function(){var t=this.prepareCommands();return t.reduce(function(e,n){return Math.max(e,n[0].length)},0)};s.prototype.largestOptionLength=function(){var t=[].slice.call(this.options);return t.push({flags:"-h, --help"}),t.reduce(function(e,n){return Math.max(e,n.flags.length)},0)};s.prototype.largestArgLength=function(){return this._args.reduce(function(t,e){return Math.max(t,e.name.length)},0)};s.prototype.padWidth=function(){var t=this.largestOptionLength();return this._argsDescription&&this._args.length&&this.largestArgLength()>t&&(t=this.largestArgLength()),this.commands&&this.commands.length&&this.largestCommandLength()>t&&(t=this.largestCommandLength()),t};s.prototype.optionHelp=function(){var t=this.padWidth();return this.options.map(function(e){return f(e.flags,t)+" "+e.description+(e.bool&&e.defaultValue!==void 0?" (default: "+JSON.stringify(e.defaultValue)+")":"")}).concat([f("-h, --help",t)+" output usage information"]).join(`
4
+ `)};s.prototype.commandHelp=function(){if(!this.commands.length)return"";var t=this.prepareCommands(),e=this.padWidth();return["Commands:",t.map(function(n){var i=n[1]?" "+n[1]:"";return(i?f(n[0],e):n[0])+i}).join(`
5
+ `).replace(/^/gm," "),""].join(`
6
+ `)};s.prototype.helpInformation=function(){var t=[];if(this._description){t=[this._description,""];var e=this._argsDescription;if(e&&this._args.length){var n=this.padWidth();t.push("Arguments:"),t.push(""),this._args.forEach(function(p){t.push(" "+f(p.name,n)+" "+e[p.name])}),t.push("")}}var i=this._name;this._alias&&(i=i+"|"+this._alias);var o=["Usage: "+i+" "+this.usage(),""],r=[],h=this.commandHelp();h&&(r=[h]);var a=["Options:",""+this.optionHelp().replace(/^/gm," "),""];return o.concat(t).concat(a).concat(r).join(`
7
+ `)};s.prototype.outputHelp=function(t){t||(t=function(e){return e}),process.stdout.write(t(this.helpInformation())),this.emit("--help")};s.prototype.help=function(t){this.outputHelp(t),process.exit()};function G(t){return t.split("-").reduce(function(e,n){return e+n[0].toUpperCase()+n.slice(1)})}function f(t,e){var n=Math.max(0,e-t.length);return t+Array(n+1).join(" ")}function O(t,e){e=e||[];for(var n=0;n<e.length;n++)(e[n]==="--help"||e[n]==="-h")&&(t.outputHelp(),process.exit(0))}function C(t){var e=t.name+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}function y(t){try{if(w.statSync(t).isFile())return!0}catch{return!1}}});var x=F(A());function S(t){if(t.length==2)return t.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))}x.default.version("0.1.0").name("country-flag-cli").command("get <flag>").action(t=>{let e=S(t);console.log(e)});x.default.parse(process.argv);
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../node_modules/commander/index.js", "../src/cli.ts", "../src/index.ts"],
4
+ "sourcesContent": ["/**\n * Module dependencies.\n */\n\nvar EventEmitter = require('events').EventEmitter;\nvar spawn = require('child_process').spawn;\nvar path = require('path');\nvar dirname = path.dirname;\nvar basename = path.basename;\nvar fs = require('fs');\n\n/**\n * Inherit `Command` from `EventEmitter.prototype`.\n */\n\nrequire('util').inherits(Command, EventEmitter);\n\n/**\n * Expose the root command.\n */\n\nexports = module.exports = new Command();\n\n/**\n * Expose `Command`.\n */\n\nexports.Command = Command;\n\n/**\n * Expose `Option`.\n */\n\nexports.Option = Option;\n\n/**\n * Initialize a new `Option` with the given `flags` and `description`.\n *\n * @param {String} flags\n * @param {String} description\n * @api public\n */\n\nfunction Option(flags, description) {\n this.flags = flags;\n this.required = flags.indexOf('<') >= 0;\n this.optional = flags.indexOf('[') >= 0;\n this.bool = flags.indexOf('-no-') === -1;\n flags = flags.split(/[ ,|]+/);\n if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();\n this.long = flags.shift();\n this.description = description || '';\n}\n\n/**\n * Return option name.\n *\n * @return {String}\n * @api private\n */\n\nOption.prototype.name = function() {\n return this.long\n .replace('--', '')\n .replace('no-', '');\n};\n\n/**\n * Return option name, in a camelcase format that can be used\n * as a object attribute key.\n *\n * @return {String}\n * @api private\n */\n\nOption.prototype.attributeName = function() {\n return camelcase(this.name());\n};\n\n/**\n * Check if `arg` matches the short or long flag.\n *\n * @param {String} arg\n * @return {Boolean}\n * @api private\n */\n\nOption.prototype.is = function(arg) {\n return this.short === arg || this.long === arg;\n};\n\n/**\n * Initialize a new `Command`.\n *\n * @param {String} name\n * @api public\n */\n\nfunction Command(name) {\n this.commands = [];\n this.options = [];\n this._execs = {};\n this._allowUnknownOption = false;\n this._args = [];\n this._name = name || '';\n}\n\n/**\n * Add command `name`.\n *\n * The `.action()` callback is invoked when the\n * command `name` is specified via __ARGV__,\n * and the remaining arguments are applied to the\n * function for access.\n *\n * When the `name` is \"*\" an un-matched command\n * will be passed as the first arg, followed by\n * the rest of __ARGV__ remaining.\n *\n * Examples:\n *\n * program\n * .version('0.0.1')\n * .option('-C, --chdir <path>', 'change the working directory')\n * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')\n * .option('-T, --no-tests', 'ignore test hook')\n *\n * program\n * .command('setup')\n * .description('run remote setup commands')\n * .action(function() {\n * console.log('setup');\n * });\n *\n * program\n * .command('exec <cmd>')\n * .description('run the given remote command')\n * .action(function(cmd) {\n * console.log('exec \"%s\"', cmd);\n * });\n *\n * program\n * .command('teardown <dir> [otherDirs...]')\n * .description('run teardown commands')\n * .action(function(dir, otherDirs) {\n * console.log('dir \"%s\"', dir);\n * if (otherDirs) {\n * otherDirs.forEach(function (oDir) {\n * console.log('dir \"%s\"', oDir);\n * });\n * }\n * });\n *\n * program\n * .command('*')\n * .description('deploy the given env')\n * .action(function(env) {\n * console.log('deploying \"%s\"', env);\n * });\n *\n * program.parse(process.argv);\n *\n * @param {String} name\n * @param {String} [desc] for git-style sub-commands\n * @return {Command} the new command\n * @api public\n */\n\nCommand.prototype.command = function(name, desc, opts) {\n if (typeof desc === 'object' && desc !== null) {\n opts = desc;\n desc = null;\n }\n opts = opts || {};\n var args = name.split(/ +/);\n var cmd = new Command(args.shift());\n\n if (desc) {\n cmd.description(desc);\n this.executables = true;\n this._execs[cmd._name] = true;\n if (opts.isDefault) this.defaultExecutable = cmd._name;\n }\n cmd._noHelp = !!opts.noHelp;\n this.commands.push(cmd);\n cmd.parseExpectedArgs(args);\n cmd.parent = this;\n\n if (desc) return this;\n return cmd;\n};\n\n/**\n * Define argument syntax for the top-level command.\n *\n * @api public\n */\n\nCommand.prototype.arguments = function(desc) {\n return this.parseExpectedArgs(desc.split(/ +/));\n};\n\n/**\n * Add an implicit `help [cmd]` subcommand\n * which invokes `--help` for the given command.\n *\n * @api private\n */\n\nCommand.prototype.addImplicitHelpCommand = function() {\n this.command('help [cmd]', 'display help for [cmd]');\n};\n\n/**\n * Parse expected `args`.\n *\n * For example `[\"[type]\"]` becomes `[{ required: false, name: 'type' }]`.\n *\n * @param {Array} args\n * @return {Command} for chaining\n * @api public\n */\n\nCommand.prototype.parseExpectedArgs = function(args) {\n if (!args.length) return;\n var self = this;\n args.forEach(function(arg) {\n var argDetails = {\n required: false,\n name: '',\n variadic: false\n };\n\n switch (arg[0]) {\n case '<':\n argDetails.required = true;\n argDetails.name = arg.slice(1, -1);\n break;\n case '[':\n argDetails.name = arg.slice(1, -1);\n break;\n }\n\n if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') {\n argDetails.variadic = true;\n argDetails.name = argDetails.name.slice(0, -3);\n }\n if (argDetails.name) {\n self._args.push(argDetails);\n }\n });\n return this;\n};\n\n/**\n * Register callback `fn` for the command.\n *\n * Examples:\n *\n * program\n * .command('help')\n * .description('display verbose help')\n * .action(function() {\n * // output help here\n * });\n *\n * @param {Function} fn\n * @return {Command} for chaining\n * @api public\n */\n\nCommand.prototype.action = function(fn) {\n var self = this;\n var listener = function(args, unknown) {\n // Parse any so-far unknown options\n args = args || [];\n unknown = unknown || [];\n\n var parsed = self.parseOptions(unknown);\n\n // Output help if necessary\n outputHelpIfNecessary(self, parsed.unknown);\n\n // If there are still any unknown options, then we simply\n // die, unless someone asked for help, in which case we give it\n // to them, and then we die.\n if (parsed.unknown.length > 0) {\n self.unknownOption(parsed.unknown[0]);\n }\n\n // Leftover arguments need to be pushed back. Fixes issue #56\n if (parsed.args.length) args = parsed.args.concat(args);\n\n self._args.forEach(function(arg, i) {\n if (arg.required && args[i] == null) {\n self.missingArgument(arg.name);\n } else if (arg.variadic) {\n if (i !== self._args.length - 1) {\n self.variadicArgNotLast(arg.name);\n }\n\n args[i] = args.splice(i);\n }\n });\n\n // Always append ourselves to the end of the arguments,\n // to make sure we match the number of arguments the user\n // expects\n if (self._args.length) {\n args[self._args.length] = self;\n } else {\n args.push(self);\n }\n\n fn.apply(self, args);\n };\n var parent = this.parent || this;\n var name = parent === this ? '*' : this._name;\n parent.on('command:' + name, listener);\n if (this._alias) parent.on('command:' + this._alias, listener);\n return this;\n};\n\n/**\n * Define option with `flags`, `description` and optional\n * coercion `fn`.\n *\n * The `flags` string should contain both the short and long flags,\n * separated by comma, a pipe or space. The following are all valid\n * all will output this way when `--help` is used.\n *\n * \"-p, --pepper\"\n * \"-p|--pepper\"\n * \"-p --pepper\"\n *\n * Examples:\n *\n * // simple boolean defaulting to false\n * program.option('-p, --pepper', 'add pepper');\n *\n * --pepper\n * program.pepper\n * // => Boolean\n *\n * // simple boolean defaulting to true\n * program.option('-C, --no-cheese', 'remove cheese');\n *\n * program.cheese\n * // => true\n *\n * --no-cheese\n * program.cheese\n * // => false\n *\n * // required argument\n * program.option('-C, --chdir <path>', 'change the working directory');\n *\n * --chdir /tmp\n * program.chdir\n * // => \"/tmp\"\n *\n * // optional argument\n * program.option('-c, --cheese [type]', 'add cheese [marble]');\n *\n * @param {String} flags\n * @param {String} description\n * @param {Function|*} [fn] or default\n * @param {*} [defaultValue]\n * @return {Command} for chaining\n * @api public\n */\n\nCommand.prototype.option = function(flags, description, fn, defaultValue) {\n var self = this,\n option = new Option(flags, description),\n oname = option.name(),\n name = option.attributeName();\n\n // default as 3rd arg\n if (typeof fn !== 'function') {\n if (fn instanceof RegExp) {\n var regex = fn;\n fn = function(val, def) {\n var m = regex.exec(val);\n return m ? m[0] : def;\n };\n } else {\n defaultValue = fn;\n fn = null;\n }\n }\n\n // preassign default value only for --no-*, [optional], or <required>\n if (!option.bool || option.optional || option.required) {\n // when --no-* we make sure default is true\n if (!option.bool) defaultValue = true;\n // preassign only if we have a default\n if (defaultValue !== undefined) {\n self[name] = defaultValue;\n option.defaultValue = defaultValue;\n }\n }\n\n // register the option\n this.options.push(option);\n\n // when it's passed assign the value\n // and conditionally invoke the callback\n this.on('option:' + oname, function(val) {\n // coercion\n if (val !== null && fn) {\n val = fn(val, self[name] === undefined ? defaultValue : self[name]);\n }\n\n // unassigned or bool\n if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') {\n // if no value, bool true, and we have a default, then use it!\n if (val == null) {\n self[name] = option.bool\n ? defaultValue || true\n : false;\n } else {\n self[name] = val;\n }\n } else if (val !== null) {\n // reassign\n self[name] = val;\n }\n });\n\n return this;\n};\n\n/**\n * Allow unknown options on the command line.\n *\n * @param {Boolean} arg if `true` or omitted, no error will be thrown\n * for unknown options.\n * @api public\n */\nCommand.prototype.allowUnknownOption = function(arg) {\n this._allowUnknownOption = arguments.length === 0 || arg;\n return this;\n};\n\n/**\n * Parse `argv`, settings options and invoking commands when defined.\n *\n * @param {Array} argv\n * @return {Command} for chaining\n * @api public\n */\n\nCommand.prototype.parse = function(argv) {\n // implicit help\n if (this.executables) this.addImplicitHelpCommand();\n\n // store raw args\n this.rawArgs = argv;\n\n // guess name\n this._name = this._name || basename(argv[1], '.js');\n\n // github-style sub-commands with no sub-command\n if (this.executables && argv.length < 3 && !this.defaultExecutable) {\n // this user needs help\n argv.push('--help');\n }\n\n // process argv\n var parsed = this.parseOptions(this.normalize(argv.slice(2)));\n var args = this.args = parsed.args;\n\n var result = this.parseArgs(this.args, parsed.unknown);\n\n // executable sub-commands\n var name = result.args[0];\n\n var aliasCommand = null;\n // check alias of sub commands\n if (name) {\n aliasCommand = this.commands.filter(function(command) {\n return command.alias() === name;\n })[0];\n }\n\n if (this._execs[name] === true) {\n return this.executeSubCommand(argv, args, parsed.unknown);\n } else if (aliasCommand) {\n // is alias of a subCommand\n args[0] = aliasCommand._name;\n return this.executeSubCommand(argv, args, parsed.unknown);\n } else if (this.defaultExecutable) {\n // use the default subcommand\n args.unshift(this.defaultExecutable);\n return this.executeSubCommand(argv, args, parsed.unknown);\n }\n\n return result;\n};\n\n/**\n * Execute a sub-command executable.\n *\n * @param {Array} argv\n * @param {Array} args\n * @param {Array} unknown\n * @api private\n */\n\nCommand.prototype.executeSubCommand = function(argv, args, unknown) {\n args = args.concat(unknown);\n\n if (!args.length) this.help();\n if (args[0] === 'help' && args.length === 1) this.help();\n\n // <cmd> --help\n if (args[0] === 'help') {\n args[0] = args[1];\n args[1] = '--help';\n }\n\n // executable\n var f = argv[1];\n // name of the subcommand, link `pm-install`\n var bin = basename(f, path.extname(f)) + '-' + args[0];\n\n // In case of globally installed, get the base dir where executable\n // subcommand file should be located at\n var baseDir;\n\n var resolvedLink = fs.realpathSync(f);\n\n baseDir = dirname(resolvedLink);\n\n // prefer local `./<bin>` to bin in the $PATH\n var localBin = path.join(baseDir, bin);\n\n // whether bin file is a js script with explicit `.js` or `.ts` extension\n var isExplicitJS = false;\n if (exists(localBin + '.js')) {\n bin = localBin + '.js';\n isExplicitJS = true;\n } else if (exists(localBin + '.ts')) {\n bin = localBin + '.ts';\n isExplicitJS = true;\n } else if (exists(localBin)) {\n bin = localBin;\n }\n\n args = args.slice(1);\n\n var proc;\n if (process.platform !== 'win32') {\n if (isExplicitJS) {\n args.unshift(bin);\n // add executable arguments to spawn\n args = (process.execArgv || []).concat(args);\n\n proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] });\n } else {\n proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });\n }\n } else {\n args.unshift(bin);\n proc = spawn(process.execPath, args, { stdio: 'inherit' });\n }\n\n var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];\n signals.forEach(function(signal) {\n process.on(signal, function() {\n if (proc.killed === false && proc.exitCode === null) {\n proc.kill(signal);\n }\n });\n });\n proc.on('close', process.exit.bind(process));\n proc.on('error', function(err) {\n if (err.code === 'ENOENT') {\n console.error('error: %s(1) does not exist, try --help', bin);\n } else if (err.code === 'EACCES') {\n console.error('error: %s(1) not executable. try chmod or run with root', bin);\n }\n process.exit(1);\n });\n\n // Store the reference to the child process\n this.runningCommand = proc;\n};\n\n/**\n * Normalize `args`, splitting joined short flags. For example\n * the arg \"-abc\" is equivalent to \"-a -b -c\".\n * This also normalizes equal sign and splits \"--abc=def\" into \"--abc def\".\n *\n * @param {Array} args\n * @return {Array}\n * @api private\n */\n\nCommand.prototype.normalize = function(args) {\n var ret = [],\n arg,\n lastOpt,\n index;\n\n for (var i = 0, len = args.length; i < len; ++i) {\n arg = args[i];\n if (i > 0) {\n lastOpt = this.optionFor(args[i - 1]);\n }\n\n if (arg === '--') {\n // Honor option terminator\n ret = ret.concat(args.slice(i));\n break;\n } else if (lastOpt && lastOpt.required) {\n ret.push(arg);\n } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {\n arg.slice(1).split('').forEach(function(c) {\n ret.push('-' + c);\n });\n } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {\n ret.push(arg.slice(0, index), arg.slice(index + 1));\n } else {\n ret.push(arg);\n }\n }\n\n return ret;\n};\n\n/**\n * Parse command `args`.\n *\n * When listener(s) are available those\n * callbacks are invoked, otherwise the \"*\"\n * event is emitted and those actions are invoked.\n *\n * @param {Array} args\n * @return {Command} for chaining\n * @api private\n */\n\nCommand.prototype.parseArgs = function(args, unknown) {\n var name;\n\n if (args.length) {\n name = args[0];\n if (this.listeners('command:' + name).length) {\n this.emit('command:' + args.shift(), args, unknown);\n } else {\n this.emit('command:*', args);\n }\n } else {\n outputHelpIfNecessary(this, unknown);\n\n // If there were no args and we have unknown options,\n // then they are extraneous and we need to error.\n if (unknown.length > 0) {\n this.unknownOption(unknown[0]);\n }\n if (this.commands.length === 0 &&\n this._args.filter(function(a) { return a.required; }).length === 0) {\n this.emit('command:*');\n }\n }\n\n return this;\n};\n\n/**\n * Return an option matching `arg` if any.\n *\n * @param {String} arg\n * @return {Option}\n * @api private\n */\n\nCommand.prototype.optionFor = function(arg) {\n for (var i = 0, len = this.options.length; i < len; ++i) {\n if (this.options[i].is(arg)) {\n return this.options[i];\n }\n }\n};\n\n/**\n * Parse options from `argv` returning `argv`\n * void of these options.\n *\n * @param {Array} argv\n * @return {Array}\n * @api public\n */\n\nCommand.prototype.parseOptions = function(argv) {\n var args = [],\n len = argv.length,\n literal,\n option,\n arg;\n\n var unknownOptions = [];\n\n // parse options\n for (var i = 0; i < len; ++i) {\n arg = argv[i];\n\n // literal args after --\n if (literal) {\n args.push(arg);\n continue;\n }\n\n if (arg === '--') {\n literal = true;\n continue;\n }\n\n // find matching Option\n option = this.optionFor(arg);\n\n // option is defined\n if (option) {\n // requires arg\n if (option.required) {\n arg = argv[++i];\n if (arg == null) return this.optionMissingArgument(option);\n this.emit('option:' + option.name(), arg);\n // optional arg\n } else if (option.optional) {\n arg = argv[i + 1];\n if (arg == null || (arg[0] === '-' && arg !== '-')) {\n arg = null;\n } else {\n ++i;\n }\n this.emit('option:' + option.name(), arg);\n // bool\n } else {\n this.emit('option:' + option.name());\n }\n continue;\n }\n\n // looks like an option\n if (arg.length > 1 && arg[0] === '-') {\n unknownOptions.push(arg);\n\n // If the next argument looks like it might be\n // an argument for this option, we pass it on.\n // If it isn't, then it'll simply be ignored\n if ((i + 1) < argv.length && argv[i + 1][0] !== '-') {\n unknownOptions.push(argv[++i]);\n }\n continue;\n }\n\n // arg\n args.push(arg);\n }\n\n return { args: args, unknown: unknownOptions };\n};\n\n/**\n * Return an object containing options as key-value pairs\n *\n * @return {Object}\n * @api public\n */\nCommand.prototype.opts = function() {\n var result = {},\n len = this.options.length;\n\n for (var i = 0; i < len; i++) {\n var key = this.options[i].attributeName();\n result[key] = key === this._versionOptionName ? this._version : this[key];\n }\n return result;\n};\n\n/**\n * Argument `name` is missing.\n *\n * @param {String} name\n * @api private\n */\n\nCommand.prototype.missingArgument = function(name) {\n console.error(\"error: missing required argument `%s'\", name);\n process.exit(1);\n};\n\n/**\n * `Option` is missing an argument, but received `flag` or nothing.\n *\n * @param {String} option\n * @param {String} flag\n * @api private\n */\n\nCommand.prototype.optionMissingArgument = function(option, flag) {\n if (flag) {\n console.error(\"error: option `%s' argument missing, got `%s'\", option.flags, flag);\n } else {\n console.error(\"error: option `%s' argument missing\", option.flags);\n }\n process.exit(1);\n};\n\n/**\n * Unknown option `flag`.\n *\n * @param {String} flag\n * @api private\n */\n\nCommand.prototype.unknownOption = function(flag) {\n if (this._allowUnknownOption) return;\n console.error(\"error: unknown option `%s'\", flag);\n process.exit(1);\n};\n\n/**\n * Variadic argument with `name` is not the last argument as required.\n *\n * @param {String} name\n * @api private\n */\n\nCommand.prototype.variadicArgNotLast = function(name) {\n console.error(\"error: variadic arguments must be last `%s'\", name);\n process.exit(1);\n};\n\n/**\n * Set the program version to `str`.\n *\n * This method auto-registers the \"-V, --version\" flag\n * which will print the version number when passed.\n *\n * @param {String} str\n * @param {String} [flags]\n * @return {Command} for chaining\n * @api public\n */\n\nCommand.prototype.version = function(str, flags) {\n if (arguments.length === 0) return this._version;\n this._version = str;\n flags = flags || '-V, --version';\n var versionOption = new Option(flags, 'output the version number');\n this._versionOptionName = versionOption.long.substr(2) || 'version';\n this.options.push(versionOption);\n this.on('option:' + this._versionOptionName, function() {\n process.stdout.write(str + '\\n');\n process.exit(0);\n });\n return this;\n};\n\n/**\n * Set the description to `str`.\n *\n * @param {String} str\n * @param {Object} argsDescription\n * @return {String|Command}\n * @api public\n */\n\nCommand.prototype.description = function(str, argsDescription) {\n if (arguments.length === 0) return this._description;\n this._description = str;\n this._argsDescription = argsDescription;\n return this;\n};\n\n/**\n * Set an alias for the command\n *\n * @param {String} alias\n * @return {String|Command}\n * @api public\n */\n\nCommand.prototype.alias = function(alias) {\n var command = this;\n if (this.commands.length !== 0) {\n command = this.commands[this.commands.length - 1];\n }\n\n if (arguments.length === 0) return command._alias;\n\n if (alias === command._name) throw new Error('Command alias can\\'t be the same as its name');\n\n command._alias = alias;\n return this;\n};\n\n/**\n * Set / get the command usage `str`.\n *\n * @param {String} str\n * @return {String|Command}\n * @api public\n */\n\nCommand.prototype.usage = function(str) {\n var args = this._args.map(function(arg) {\n return humanReadableArgName(arg);\n });\n\n var usage = '[options]' +\n (this.commands.length ? ' [command]' : '') +\n (this._args.length ? ' ' + args.join(' ') : '');\n\n if (arguments.length === 0) return this._usage || usage;\n this._usage = str;\n\n return this;\n};\n\n/**\n * Get or set the name of the command\n *\n * @param {String} str\n * @return {String|Command}\n * @api public\n */\n\nCommand.prototype.name = function(str) {\n if (arguments.length === 0) return this._name;\n this._name = str;\n return this;\n};\n\n/**\n * Return prepared commands.\n *\n * @return {Array}\n * @api private\n */\n\nCommand.prototype.prepareCommands = function() {\n return this.commands.filter(function(cmd) {\n return !cmd._noHelp;\n }).map(function(cmd) {\n var args = cmd._args.map(function(arg) {\n return humanReadableArgName(arg);\n }).join(' ');\n\n return [\n cmd._name +\n (cmd._alias ? '|' + cmd._alias : '') +\n (cmd.options.length ? ' [options]' : '') +\n (args ? ' ' + args : ''),\n cmd._description\n ];\n });\n};\n\n/**\n * Return the largest command length.\n *\n * @return {Number}\n * @api private\n */\n\nCommand.prototype.largestCommandLength = function() {\n var commands = this.prepareCommands();\n return commands.reduce(function(max, command) {\n return Math.max(max, command[0].length);\n }, 0);\n};\n\n/**\n * Return the largest option length.\n *\n * @return {Number}\n * @api private\n */\n\nCommand.prototype.largestOptionLength = function() {\n var options = [].slice.call(this.options);\n options.push({\n flags: '-h, --help'\n });\n return options.reduce(function(max, option) {\n return Math.max(max, option.flags.length);\n }, 0);\n};\n\n/**\n * Return the largest arg length.\n *\n * @return {Number}\n * @api private\n */\n\nCommand.prototype.largestArgLength = function() {\n return this._args.reduce(function(max, arg) {\n return Math.max(max, arg.name.length);\n }, 0);\n};\n\n/**\n * Return the pad width.\n *\n * @return {Number}\n * @api private\n */\n\nCommand.prototype.padWidth = function() {\n var width = this.largestOptionLength();\n if (this._argsDescription && this._args.length) {\n if (this.largestArgLength() > width) {\n width = this.largestArgLength();\n }\n }\n\n if (this.commands && this.commands.length) {\n if (this.largestCommandLength() > width) {\n width = this.largestCommandLength();\n }\n }\n\n return width;\n};\n\n/**\n * Return help for options.\n *\n * @return {String}\n * @api private\n */\n\nCommand.prototype.optionHelp = function() {\n var width = this.padWidth();\n\n // Append the help information\n return this.options.map(function(option) {\n return pad(option.flags, width) + ' ' + option.description +\n ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');\n }).concat([pad('-h, --help', width) + ' ' + 'output usage information'])\n .join('\\n');\n};\n\n/**\n * Return command help documentation.\n *\n * @return {String}\n * @api private\n */\n\nCommand.prototype.commandHelp = function() {\n if (!this.commands.length) return '';\n\n var commands = this.prepareCommands();\n var width = this.padWidth();\n\n return [\n 'Commands:',\n commands.map(function(cmd) {\n var desc = cmd[1] ? ' ' + cmd[1] : '';\n return (desc ? pad(cmd[0], width) : cmd[0]) + desc;\n }).join('\\n').replace(/^/gm, ' '),\n ''\n ].join('\\n');\n};\n\n/**\n * Return program help documentation.\n *\n * @return {String}\n * @api private\n */\n\nCommand.prototype.helpInformation = function() {\n var desc = [];\n if (this._description) {\n desc = [\n this._description,\n ''\n ];\n\n var argsDescription = this._argsDescription;\n if (argsDescription && this._args.length) {\n var width = this.padWidth();\n desc.push('Arguments:');\n desc.push('');\n this._args.forEach(function(arg) {\n desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]);\n });\n desc.push('');\n }\n }\n\n var cmdName = this._name;\n if (this._alias) {\n cmdName = cmdName + '|' + this._alias;\n }\n var usage = [\n 'Usage: ' + cmdName + ' ' + this.usage(),\n ''\n ];\n\n var cmds = [];\n var commandHelp = this.commandHelp();\n if (commandHelp) cmds = [commandHelp];\n\n var options = [\n 'Options:',\n '' + this.optionHelp().replace(/^/gm, ' '),\n ''\n ];\n\n return usage\n .concat(desc)\n .concat(options)\n .concat(cmds)\n .join('\\n');\n};\n\n/**\n * Output help information for this command\n *\n * @api public\n */\n\nCommand.prototype.outputHelp = function(cb) {\n if (!cb) {\n cb = function(passthru) {\n return passthru;\n };\n }\n process.stdout.write(cb(this.helpInformation()));\n this.emit('--help');\n};\n\n/**\n * Output help information and exit.\n *\n * @api public\n */\n\nCommand.prototype.help = function(cb) {\n this.outputHelp(cb);\n process.exit();\n};\n\n/**\n * Camel-case the given `flag`\n *\n * @param {String} flag\n * @return {String}\n * @api private\n */\n\nfunction camelcase(flag) {\n return flag.split('-').reduce(function(str, word) {\n return str + word[0].toUpperCase() + word.slice(1);\n });\n}\n\n/**\n * Pad `str` to `width`.\n *\n * @param {String} str\n * @param {Number} width\n * @return {String}\n * @api private\n */\n\nfunction pad(str, width) {\n var len = Math.max(0, width - str.length);\n return str + Array(len + 1).join(' ');\n}\n\n/**\n * Output help information if necessary\n *\n * @param {Command} command to output help for\n * @param {Array} array of options to search for -h or --help\n * @api private\n */\n\nfunction outputHelpIfNecessary(cmd, options) {\n options = options || [];\n for (var i = 0; i < options.length; i++) {\n if (options[i] === '--help' || options[i] === '-h') {\n cmd.outputHelp();\n process.exit(0);\n }\n }\n}\n\n/**\n * Takes an argument an returns its human readable equivalent for help usage.\n *\n * @param {Object} arg\n * @return {String}\n * @api private\n */\n\nfunction humanReadableArgName(arg) {\n var nameOutput = arg.name + (arg.variadic === true ? '...' : '');\n\n return arg.required\n ? '<' + nameOutput + '>'\n : '[' + nameOutput + ']';\n}\n\n// for versions before node v0.8 when there weren't `fs.existsSync`\nfunction exists(file) {\n try {\n if (fs.statSync(file).isFile()) {\n return true;\n }\n } catch (e) {\n return false;\n }\n}\n", "#!/usr/bin/env node\n\nimport program from 'commander'\n\nimport { getCountryFlag } from './index'\n\n\nprogram\n .version('0.1.0')\n .name('country-flag-cli')\n .command('get <flag>')\n .action((flag) => {\n const result = getCountryFlag(flag);\n console.log(result);\n })\n\nprogram.parse(process.argv)\n", "export function getCountryFlag (countryCode: string): string | undefined {\n if (countryCode.length != 2) { return undefined}\n return countryCode.toUpperCase().replace(/./g, char => \n String.fromCodePoint(127397 + char.charCodeAt(0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EAAG,SAAS,GAAM,SACpB,MAAO,QAET,CACA,MAAO,OCnsCX,MAAoB,OCFb,WAAyB,EAAyC,CACvE,GAAI,EAAY,QAAU,EAC1B,MAAO,GAAY,cAAc,QAAQ,KAAM,GAC3C,OAAO,cAAc,OAAS,EAAK,WAAW,KDIpD,UACG,QAAQ,SACR,KAAK,oBACL,QAAQ,cACR,OAAO,AAAC,GAAS,CAChB,GAAM,GAAS,EAAe,GAC9B,QAAQ,IAAI,KAGhB,UAAQ,MAAM,QAAQ",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "country-flag-cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.5",
4
4
  "description": "A simple cli app to return flag emojis given 2 digit country code",
5
5
  "author": "Evan Mattiza",
6
6
  "keywords": [
@@ -8,8 +8,10 @@
8
8
  "cli"
9
9
  ],
10
10
  "license": "MIT",
11
- "main": "./dist/index.js",
12
- "bin": "./dist/cli.js",
11
+ "main": "./src/cli.js",
12
+ "bin": {
13
+ "country-flag-cli": "./dist/cli.js"
14
+ },
13
15
  "files": [
14
16
  "dist/**/*",
15
17
  "!dist/**/*.test.js"
@@ -17,10 +19,14 @@
17
19
  "scripts": {
18
20
  "dev": "esno ./src/cli.ts",
19
21
  "clean": "rimraf ./dist/ ./exec/",
20
- "es-build": "esbuild --platform=node --bundle src/cli.ts --outdir=dist --minify --sourcemap=inline",
22
+ "es-build": "esbuild --platform=node --bundle src/cli.ts --outdir=dist --minify --sourcemap=external",
21
23
  "build": "npm run clean && npm run test && npm run es-build",
24
+ "mac-x64-pkg:build": "pkg -t node14-mac-x64 dist/cli.js -o ./exec/country-flag-cli_mac_x64",
25
+ "win-x64-pkg:build": "pkg -t node14-win-x64 dist/cli.js -o ./exec/country-flag-cli_win_x64",
26
+ "linux-x64-pkg:build": "pkg -t node14-linux-x64 dist/cli.js -o ./exec/country-flag-cli_linux_x64",
27
+ "linux-arm64-pkg:build": "pkg -t node14-linux-arm64 dist/cli.js -o ./exec/country-flag-cli_linux_arm64",
22
28
  "test": "jest",
23
- "bundle": "npm run build && pkg . -t node14 --out-dir ./exec/ --compress GZip"
29
+ "bundle": "npm run build"
24
30
  },
25
31
  "devDependencies": {
26
32
  "@types/jest": "^27.4.0",