reargv 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +41 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -8,11 +8,51 @@ Reads command-line arguments and returns a structured, representative object.
8
8
  ## Installation
9
9
 
10
10
  ```bash
11
- npm install reargv
11
+ $ npm install reargv
12
12
  ```
13
13
 
14
14
  ## Usage
15
15
 
16
+ **Script pipeline**
17
+ First, create a script file somewhere
18
+
19
+ ```js
20
+ //argv.mjs
21
+
22
+ import { reargv } from "reargv";
23
+
24
+ console.log(JSON.stringify(reargv(), null, 2))
25
+ ```
26
+
27
+ Then, run it and pass it commands
28
+
29
+ ```bash
30
+ $ node ./argv.mjs hello --world reargv on.npm --and='this is great!' help VERSION -k8 -x > output.json
31
+ ```
32
+
33
+
34
+ ### Output
35
+ (`(...) > output.json` in `output.json`)
36
+
37
+ ```js
38
+ {
39
+ options: {
40
+ world: 'reargv',
41
+ and: '"this is great!"',
42
+ help: true,
43
+ version: true,
44
+ k: '8',
45
+ x: true
46
+ },
47
+ files: [ 'on.npm' ],
48
+ misc: [ 'hello' ]
49
+ }
50
+ ```
51
+
52
+ ---
53
+
54
+ **mocking process.argv**
55
+
16
56
  ```js
17
57
  import { reargv } from "reargv";
18
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reargv",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Reads command arguments and gives a representative object of them",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
@@ -12,4 +12,4 @@
12
12
  "devDependencies": {
13
13
  "jest": "^30.2.0"
14
14
  }
15
- }
15
+ }