@@ -206,8 +206,8 @@ int main(int argc, char** argv) {
206
206
}
207
207
```
208
208
209
- For more information about 🚧 `ensure_utf8` the section on
210
- [Unicode support](#unicode-support) below. The 🚧 `ensure_utf8` function is only
209
+ For more information about 🆕 `ensure_utf8` the section on
210
+ [Unicode support](#unicode-support) below. The 🆕 `ensure_utf8` function is only
211
211
available in main currently and not in a release.
212
212
213
213
<details><summary>Note: If you don't like macros, this is what that macro expands to: (click to expand)</summary><p>
@@ -416,7 +416,7 @@ Before parsing, you can set the following options:
416
416
option. Options can be removed from the excludes list with
417
417
` ->remove_excludes(opt) `
418
418
- ` ->envname(name) ` : Gets the value from the environment if present and not
419
- passed on the command line. 🚧 The value must also pass any validators to be
419
+ passed on the command line. 🆕 The value must also pass any validators to be
420
420
used.
421
421
- ` ->group(name) ` : The help group to put the option in. No effect for positional
422
422
options. Defaults to ` "Options" ` . Options given an empty string will not show
@@ -452,7 +452,7 @@ Before parsing, you can set the following options:
452
452
are ` CLI::MultiOptionPolicy::Throw ` , ` CLI::MultiOptionPolicy::Throw ` ,
453
453
` CLI::MultiOptionPolicy::TakeLast ` , ` CLI::MultiOptionPolicy::TakeFirst ` ,
454
454
` CLI::MultiOptionPolicy::Join ` , ` CLI::MultiOptionPolicy::TakeAll ` ,
455
- ` CLI::MultiOptionPolicy::Sum ` 🆕 , and ` CLI::MultiOptionPolicy::Reverse ` 🚧 .
455
+ ` CLI::MultiOptionPolicy::Sum ` , and ` CLI::MultiOptionPolicy::Reverse ` 🆕 .
456
456
- ` ->check(std::string(const std::string &), validator_name="",validator_description="") ` :
457
457
Define a check function. The function should return a non empty string with
458
458
the error message if the check fails
@@ -694,15 +694,15 @@ NOTES: If the container used in `IsMember`, `Transformer`, or
694
694
fast search is performed first, and if that fails a linear search with the
695
695
filters on the key values is performed.
696
696
697
- - `CLI::FileOnDefaultPath(default_path)`: 🆕 can be used to check for files in a
697
+ - `CLI::FileOnDefaultPath(default_path)`: can be used to check for files in a
698
698
default path. If used as a transform it will first check that a file exists,
699
699
if it does nothing further is done, if it does not it tries to add a default
700
700
Path to the file and search there again. If the file does not exist an error
701
701
is returned normally but this can be disabled using
702
702
`CLI::FileOnDefaultPath(default_path, false)`. This allows multiple paths to
703
703
be chained using multiple transform calls.
704
704
705
- - `CLI::EscapedString`: 🚧 can be used to process an escaped string. The
705
+ - `CLI::EscapedString`: 🆕 can be used to process an escaped string. The
706
706
processing is equivalent to that used for TOML config files, see
707
707
[TOML strings](https://toml.io/en/v1.0.0#string). With 2 notable exceptions.
708
708
\` can also be used as a literal string notation, and it also allows binary
@@ -874,7 +874,7 @@ nameless subcommands are allowed. Callbacks for nameless subcommands are only
874
874
triggered if any options from the subcommand were parsed. Subcommand names given
875
875
through the ` add_subcommand ` method have the same restrictions as option names.
876
876
877
- 🚧 Options or flags in a subcommand may be directly specified using dot notation
877
+ 🆕 Options or flags in a subcommand may be directly specified using dot notation
878
878
879
879
- ` --subcommand.long=val ` (long subcommand option)
880
880
- ` --subcommand.long val ` (long subcommand option)
@@ -886,7 +886,7 @@ through the `add_subcommand` method have the same restrictions as option names.
886
886
The use of dot notation in this form is equivalent ` --subcommand.long <args> ` =>
887
887
` subcommand --long <args> ++ ` . Nested subcommands also work ` sub1.subsub ` would
888
888
trigger the subsub subcommand in ` sub1 ` . This is equivalent to "sub1 subsub".
889
- Quotes around the subcommand names are permitted 🚧 following the TOML standard
889
+ Quotes around the subcommand names are permitted 🆕 following the TOML standard
890
890
for such specification. This includes allowing escape sequences. For example
891
891
` "subcommand".'f' ` or ` "subcommand.with.dots".arg1 = value ` .
892
892
@@ -926,9 +926,9 @@ option_groups. These are:
926
926
before matching. Validation is specified through ` transform ` , ` check ` , and
927
927
` each ` for an option. If an argument fails validation it is not an error and
928
928
matching proceeds to the next available positional or extra arguments.
929
- - ` .validate_optional_arguments() ` :🆕 Specify that optional arguments should
930
- pass validation before being assigned to an option. Validation is specified
931
- through ` transform ` , ` check ` , and ` each ` for an option. If an argument fails
929
+ - ` .validate_optional_arguments() ` : Specify that optional arguments should pass
930
+ validation before being assigned to an option. Validation is specified through
931
+ ` transform ` , ` check ` , and ` each ` for an option. If an argument fails
932
932
validation it is not an error and matching proceeds to the next available
933
933
positional subcommand or extra arguments.
934
934
- ` .excludes(option_or_subcommand) ` : If given an option pointer or pointer to
@@ -1014,9 +1014,9 @@ option_groups. These are:
1014
1014
- ` .prefix_command() ` : Like ` allow_extras ` , but stop immediately on the first
1015
1015
unrecognized item. It is ideal for allowing your app or subcommand to be a
1016
1016
"prefix" to calling another app.
1017
- - ` .usage(message) ` : 🚧 Replace text to appear at the start of the help string
1017
+ - ` .usage(message) ` : 🆕 Replace text to appear at the start of the help string
1018
1018
after description.
1019
- - ` .usage(std::string()) ` : 🚧 Set a callback to generate a string that will
1019
+ - ` .usage(std::string()) ` : 🆕 Set a callback to generate a string that will
1020
1020
appear at the start of the help string after description.
1021
1021
- ` .footer(message) ` : Set text to appear at the bottom of the help string.
1022
1022
- ` .footer(std::string()) ` : Set a callback to generate a string that will appear
@@ -1223,8 +1223,8 @@ is present, it will be read along with the normal command line arguments. The
1223
1223
file will be read if it exists, and does not throw an error unless ` required ` is
1224
1224
` true ` . Configuration files are in [ TOML] [ ] format by default, though the
1225
1225
default reader can also accept files in INI format as well. The config reader
1226
- can read most aspects of TOML files including strings both literal 🚧 and with
1227
- potential escape sequences 🚧 , digit separators 🚧 , and multi-line strings 🚧 ,
1226
+ can read most aspects of TOML files including strings both literal 🆕 and with
1227
+ potential escape sequences 🆕 , digit separators 🆕 , and multi-line strings 🆕 ,
1228
1228
and run them through the CLI11 parser. Other formats can be added by an adept
1229
1229
user, some variations are available through customization points in the default
1230
1230
formatter. An example of a TOML file:
@@ -1297,9 +1297,9 @@ boolean values are not quoted.
1297
1297
1298
1298
For options or flags which allow 0 arguments to be passed using an empty string
1299
1299
in the config file, `{}`, or `[]` will convert the result to the default value
1300
- specified via `default_str` or `default_val` on the option 🆕 . If no user
1301
- specified default is given the result is an empty string or the converted value
1302
- of an empty string.
1300
+ specified via `default_str` or `default_val` on the option. If no user specified
1301
+ default is given the result is an empty string or the converted value of an
1302
+ empty string.
1303
1303
1304
1304
NOTE: Transforms and checks can be used with the option pointer returned from
1305
1305
set_config like any other option to validate the input if needed. It can also be
@@ -1427,8 +1427,8 @@ CLI11 supports Unicode and wide strings as defined in the
1427
1427
1428
1428
When using the command line on Windows with unicode arguments, your `main`
1429
1429
function may already receive broken Unicode. Parsing `argv` at that point will
1430
- not give you a correct string. To fix this, you have three good options and two
1431
- bad ones :
1430
+ not give you a correct string. To fix this, you have three options; the first is
1431
+ recommended for cross-platform support :
1432
1432
1433
1433
1\. Replace `argv` with `app.ensure_utf8(argv)` before any arguments are parsed.
1434
1434
`ensure_utf8` will do nothing on systems where `argv` is already in UTF-8 (Such
@@ -1445,40 +1445,13 @@ int main(int argc, char** argv) {
1445
1445
}
1446
1446
```
1447
1447
1448
- 2\. If you pass unmodified command-line arguments to CLI11, call ` app.parse() `
1449
- instead of ` app.parse(argc, argv) ` (or ` CLI11_PARSE(app) ` instead of
1450
- ` CLI11_PARSE(app, argc, argv) ` ). The library will find correct arguments by
1451
- itself.
1448
+ Be sure you do not modify ` argv ` before this function call, as the correct
1449
+ values will be reconstructed using Windows APIs and produced by this call. It
1450
+ has no effect on other platforms and just passes through ` argv ` .
1452
1451
1453
- > [ !NOTE]
1454
- >
1455
- > This approach may not work on weird OS configurations, such as when the
1456
- > ` /proc ` dir is missing on Linux systems (see also
1457
- > [ #845 ] ( https://github.com/CLIUtils/CLI11/issues/845 ) ).
1458
- >
1459
- > ``` cpp
1460
- > int main () {
1461
- > CLI::App app;
1462
- > // ...
1463
- > CLI11_PARSE(app);
1464
- > }
1465
- > ```
1466
-
1467
- 3\. Get correct arguments with which the program was originally executed using
1468
- provided functions: `CLI::argc()` and `CLI::argv()`. These three methods are the
1469
- only cross-platform ways of handling unicode correctly.
1470
-
1471
- ```cpp
1472
- int main() {
1473
- CLI::App app;
1474
- // ...
1475
- CLI11_PARSE(app, CLI::argc(), CLI::argv());
1476
- }
1477
- ```
1478
-
1479
- <details ><summary >Bad options (click to expand)</summary ><p >
1452
+ <details ><summary >Other options (click to expand)</summary ><p >
1480
1453
1481
- 4 \. Use the Windows-only non-standard ` wmain ` function, which accepts
1454
+ 2 \. Use the Windows-only non-standard ` wmain ` function, which accepts
1482
1455
` wchar_t *argv[] ` instead of ` char* argv[] ` . Parsing this will allow CLI to
1483
1456
convert wide strings to UTF-8 without losing information.
1484
1457
@@ -1490,10 +1463,10 @@ int wmain(int argc, wchar_t *argv[]) {
1490
1463
}
1491
1464
```
1492
1465
1493
- 5 \. Retrieve arguments yourself by using Windows APIs like
1466
+ 3 \. Retrieve arguments yourself by using Windows APIs like
1494
1467
[`CommandLineToArgvW`](https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw)
1495
1468
and pass them to CLI. This is what the library is doing under the hood in
1496
- `CLI::argv() `.
1469
+ `ensure_utf8 `.
1497
1470
1498
1471
</p></details>
1499
1472
</br>
0 commit comments