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
Copy file name to clipboardExpand all lines: README.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -315,7 +315,7 @@ There are several options that are supported on the main app and subcommands. Th
315
315
-`.name(name)`: Add or change the name.
316
316
-`.callback(void() function)`: Set the callback that runs at the end of parsing. The options have already run at this point.
317
317
-`.allow_extras()`: Do not throw an error if extra arguments are left over.
318
-
-`.prefix_command()`: Like `allow_extras`, but stop immediately on the first unrecognised item. It is ideal for allowing your app or subcommand to be a "prefix" to calling another app.
318
+
-`.prefix_command()`: Like `allow_extras`, but stop immediately on the first unrecognized item. It is ideal for allowing your app or subcommand to be a "prefix" to calling another app.
319
319
-`.footer(message)`: Set text to appear at the bottom of the help string.
320
320
-`.set_help_flag(name, message)`: Set the help flag name and message, returns a pointer to the created option.
321
321
-`.set_help_all_flag(name, message)`: Set the help all flag name and message, returns a pointer to the created option. Expands subcommands.
If this is called with no arguments, it will remove the configuration file option (like `set_help_flag`). Setting a configuration option is special. If it is present, it will be read along with the normal command line arguments. The file will be read if it exists, and does not throw an error unless `required` is `true`. Configuration files are in `ini` format by default (other formats can be added by an adept user). An example of a file:
337
337
338
338
```ini
339
-
;Commments are supported, using a ;
339
+
;Comments are supported, using a ;
340
340
; The default section is [default], case insensitive
341
341
342
342
value = 1
@@ -384,7 +384,7 @@ but before run behavior, while
384
384
still giving the user freedom to `callback` on the main app.
385
385
386
386
The most important parse function is `parse(std::vector<std::string>)`, which takes a reversed list of arguments (so that `pop_back` processes the args in the correct order). `get_help_ptr` and `get_config_ptr` give you access to the help/config option pointers. The standard `parse` manually sets the name from the first argument, so it should not be in this vector. You can also use `parse(string, bool)` to split up and parse a string; the optional bool should be set to true if you are
387
-
including the program name in the string.
387
+
including the program name in the string, and false otherwise.
388
388
389
389
Also, in a related note, the `App` you get a pointer to is stored in the parent `App` in a `unique_ptr`s (like `Option`s) and are deleted when the main `App` goes out of scope.
390
390
@@ -401,7 +401,8 @@ If you wanted to extend this to support a completely new type, just use a lambda
0 commit comments