Skip to content

Commit

Permalink
feat(video2x): use boost::po to validate the required options
Browse files Browse the repository at this point in the history
Signed-off-by: k4yt3x <i@k4yt3x.com>
  • Loading branch information
k4yt3x committed Jan 24, 2025
1 parent 7d10fa2 commit aecb16b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/video2x/src/argparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ int parse_args(
("list-devices,l", "List the available Vulkan devices (GPUs)")

// General Processing Options
("input,i", PO_STR_VALUE<video2x::fsutils::StringType>(), "Input video file path")
("output,o", PO_STR_VALUE<video2x::fsutils::StringType>(), "Output video file path")
("processor,p", PO_STR_VALUE<video2x::fsutils::StringType>(),
("input,i", PO_STR_VALUE<video2x::fsutils::StringType>()->required(),
"Input video file path")
("output,o", PO_STR_VALUE<video2x::fsutils::StringType>()->required(),
"Output video file path")
("processor,p", PO_STR_VALUE<video2x::fsutils::StringType>()->required(),
"Processor to use (libplacebo, realesrgan, realcugan, rife)")
("hwaccel,a", PO_STR_VALUE<video2x::fsutils::StringType>()
->default_value(STR("none"), "none"), "Hardware acceleration method (decoding)")
Expand Down Expand Up @@ -201,7 +203,6 @@ int parse_args(
#else
po::store(po::command_line_parser(argc, argv).options(all_opts).run(), vm);
#endif
po::notify(vm);

if (vm.count("help") || argc == 1) {
std::cout
Expand Down Expand Up @@ -236,6 +237,9 @@ int parse_args(
return 1;
}

// Run all notify functions and validations
po::notify(vm);

if (vm.count("log-level")) {
if (!video2x::logger_manager::LoggerManager::instance().set_log_level(
wstring_to_u8string(vm["log-level"].as<video2x::fsutils::StringType>())
Expand Down

0 comments on commit aecb16b

Please sign in to comment.