Revert changes made to example.cpp in 4f7ab89
This commit is contained in:
parent
6c6deabc89
commit
ca98684077
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||||||
#include "cxxopts.hpp"
|
#include "cxxopts.hpp"
|
||||||
|
|
||||||
void
|
void
|
||||||
parse(int argc, const char* argv[], bool parse_as_string = false)
|
parse(int argc, const char* argv[])
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -77,20 +77,7 @@ parse(int argc, const char* argv[], bool parse_as_string = false)
|
|||||||
|
|
||||||
options.parse_positional({"input", "output", "positional"});
|
options.parse_positional({"input", "output", "positional"});
|
||||||
|
|
||||||
cxxopts::ParseResult result;
|
auto result = options.parse(argc, argv);
|
||||||
if (parse_as_string)
|
|
||||||
{
|
|
||||||
std::string argv_str;
|
|
||||||
for (int i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
argv_str += std::string(argv[i]) + std::string(" ");
|
|
||||||
}
|
|
||||||
result = options.parse(argv_str);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = options.parse(argc, argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.count("help"))
|
if (result.count("help"))
|
||||||
{
|
{
|
||||||
@ -198,8 +185,5 @@ int main(int argc, const char* argv[])
|
|||||||
{
|
{
|
||||||
parse(argc, argv);
|
parse(argc, argv);
|
||||||
|
|
||||||
// Parse argv as string
|
|
||||||
parse(argc, argv, true);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user