
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A simple command-line argument parser for NodeJS command-line tools.
Install:
$ npm install cmd-args
example:
import { createArgParser } from 'cmd-args'
const myParser = createArgParser({
cmd: 'my-cmd',
title: 'My CMD',
description: 'my-cmd description...',
help: true,
version: 'v1.0.0',
options: [
{
type: 'flag',
key: 'verbose',
alias: 'v',
description: 'Enable verbose mode.'
},
{
type: 'option',
key: 'output-file',
alias: 'o',
description: 'Specifies location to write the output file. If not set the output will go to stdout.'
}
],
arguments: [
{
key: 'input-files',
description: 'List of input files to be used.'
multi: true,
required: true
}
]
});
var program = myParser.run();
console.log(JSON.stringify(program), null, 2))
example run:
$ my-cmd --version
outputs:
v1.0.0
example run:
$ my-cmd --help
outputs:
My CMD
my-cmd description...
Usage:
my-cmd [OPTIONS] --help
OR
my-cmd [OPTIONS] <input-files>...
my-cmd [OPTIONS]:
--version Prints version of this command.
--help Prints help text for this command.
-v, --verbose Enable verbose mode.
-o, --output-file[=ARG] Specifies location to write the output file. If not set the output will go to stdout.
ARGUMENTS:
input-files=ARG+ List of input files to be used.
example run:
$ my-cmd file1 file2
outputs:
{
"command": ["my-cmd"],
"options": {
"verbose": false,
"input-files": ["file1", "file2"]
}
}
example run:
$ my-cmd file1 file2 -o file-out
outputs:
{
"command": ["my-cmd"],
"options": {
"verbose": false,
"input-files": ["file1", "file2"],
"output-file": "file-out"
}
}
example run:
$ my-cmd file1 file2 --output-file file-out
outputs:
{
"command": ["my-cmd"],
"options": {
"verbose": false,
"input-files": ["file1", "file2"],
"output-file": "file-out"
}
}
example run:
$ my-cmd -v file1 file2 --output-file file-out
outputs:
{
"command": ["my-cmd"],
"options": {
"verbose": true,
"input-files": ["file1", "file2"],
"output-file": "file-out"
}
}
FAQs
A simple command-line argument parser for NodeJS command-line tools.
The npm package cmd-args receives a total of 16 weekly downloads. As such, cmd-args popularity was classified as not popular.
We found that cmd-args demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.