@@ -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