Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Argument parser for command-line interfaces. It primary target to large tool sets that provides a lot of subcommands. Support for argument coercion and completion makes task run much easer, even if you doesn't use CLI.
npm install clap
const cli = require('clap');
const myCommand = cli.command('my-command', '[optional-arg]')
.description('Optional description')
.version('1.2.3')
.option('-b, --bool', 'Bollean option')
.option('--foo <foo>', 'Option with required argument')
.option('--bar [bar]', 'Option with optional argument')
.option('--baz [value]', 'Option with optional argument and normalize function', function(value) {
// calls on init and for any value set
return Number(value);
}, 123) // 123 is default
.action(function(args, literalArgs) {
// args goes before options
// literal args goes after --
// this.values is an object with collected values
});
myCommand.run(); // runs with process.argv.slice(2)
myCommand.run(['--foo', '123', '-b'])
// sub-commands
myCommand
.command('nested')
.option('-q, --quz', 'Some parameter', 'Default value')
// ...
.end()
.command('another-command')
// ...
.command('level3-command')
//...
MIT
2.0.1 (December 16, 2019)
FAQs
Command line argument parser
The npm package clap receives a total of 641,451 weekly downloads. As such, clap popularity was classified as popular.
We found that clap 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.