diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-03-03 00:24:01 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-03-08 00:12:07 +0100 |
| commit | 9325b94009dfe3ed02559303e6803e235299e151 (patch) | |
| tree | 77defd5a2f845d9ac8d8d45a977f40e3a08814b5 | |
| parent | 09471c55b24d5e69359675fe669397f031aa62d3 (diff) | |
Make --list-servers into a command.
| -rw-r--r-- | src/lib/encode_cli.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/encode_cli.cc b/src/lib/encode_cli.cc index c321d5014..fb307e019 100644 --- a/src/lib/encode_cli.cc +++ b/src/lib/encode_cli.cc @@ -68,7 +68,8 @@ help(function <void (string)> out) { out(fmt::format("Syntax: {} [OPTION] [COMMAND] [<FILM>]\n", program_name)); out("Commands:\n"); - out("make-dcp make DCP from the given film; default if no other command is specified\n"); + out("make-dcp make DCP from the given film; default if no other command is specified\n"); + out(variant::insert_dcpomatic("list-servers display a list of encoding servers that %1 can use (until Ctrl-C)\n")); out(variant::insert_dcpomatic(" -v, --version show %1 version\n")); out(" -h, --help show this help\n"); out(" -f, --flags show flags passed to C++ compiler on build\n"); @@ -79,6 +80,7 @@ help(function <void (string)> out) out(" -k, --keep-going keep running even when the job is complete\n"); out(" -s, --servers <file> specify servers to use in a text file\n"); out(variant::insert_dcpomatic(" -l, --list-servers just display a list of encoding servers that %1 is configured to use; don't encode\n")); + out(" (deprecated - use the list-servers command instead)\n"); out(" -d, --dcp-path echo DCP's path to stdout on successful completion (implies -n)\n"); out(" -c, --config <dir> directory containing config.xml and cinemas.xml\n"); out(" --dump just dump a summary of the film's settings; don't encode\n"); @@ -363,9 +365,19 @@ encode_cli(int argc, char* argv[], function<void (string)> out, function<void () } } + vector<string> commands = { + "make-dcp", + "list-servers" + }; + if (optind < argc - 1) { /* Command with a film specified afterwards */ command = argv[optind++]; + } else if (optind < argc) { + /* Look for a valid command, hoping that it's not the name of a film */ + if (std::find(commands.begin(), commands.end(), argv[optind]) != commands.end()) { + command = argv[optind++]; + } } if (config) { @@ -387,7 +399,7 @@ encode_cli(int argc, char* argv[], function<void (string)> out, function<void () Config::instance()->set_servers(servers); } - if (list_servers_) { + if (command == "list-servers" || list_servers_) { list_servers(out); return {}; } |
