Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minimal-cli

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minimal-cli - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

CHANGELOG.md

30

lib/cli.js

@@ -55,2 +55,4 @@ 'use strict';

this.aliasFlags(flags, this.options);
if (args.help) {

@@ -95,7 +97,33 @@ this.outputHelp();

const [name, type, description] = flag;
const { alias, id } = this.parseFlag(name);
return { name, type, description };
return { name, alias, id, type, description };
});
}
parseFlag(flag) {
const aliasMatch = flag.match(/(?:^|[^-])-(\w+)/i);
const idMatch = flag.match(/--(\w+)/i);
const alias = aliasMatch !== null ? aliasMatch[1] : null;
const id = idMatch !== null ? idMatch[1] : null;
return { alias, id };
}
aliasFlags(flags, options) {
options.flags.filter(flag => flag.id).forEach(flag => {
const { id, alias } = flag;
if (alias) {
if (flags[alias]) {
flags[id] = flags[alias];
}
if (flags[id]) {
flags[alias] = flags[id];
}
}
});
}
outputHelp() {

@@ -102,0 +130,0 @@ process.stdout.write(this.helpText);

6

package.json
{
"name": "minimal-cli",
"version": "0.0.2",
"version": "0.1.0",
"description": "A simple package for creating minimal command-line programs",

@@ -39,3 +39,3 @@ "keywords": [

"dependencies": {
"minimal-cli-parser": "0.0.1"
"minimal-cli-parser": "0.1.0"
},

@@ -48,5 +48,5 @@ "devDependencies": {

"mocha": "^5.2.0",
"nyc": "^13.1.0",
"nyc": "^14.1.1",
"standard": "^12.0.1"
}
}

@@ -8,4 +8,2 @@ # minimal-cli

[![Coverage](https://img.shields.io/codecov/c/github/JoshCrozier/minimal-cli.svg?style=flat-square)](https://codecov.io/github/JoshCrozier/minimal-cli)
[![Dependencies](https://img.shields.io/david/JoshCrozier/minimal-cli.svg?style=flat-square)](https://david-dm.org/JoshCrozier/minimal-cli)
[![DevDependencies](https://david-dm.org/JoshCrozier/minimal-cli/dev-status.svg?style=flat-square)](https://david-dm.org/JoshCrozier/minimal-cli?type=dev)
[![Vulnerabilities](https://snyk.io/test/npm/minimal-cli/badge.svg?style=flat-square)](https://snyk.io/test/npm/minimal-cli)

@@ -49,3 +47,5 @@

"url": "https://example.com",
"verbose": true
"verbose": true,
"u": "https://example.com", // handles the aliasing
"v": true // handles the aliasing
}

@@ -52,0 +52,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc