Skip to content

Instantly share code, notes, and snippets.

@simonplend
Last active June 5, 2022 06:17
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save simonplend/704484069bd6ad32b66712ccfe5d2ec4 to your computer and use it in GitHub Desktop.
Example using new experimental Node.js parseArgs method (https://nodejs.org/api/util.html#utilparseargsconfig) - more new features covered at https://github.com/simonplend/whats-new-in-node-js-core
import { parseArgs } from "node:util";
const args = parseArgs({
options: {
name: {
type: "string",
},
verbose: {
type: "boolean",
short: "v",
},
},
allowPositionals: true,
});
console.log(args);
@mikeerickson
Copy link

mikeerickson commented Jun 2, 2022

Can't believe it has taken this long! Curious how long this will be an experimental flag

@ebukahills
Copy link

Cool stuff!

@zanniboni
Copy link

Nice!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment