Socket
Socket
Sign inDemoInstall

cli-argv-util

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-argv-util - npm Package Compare versions

Comparing version 1.2.4 to 1.2.5

2

dist/cli-argv-util.d.ts

@@ -1,2 +0,2 @@

//! cli-argv-util v1.2.4 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License
//! cli-argv-util v1.2.5 ~~ 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.4 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License
//! cli-argv-util v1.2.5 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License

@@ -3,0 +3,0 @@ import { execSync } from 'node:child_process';

MIT License
Copyright (c) 2022-2023 Individual contributors to cli-argv-util
Copyright (c) 2022-2024 Individual contributors to cli-argv-util

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "cli-argv-util",
"version": "1.2.4",
"version": "1.2.5",
"description": "Simple utility to parse command line parameters and flags (arguments vector)",

@@ -83,9 +83,9 @@ "license": "MIT",

"devDependencies": {
"@types/node": "~20.6",
"@typescript-eslint/eslint-plugin": "~6.7",
"@typescript-eslint/parser": "~6.7",
"@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.50",
"eslint": "~8.56",
"jshint": "~2.13",

@@ -95,4 +95,4 @@ "mocha": "~10.2",

"run-scripts-util": "~1.2",
"typescript": "~5.2"
"typescript": "~5.3"
}
}

@@ -26,5 +26,10 @@ # cli-argv-util

const validFlags = ['cd', 'find', 'no-summary'];
const cli = cliArgvUtil.parse(validFlags);
if (cliArgvUtil.invalidFlag)
throw Error(cliArgvUtil.invalidFlagMsg);
const cli = cliArgvUtil.parse(validFlags);
if (cli.invalidFlag)
throw Error(cli.invalidFlagMsg);
if (cli.flagOn.find)
console.log('You set the --find CLI flag to:', cli.flagMap.find);
if (cli.flagOn.noSummary)
console.log('You enabled the --no-summary CLI option.');
console.log('You supplied', cli.params.length , 'CLI parameter(s).');
```

@@ -35,3 +40,3 @@ For a real world example, see: [cli.js](https://github.com/center-key/copy-file-util/blob/main/bin/cli.js)

```shell
$ my-program file.html --cd=src --no-summary file.png
$ my-program about.html --cd=src --no-summary 'Hello World' 777
```

@@ -42,4 +47,3 @@ the resulting `cli` object will be:

flagMap: {
cd: 'src',
noSummary: undefined,
cd: 'src',
},

@@ -53,5 +57,6 @@ flagOn: {

invalidFlagMsg: null,
params: ['file.html', 'file.png'],
params: ['about.html', 'Hello World', '777'],
}
```
_**Note:** Single quotes in commands are normalized so they work cross-platform and avoid the errors often encountered on Microsoft Windows._

@@ -58,0 +63,0 @@ ## C) Results

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