We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e43a70f commit 36060cdCopy full SHA for 36060cd
examples/simple-hard-coded.js
@@ -0,0 +1,26 @@
1
+'use strict';
2
+
3
+// This example is used in the documentation.
4
5
+// 1. const { parseArgs } = require('node:util'); // from node
6
+// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
7
+const { parseArgs } = require('..'); // in repo
8
9
+const args = ['-f', '--bar', 'b'];
10
+const options = {
11
+ foo: {
12
+ type: 'boolean',
13
+ short: 'f'
14
+ },
15
+ bar: {
16
+ type: 'string'
17
+ }
18
+};
19
+const {
20
+ values,
21
+ positionals
22
+} = parseArgs({ args, options });
23
+console.log(values, positionals);
24
25
+// Try the following:
26
+// node simple-hard-coded.js
0 commit comments