
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
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
and --option value
-xvf
-
as special stdin flag--
npm install cli-argparse
npm test
var parse = require('cli-argparse');
var args = [
'server',
'start',
'-xvd',
'--port=80',
'--file=file.txt',
'--file',
'file.json',
'--no-color'
];
var result = parse(args);
{
"flags": {
"x": true,
"v": true,
"d": true
},
"options": {
"port": "80",
"file": [
"file.txt",
"file.json"
]
},
"raw": [
"server",
"start",
"-xvd",
"--port=80",
"--file=file.txt",
"--file",
"file.json"
],
"stdin": false,
"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.
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.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']
.
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.FAQs
Lightweight argument parser
The npm package cli-argparse receives a total of 133 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.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.