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
🕵️♂️ designed for proper typescript typings
🏗️ experimental design, breaking changes likely
🧼 zero dependencies
💖 made free and open source, just for you
npm install @benev/argv
import {cli} from "@benev/argv"
export type Args = {
environment: string
suite: string
}
export type Params = {
"--label": string
"--verbose": boolean
"--port": number
}
const {args, params} = cli<Args, Params>()({
// your program's name
bin: "myprogram",
// process.argv is a nodejs builtin
argv: process.argv,
// terminal width, used for text-wrapping
columns: process.stdout.columns,
// link to your readme, for +help
readme: "https://github.com/@benev/argv",
// explainer for your menu, for +help
help: "my first command line program!",
// positional arguments your program will accept
argorder: ["currency", "amount"],
// arguments your program will accept
args: {
currency: {
type: String,
mode: "requirement",
help: "currency, like 'usd' or 'cad'",
},
amount: {
type: Number,
mode: "default",
default: 123,
help: "amount of money",
},
},
// parameters your program will accept
params: {
"--label": {
type: String,
mode: "option",
help: "a cool title",
},
"--verbose": {
type: Boolean,
mode: "option",
help: "display additional information",
},
"--port": {
type: Number,
mode: "default",
default: 8021,
help: "tcp port server will listen on",
},
},
})
// example command:
// main.js usd +verbose --port 8021
args.currency
// "usd"
args.amount
// 123
params["--label"]
// undefined
params["--verbose"]
// true
params["--port"]
// 8021
--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"
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.