You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 12, 2025. It is now read-only.
The end flag (`--`) (also known as _option terminator_) allows users to pass a portion of arguments. This is useful for arguments that should be parsed separately from other arguments or arguments that look like options.
139
+
The end-of-file (`--`) (also known as _flag terminator_) allows users to pass a portion of arguments. This is useful for arguments that should be parsed separately from other arguments or arguments that look like flags.
147
140
148
141
An example is [`npm run`](https://docs.npmjs.com/cli/v8/commands/npm-run-script):
_Clerc_'s option parsing is powered by [`@clerc/parser`](https://github.com/clercjs/clerc/blob/main/packages/parser) and has many features:
174
+
_Clerc_'s flag parsing is powered by [`@clerc/parser`](https://github.com/clercjs/clerc/blob/main/packages/parser) and has many features:
181
175
182
176
- Array and custom types
183
-
-Option delimiters: `--flag value`, `--flag=value`, `--flag:value` and `--flag.value`
177
+
-Flag delimiters: `--flag value`, `--flag=value`, `--flag:value` and `--flag.value`
184
178
- Combined aliases: `-abcd 2` → `-a -b -c -d 2`
185
-
-[Option terminator](https://unix.stackexchange.com/a/11382): pass `--` to end option parsing
179
+
-[End-of-file](https://unix.stackexchange.com/a/11382): pass `--` to end parsing
186
180
187
-
Options can be specified in the `flags` object property, where the key is the option name and the value is either an option type function or an object describing the option.
181
+
Flags can be specified in the `flags` object property, where the key is the flag name and the value is either an flag type function or an object describing the flag.
188
182
189
-
It's recommended to use camelCase for option names as it will be interpreted as parsing the equivalent kebab-case option.
183
+
It's recommended to use camelCase for flag names as it will be interpreted as parsing the equivalent kebab-case flag.
190
184
191
-
The option type function can be any function that accepts a string and returns the parsed value. The default JavaScript constructors should cover most use cases: [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/String), [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/Number), [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/Boolean), etc.
185
+
The flag type function can be any function that accepts a string and returns the parsed value. The default JavaScript constructors should cover most use cases: [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/String), [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/Number), [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/Boolean), etc.
192
186
193
-
The option description object can be used to store additional information about the option, such as `alias`, `default`, and `description`. To accept multiple values for an option, wrap the type function in an array.
187
+
The flag description object can be used to store additional information about the flag, such as `alias`, `default`, and `description`. To accept multiple values for a flag, wrap the type function in an array.
194
188
195
189
All provided information will be used to generate better help documentation.
0 commit comments