| 54 | } |
| 55 | |
| 56 | void ProgramArgument::Parse(int argc, char *argv[]) { |
| 57 | Clear(); |
| 58 | // Parse the command line |
| 59 | try { |
| 60 | command_line_parser parser(argc, argv); |
| 61 | parser.options(desc_); |
| 62 | parser.positional(pos_); |
| 63 | const auto opt = parser.run(); |
| 64 | variables_map vm; |
| 65 | store(opt, vm); |
| 66 | notify(vm); |
| 67 | if (vm.empty()) { |
| 68 | show_help_ = true; |
| 69 | return; |
| 70 | } |
| 71 | show_help_ = vm.contains("help"); |
| 72 | show_version_ = vm.contains("version"); |
| 73 | if (vm.contains("non-interactive")) { |
| 74 | non_interactive_ = true; |
| 75 | } |
| 76 | if (vm.contains("quiet")) { |
| 77 | non_interactive_ = true; |
| 78 | } |
| 79 | if (vm.contains("silent")) { |
| 80 | non_interactive_ = true; |
| 81 | } |
| 82 | delete_converted_ = vm.contains("delete-converted"); |
| 83 | no_append_root_ = vm.contains("no-append-root"); |
| 84 | force_overwrite_ = vm.contains("force"); |
| 85 | |
| 86 | strip_path(password_file_); |
| 87 | strip_path(output_directory_); |
| 88 | for (auto& input : input_list_) { |
| 89 | strip_path(input); |
| 90 | } |
| 91 | } catch (const std::exception& err) { |
| 92 | std::cerr << "Invalid input argument. Error: " << err.what(); |
| 93 | show_help_ = true; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | void ProgramArgument::ShowHelp() { |
| 98 | std::cout << std::endl; |