Skip to content

Instantly share code, notes, and snippets.

@simonplend
Last active June 5, 2022 06:17
Show Gist options
  • Save simonplend/704484069bd6ad32b66712ccfe5d2ec4 to your computer and use it in GitHub Desktop.
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);
@DominusKelvin
Copy link

Nice

@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