8000 Exception without try catch? · Issue #10 · p-ranav/structopt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Exception without try catch? #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ru108 opened this issue Aug 21, 2020 · 1 comment
Closed

Exception without try catch? #10

ru108 opened this issue Aug 21, 2020 · 1 comment

Comments

@ru108
Copy link
ru108 commented Aug 21, 2020
#include <iostream>
#include <optional>
#include <string>

#include <structopt/app.hpp>

struct Options {
  std::string db_name;
  std::string path_files;
  std::string path_archive;
  enum class LogLevel { trace, debug, info, warn, err, critical, off };
  std::optional<LogLevel> log_level = LogLevel::debug;
};
STRUCTOPT(Options, db_name, path_files, path_archive, log_level);

int main(int argc, char* argv[]) {
  auto opts = structopt::app("test", "1.0.0.1").parse<Options>(argc, argv);

  std::cout << "Hello World!\n";
}

without parameters
./test.exe

Microsoft Visual Studio Community 2019
Version 16.7.2
VisualStudio.16.Release/16.7.2+30413.136

@ru108 ru108 changed the title Exception? Exception without try catch? Aug 21, 2020
@ru108
Copy link
Author
ru108 commented Aug 21, 2020

I know that wrong args but...
./test.exe --db_name=qqq --path_files=rrr --path_archive=uuu
infinity loop in

for (std::size_t i = 1; i < parser.arguments.size(); i++) {
parser.current_index = i;
visit_struct::for_each(argument_struct, parser);
}

p-ranav added a commit that referenced this issue Aug 21, 2020
p-ranav added a commit that referenced this issue Aug 21, 2020
@p-ranav p-ranav closed this as completed Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0