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.
@benev/argv
Advanced tools
@benev/argv
command line argument parser
🤖 for making node cli programs
💁 autogenerated --help
page
🕵️♂️ designed for good typescript typings
🧼 zero dependencies
💖 made free and open source, just for you
$ icecream waffle-cone --flavor cookie-dough --scoops 5
@benev/argv
via npm
npm install @benev/argv
import {cli} from "@benev/argv"
export type Args = {
vessel: string
}
export type Params = {
"--flavor": string
"--scoops": number
"--help": boolean
}
const {args, params} = cli<Args, Params>()({
program: "icecream",
argv: process.argv,
columns: process.stdout.columns ?? 72,
// positional arguments your program will accept
argorder: ["vessel"],
// arguments your program will accept
args: {
vessel: {
type: String,
mode: "requirement",
help: 'can be "cone", "bowl", or "waffle-cone"',
},
},
// parameters your program will accept
params: {
"--flavor": {
type: String,
mode: "default",
default: "vanilla",
help: "your favorite icecream flavor",
},
"--scoops": {
type: Number,
mode: "requirement",
help: "number of icecream scoops",
},
"--help": {
type: Boolean,
mode: "option",
help: "trigger the help page",
},
},
})
// example command:
// $ icecream waffle-cone --flavor cookie-dough --scoops 5
args.vessel
// "waffle-cone"
params["--flavor"]
// "cookie-dough"
params["--scoops"]
// 5
--param
, so the typescript typings work.Args
and Params
types, but it can infer some of it if you omit them.--param true
--param "true"
--param=true
--param="true"
+param
(sets to boolean true)true
(case-insensitive):
"true"
"yes"
"y"
"on"
"ok"
"enabled"
--help
has magic handling: it's the only "void" parameter which doesn't expect to be followed by a value
icecream --help
is goodicecream --help true
is bad--help
doesn't give the expected result, thus the magic handling here+param
as a shorthand for enabling a boolean+help
also workstheme: notheme
after import {notheme} from "@benev/argv"
tips: false
columns
current terminal width, used for text-wrappinghelp
description and usage instructions for your programreadme
url to your program's readmev0.0.0
FAQs
command line argument parser
The npm package @benev/argv receives a total of 129 weekly downloads. As such, @benev/argv popularity was classified as not popular.
We found that @benev/argv demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.