@@ -75,9 +75,12 @@ class Command:
7575 The $usage is usually constructed from the name and the arguments of the command, but can
7676 be provided explicitly if a different usage string is desired.
7777
78- The $short_help is a short (one line) description of the command.
78+ The $long_help is a longer description of the command that can span multiple lines. Use
79+ indented lines to continue paragraphs (just like toitdoc).
7980
80- The $long_help is a longer description of the command that can span multiple lines.
81+ The $short_help is a short description of the command. In most cases this help is a single
82+ line, but it can span multiple lines/paragraphs if necessary. Use indented lines to
83+ continue paragraphs (just like toitdoc).
8184 */
8285 constructor .name -- .usage = null -- .short_help = null -- .long_help = null -- .examples = [] \
8386 -- .aliases = [] -- .options = [] -- .rest = [] -- .subcommands = [] --hidden / bool= false \
@@ -222,6 +225,29 @@ abstract class Option:
222225 is_multi / bool
223226 should_split_commas / bool
224227
228+ /**
229+ Creates an option with the given $name.
230+
231+ The $name sets the name of the option. It must be unique among all options of a command.
232+ It is also used to extract the parsed value from the $Parsed object.
233+
234+ The $short_name is optional and must be a single-character string when provided.
235+
236+ The $short_help is optional and is used for help output. It should be a full sentence, starting
237+ with a capital letter and ending with a period.
238+
239+ If $required is true, then the option must be provided. Otherwise, it is optional.
240+
241+ If $hidden is true, then the option is not shown in help output. Rest arguments must not be
242+ hidden.
243+
244+ If $multi is true, then the option can be provided multiple times. The parsed value will
245+ be a list of strings.
246+
247+ If $split_commas is true, then $multi must be true too. Values given to this option are then
248+ split on commas. For example, `--option a,b,c` will result in the list `["a", "b", "c"]`.
249+
250+ */
225251 constructor .name -- .short_name -- .short_help --required --hidden --multi --split_commas :
226252 is_required = required
227253 is_hidden = hidden
@@ -277,27 +303,12 @@ class OptionString extends Option:
277303 /**
278304 Creates a new string option.
279305
280- The $name sets the name of the option. It must be unique among all options of a command.
281- It is also used to extract the parsed value from the $Parsed object.
282-
283306 The $default value is null.
307+
284308 The $type is set to 'string', but can be changed to something else. The $type is
285309 only used for help output.
286310
287- The $short_name is optional and must be a single-character string when provided.
288-
289- The $short_help is optional and is used for help output.
290-
291- If $required is true, then the option must be provided. Otherwise, it is optional.
292-
293- If $hidden is true, then the option is not shown in help output. Rest arguments must not be
294- hidden.
295-
296- If $multi is true, then the option can be provided multiple times. The parsed value will
297- be a list of strings.
298-
299- If $split_commas is true, then $multi must be true too. Values given to this option are then
300- split on commas. For example, `--option a,b,c` will result in the list `["a", "b", "c"]`.
311+ See $Option.constructor for the other parameters.
301312 */
302313 constructor name / string
303314 -- .default = null
@@ -337,7 +348,10 @@ class OptionEnum extends Option:
337348
338349 The $values list provides the list of valid values for this option.
339350
340- See $OptionString.constructor for the other parameters.
351+ The $default value is null.
352+ The $type defaults to a string joining all $values with a '|'.
353+
354+ See $Option.constructor for the other parameters.
341355 */
342356 constructor name / string .values / List
343357 -- .default = null
@@ -367,7 +381,6 @@ class OptionEnum extends Option:
367381An option that must be an integer value.
368382
369383The $parse function ensures that the value is an integer.
370- The $type defaults to "int".
371384*/
372385class OptionInt extends Option :
373386 default / int?
@@ -376,7 +389,10 @@ class OptionInt extends Option:
376389 /**
377390 Creates a new integer option.
378391
379- See $OptionString.constructor for a description of the parameters.
392+ The $default value is null.
393+ The $type defaults to "int".
394+
395+ See $Option.constructor for the other parameters.
380396 */
381397 constructor name / string
382398 -- .default = null
@@ -414,7 +430,10 @@ class Flag extends Option:
414430 /**
415431 Creates a new flag.
416432
417- See $OptionString.constructor for a description of the parameters.
433+ The $default value is null.
434+ The $type is only visible when using this option as a rest argument and is then "true|false"
435+
436+ See $Option.constructor for the other parameters.
418437 */
419438 constructor name / string
420439 -- .default = null
@@ -452,7 +471,9 @@ class Example:
452471 Creates an example.
453472
454473 The $description should describe the example without any context. This is especially true
455- if the $global_priority is greater than 0 (see below).
474+ if the $global_priority is greater than 0 (see below). It should start with a capital
475+ letter and finish with a ":". It may contain newlines. Use indentation to group
476+ paragraphs (just like toitdoc).
456477
457478 The $arguments is a string containing the arguments to this command (or to super commands).
458479 The help generator parses the arguments and assigns all options to the corresponding commands.
0 commit comments