Skip to content

Commit aecb16b

Browse files
committed
feat(video2x): use boost::po to validate the required options
Signed-off-by: k4yt3x <[email protected]>
1 parent 7d10fa2 commit aecb16b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/video2x/src/argparse.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ int parse_args(
7676
("list-devices,l", "List the available Vulkan devices (GPUs)")
7777

7878
// General Processing Options
79-
("input,i", PO_STR_VALUE<video2x::fsutils::StringType>(), "Input video file path")
80-
("output,o", PO_STR_VALUE<video2x::fsutils::StringType>(), "Output video file path")
81-
("processor,p", PO_STR_VALUE<video2x::fsutils::StringType>(),
79+
("input,i", PO_STR_VALUE<video2x::fsutils::StringType>()->required(),
80+
"Input video file path")
81+
("output,o", PO_STR_VALUE<video2x::fsutils::StringType>()->required(),
82+
"Output video file path")
83+
("processor,p", PO_STR_VALUE<video2x::fsutils::StringType>()->required(),
8284
"Processor to use (libplacebo, realesrgan, realcugan, rife)")
8385
("hwaccel,a", PO_STR_VALUE<video2x::fsutils::StringType>()
8486
->default_value(STR("none"), "none"), "Hardware acceleration method (decoding)")
@@ -201,7 +203,6 @@ int parse_args(
201203
#else
202204
po::store(po::command_line_parser(argc, argv).options(all_opts).run(), vm);
203205
#endif
204-
po::notify(vm);
205206

206207
if (vm.count("help") || argc == 1) {
207208
std::cout
@@ -236,6 +237,9 @@ int parse_args(
236237
return 1;
237238
}
238239

240+
// Run all notify functions and validations
241+
po::notify(vm);
242+
239243
if (vm.count("log-level")) {
240244
if (!video2x::logger_manager::LoggerManager::instance().set_log_level(
241245
wstring_to_u8string(vm["log-level"].as<video2x::fsutils::StringType>())

0 commit comments

Comments
 (0)