Skip to content

Commit 840747a

Browse files
committed
docs: add usage example
1 parent 0afe859 commit 840747a

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,23 @@ Result:
107107

108108
## Examples
109109

110-
| CLI Input Example | Parsed Output Example | Notes |
111-
|----------------------------------|------------------------------------------------|---------------------------------------------|
112-
| `-a` | `{ a: true }` | Single short flag |
113-
| `-abc` | `{ a: true, b: true, c: true }` | Grouped short flags |
114-
| `--flag` | `{ flag: true }` | Long flag (boolean) |
115-
| `--key=value` | `{ key: 'value' }` | Long flag with value |
116-
| `--key value` | `{ key: 'value' }` | Long flag, value in next argument |
117-
| `-f value` | `{ f: 'value' }` | Short flag with value |
118-
| `--number 42` | `{ number: 42 }` | Auto-casts numbers |
119-
| `--bool false` | `{ bool: false }` | Auto-casts booleans |
120-
| `-f a.js b.js`<br>`--files c.js` | `{ f: ['a.js', 'b.js'], files: ['c.js'] }` | Multi-value keys: groups following values |
121-
| `--dash-flag=value` | `{ 'dash-flag': 'value', dashFlag: 'value' }` | Kebab-case key, also available as camelCase |
122-
| `--files a.js b.js -- out.json` | `{ files: ['a.js', 'b.js'], _: ['out.json'] }` | Arguments after -- are positional |
123-
| `input.txt` | `{ _: ['input.txt'] }` | Positional argument |
124-
| `-f a.js --files b.js` | `{ files: ['a.js', 'b.js'] }` | Aliases resolved |
110+
| CLI Input Example | Parsed Output Example | Notes |
111+
|------------------------------------------|----------------------------------------------------|---------------------------------------------|
112+
| `-a` | `{ a: true }` | Single short flag |
113+
| `-abc` | `{ a: true, b: true, c: true }` | Grouped short flags |
114+
| `--flag` | `{ flag: true }` | Long flag (boolean) |
115+
| `--key=value` | `{ key: 'value' }` | Long flag with value |
116+
| `--key value` | `{ key: 'value' }` | Long flag, value in next argument |
117+
| `-f value` | `{ f: 'value' }` | Short flag with value |
118+
| `--number 42` | `{ number: 42 }` | Auto-casts numbers |
119+
| `--bool false` | `{ bool: false }` | Auto-casts booleans |
120+
| `-f a.js b.js --files c.js` | `{ f: ['a.js', 'b.js'],`<br>`files: ['c.js'] }` | Multi-value keys: groups following values |
121+
| `--dash-flag=value` | `{ 'dash-flag': 'value',`<br>`dashFlag: 'value' }` | Kebab-case key, also available as camelCase |
122+
| `--files a.js b.js -- out.json` | `{ files: ['a.js', 'b.js'],`<br>`_: ['out.json'] }` | Arguments after -- are positional |
123+
| `input.txt` | `{ _: ['input.txt'] }` | Positional argument |
124+
| `-f a.js --files b.js` | `{ files: ['a.js', 'b.js'] }` | Grouped values for aliases |
125+
| `--key1 "foo bar"`<br>`--key2="baz qux"` | `{ key1: 'foo bar',`<br>`key2: 'baz qux' }` | Values with spaces |
126+
125127

126128
## License
127129

0 commit comments

Comments
 (0)