cli-argv-util
Advanced tools
Comparing version 1.2.5 to 1.2.6
@@ -1,2 +0,2 @@ | ||
//! cli-argv-util v1.2.5 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License | ||
//! cli-argv-util v1.2.6 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License | ||
@@ -3,0 +3,0 @@ export type StringFlagMap = { |
@@ -1,2 +0,2 @@ | ||
//! cli-argv-util v1.2.5 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License | ||
//! cli-argv-util v1.2.6 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License | ||
@@ -15,2 +15,3 @@ import { execSync } from 'node:child_process'; | ||
const onEntries = validFlags.map(flag => [toCamel(flag), toCamel(flag) in flagMap]); | ||
const flagOn = Object.fromEntries(onEntries); | ||
const invalidFlag = pairs.find(pair => !validFlags.includes(pair[0]))?.[0] ?? null; | ||
@@ -21,3 +22,3 @@ const helpMsg = '\nValid flags are --' + validFlags.join(' --'); | ||
flagMap: flagMap, | ||
flagOn: Object.fromEntries(onEntries), | ||
flagOn: flagOn, | ||
invalidFlag: invalidFlag, | ||
@@ -42,3 +43,3 @@ invalidFlagMsg: invalidFlag ? 'Invalid flag: --' + invalidFlag + helpMsg : null, | ||
if (builder[0]) | ||
builder[1][last] = builder[1][last] + ' ' + arg; | ||
builder[1][last] = `${builder[1][last]} ${arg}`; | ||
else | ||
@@ -45,0 +46,0 @@ builder[1].push(arg); |
{ | ||
"name": "cli-argv-util", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "Simple utility to parse command line parameters and flags (arguments vector)", | ||
@@ -8,13 +8,7 @@ "license": "MIT", | ||
"module": "dist/cli-argv-util.js", | ||
"main": "dist/cli-argv-util.js", | ||
"types": "dist/cli-argv-util.d.ts", | ||
"exports": "./dist/cli-argv-util.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./dist/cli-argv-util.js" | ||
}, | ||
"./": "./dist/" | ||
}, | ||
"repository": { | ||
@@ -44,21 +38,2 @@ "type": "git", | ||
}, | ||
"eslintConfig": { | ||
"ignorePatterns": [ | ||
"build", | ||
"dist", | ||
"node_modules" | ||
], | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-non-null-assertion": "off" | ||
} | ||
}, | ||
"runScriptsConfig": { | ||
@@ -70,3 +45,3 @@ "clean": [ | ||
"jshint . --exclude-path .gitignore", | ||
"eslint --max-warnings 0 . --ext .ts" | ||
"eslint --max-warnings 0" | ||
], | ||
@@ -86,15 +61,15 @@ "build": [ | ||
"devDependencies": { | ||
"@types/node": "~20.10", | ||
"@typescript-eslint/eslint-plugin": "~6.17", | ||
"@typescript-eslint/parser": "~6.17", | ||
"add-dist-header": "~1.3", | ||
"assert-deep-strict-equal": "~1.1", | ||
"copy-file-util": "~1.1", | ||
"eslint": "~8.56", | ||
"@eslint/js": "~9.9", | ||
"@types/node": "~22.3", | ||
"add-dist-header": "~1.4", | ||
"assert-deep-strict-equal": "~1.2", | ||
"copy-file-util": "~1.2", | ||
"eslint": "~9.9", | ||
"jshint": "~2.13", | ||
"mocha": "~10.2", | ||
"rimraf": "~5.0", | ||
"run-scripts-util": "~1.2", | ||
"typescript": "~5.3" | ||
"mocha": "~10.7", | ||
"rimraf": "~6.0", | ||
"run-scripts-util": "~1.3", | ||
"typescript": "~5.5", | ||
"typescript-eslint": "~8.1" | ||
} | ||
} |
@@ -8,3 +8,3 @@ # cli-argv-util | ||
[![npm](https://img.shields.io/npm/v/cli-argv-util.svg)](https://www.npmjs.com/package/cli-argv-util) | ||
[![Build](https://github.com/center-key/cli-argv-util/workflows/build/badge.svg)](https://github.com/center-key/cli-argv-util/actions/workflows/run-spec-on-push.yaml) | ||
[![Build](https://github.com/center-key/cli-argv-util/actions/workflows/run-spec-on-push.yaml/badge.svg)](https://github.com/center-key/cli-argv-util/actions/workflows/run-spec-on-push.yaml) | ||
@@ -29,3 +29,3 @@ **cli-argv-util** is called from your `bin/cli.js` file in order to read user | ||
if (cli.invalidFlag) | ||
throw Error(cli.invalidFlagMsg); | ||
throw new Error(cli.invalidFlagMsg); | ||
if (cli.flagOn.find) | ||
@@ -37,3 +37,4 @@ console.log('You set the --find CLI flag to:', cli.flagMap.find); | ||
``` | ||
For a real world example, see: [cli.js](https://github.com/center-key/copy-file-util/blob/main/bin/cli.js) | ||
For a real world example, see: | ||
[cli.js](https://github.com/center-key/copy-file-util/blob/main/bin/cli.js) | ||
@@ -87,3 +88,3 @@ If your CLI tool is named `my-program` and a user runs it like: | ||
- 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets): _Revision web asset filenames with cache busting content hash fingerprints_ | ||
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util): _Organize npm scripts into named groups of easy to manage commands_ | ||
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util): _Organize npm package.json scripts into groups of easy to manage commands_ | ||
- 🚦 [w3c-html-validator](https://github.com/center-key/w3c-html-validator): _Check the markup validity of HTML files using the W3C validator_ | ||
@@ -90,0 +91,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73
92
10154