
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@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 worksFAQs
command line argument parser
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.