
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
cli-argparse
Advanced tools
Lightweight yet feature rich argument parser.
This module does not define any options or any program requirements it simply parses arguments into an object structure that is easier for other modules to work with.
--no-color--option=value, --option value and option=value-xvf-xvf file.tgz- as special stdin flag--npm install cli-argparse
npm test
var parse = require('cli-argparse');
var args = [
'server',
'start',
'-xvd',
'--port=80',
'--config',
'-',
'--config=config.json',
'--log',
'server.log',
'--no-color'
];
var result = parse(args);
{
"flags": {
"x": true,
"v": true,
"d": true,
"color": false
},
"options": {
"port": "80",
"config": [
"-",
"config.json"
],
"log": "server.log"
},
"raw": [
"server",
"start",
"-xvd",
"--port=80",
"--config",
"-",
"--config=config.json",
"--log",
"server.log",
"--no-color"
],
"stdin": true,
"unparsed": [
"server",
"start"
]
}
var parse = require('cli-argparse');
var result = parse();
console.dir(result);
args: Specific arguments to parse, default is process.argv.slice(2).options: Parsing configuration options.Returns a result object.
The result object contains the fields:
flags: Object containing arguments treated as flags.options: Object containing arguments treated as options with values.raw: Array of the raw arguments parsed.stdin: Boolean indicating whether - is present in the argument list.unparsed: Array of values that were not parsed.alias: Map of argument names to property names.flags: Array of argument names to be treated as flags.options: Array of argument names to be treated as options.strict: A boolean that indicates only arguments specified as options or flags should be parsed.flat: A boolean that creates a flat result structure.Note that you should not use the negated long form (--no-highlight) when specifying these hints, always use the positive form.
Aliases are mapped on the raw argument name, to map -v | --verbose to a verbose property use {'-v --verbose': 'verbose'}.
Use the flags array when you need to force a long argument to be treated as a flag, for example ['--syntax-highlight'].
Use the options array when you need to treat a short argument as accepting a value, for example ['-f'].
A boolean that indicates that only known arguments (those declared in the options and flags properties) are accepted, all other arguments will be placed in the unparsed array.
Creating a flat result can be useful if you are certain that there are no naming collisions, typically this can be achieved by providing hints using flags and options.
When this option is specified the result object will not have a flags property, instead all flags and options will be in the options property of the result.
FAQs
Lightweight argument parser
The npm package cli-argparse receives a total of 221 weekly downloads. As such, cli-argparse popularity was classified as not popular.
We found that cli-argparse 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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.