Skip to content

Commit 7b34280

Browse files
committed
docs: fix mentions of removed functionality
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 6cd71d3 commit 7b34280

File tree

1 file changed

+9
-36
lines changed

1 file changed

+9
-36
lines changed

README.md

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,8 +1427,8 @@ CLI11 supports Unicode and wide strings as defined in the
14271427
14281428
When using the command line on Windows with unicode arguments, your `main`
14291429
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
1431+
is recommended for cross-platform support:
14321432
14331433
1\. Replace `argv` with `app.ensure_utf8(argv)` before any arguments are parsed.
14341434
`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) {
14451445
}
14461446
```
14471447

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`.
14521451

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

1481-
4\. Use the Windows-only non-standard `wmain` function, which accepts
1454+
2\. Use the Windows-only non-standard `wmain` function, which accepts
14821455
`wchar_t *argv[]` instead of `char* argv[]`. Parsing this will allow CLI to
14831456
convert wide strings to UTF-8 without losing information.
14841457

@@ -1490,10 +1463,10 @@ int wmain(int argc, wchar_t *argv[]) {
14901463
}
14911464
```
14921465
1493-
5\. Retrieve arguments yourself by using Windows APIs like
1466+
3\. Retrieve arguments yourself by using Windows APIs like
14941467
[`CommandLineToArgvW`](https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw)
14951468
and pass them to CLI. This is what the library is doing under the hood in
1496-
`CLI::argv()`.
1469+
`ensure_utf8`.
14971470
14981471
</p></details>
14991472
</br>

0 commit comments

Comments
 (0)