argparse icon indicating copy to clipboard operation
argparse copied to clipboard

wmain support

Open zhihaoy opened this issue 6 years ago • 2 comments

A boss

https://docs.microsoft.com/en-us/cpp/c-language/using-wmain?view=vs-2019

That all C++ cmdline parsing libraries face.

A strong demand is to construct std::path from command-line arguments, where std::wstring is native string type for std::path on Windows.

In past experience, Boost.Program_options (Sphinx docs) is the only library that allowed me to program wmain in real code. But Boost's choice is to template everything on character type while still supporting some codecvt conversions internally. Using only wvalue may work for some applications, but in general wcommand_line_parser is needed.

Given argparse' type erasure design, we have an opportunity to look at the problem differently.

zhihaoy avatar Nov 14 '19 18:11 zhihaoy

Seems like Windows has support for UTF-8 in main since Windows Version 1903 (May 2019 Update) (MSDN link).

We might be able to use argparse on Windows with Unicode support without any extra changes to the library.

AlexanderRevo avatar Aug 15 '22 07:08 AlexanderRevo

In past experience, Boost.Program_options (Sphinx docs) is the only library that allowed me to program wmain in real code. But Boost's choice is to template everything on character type while still supporting some codecvt conversions internally. Using only wvalue may work for some applications, but in general wcommand_line_parser is needed.

Changed argparse to handle wmain correctly, see this issue: https://github.com/p-ranav/argparse/issues/222

Temporalitas avatar Nov 05 '22 00:11 Temporalitas