
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
This is a very simple CLI argument parser optimized for Daplie style.
The main export is a scan function that expects a process.argv
style array and
returns you processed information such as the command, flags, and positional
args.
$ npm install --save argscan
// Pass the argv to the scan function to get parsed parts
var { command, flags, args } = require('argscan')(process.argv)
// Do logic using command string, flags map, and args list
switch (command) {
case 'greet':
if (flags.loudly) { console.log('HELLO ') }
else { console.log ('hi') }
break
...
}
Daplie style arg parsing means a few assumptions.
First you're expected to have several commands with optional :
namespacing.
For example yourprogram action:subaction
where action:subaction
is the
command.
Also both long and short flags are supported. Long flags are expected to always
look like --someFlag
or --key=value
. Short flags are single-character
flags. You can have as many as you want on a single position. For example
-tim
is the same as -t -i -m
. Both will generate a flags map of
{ t: true, i: true, m: true }
.
FAQs
A simple CLI argument parser optimized for daplie style tools.
We found that argscan 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
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.