diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-04-11 00:54:13 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-04-11 20:31:45 +0200 |
| commit | e1aac965a70ad8f50716325ef31a1829161dc6d3 (patch) | |
| tree | 479f6b6a873aef239fa2cd2924839e973dbedd2a /src/lib/create_cli.cc | |
| parent | 87354b0a1d1f9ad48202f13e3bc2c6c3937b8a81 (diff) | |
Give an error if a non-number is passed to dcpomatic2_create -s (#2488).
Diffstat (limited to 'src/lib/create_cli.cc')
| -rw-r--r-- | src/lib/create_cli.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index 2cbff6e85..81e353893 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -123,7 +123,6 @@ CreateCLI::CreateCLI (int argc, char* argv[]) , threed (false) , dcp_content_type (nullptr) , container_ratio (nullptr) - , still_length (10) , standard (dcp::Standard::SMPTE) , no_use_isdcf_name (false) , twok (false) @@ -184,12 +183,20 @@ CreateCLI::CreateCLI (int argc, char* argv[]) return boost::filesystem::path(s); }; + std::function<optional<int> (string s)> string_to_nonzero_int = [](string s) { + auto const value = dcp::raw_convert<int>(s); + if (value == 0) { + return boost::optional<int>(); + } + return boost::optional<int>(value); + }; + argument_option(i, argc, argv, "-n", "--name", &claimed, &error, &name); argument_option(i, argc, argv, "-t", "--template", &claimed, &error, &template_name_string); argument_option(i, argc, argv, "-c", "--dcp-content-type", &claimed, &error, &dcp_content_type_string); argument_option(i, argc, argv, "-f", "--dcp-frame-rate", &claimed, &error, &dcp_frame_rate_int); argument_option(i, argc, argv, "", "--container-ratio", &claimed, &error, &container_ratio_string); - argument_option(i, argc, argv, "-s", "--still-length", &claimed, &error, &still_length); + argument_option(i, argc, argv, "-s", "--still-length", &claimed, &error, &still_length, string_to_nonzero_int); argument_option(i, argc, argv, "", "--standard", &claimed, &error, &standard_string); argument_option(i, argc, argv, "", "--config", &claimed, &error, &config_dir, string_to_path); argument_option(i, argc, argv, "-o", "--output", &claimed, &error, &output_dir, string_to_path); |
