21 :
Command{parent_app, command_name, command_desc, command_group}
24 cmd.add_option(
"<tileset-name>", tileset_name_,
"Name of the tileset to dump config for")->required();
26 "--allow-missing-tileset",
27 allow_missing_tileset_,
28 "Dump config even when the tileset does not exist, to preview what a new tileset would inherit.");
42 const auto env_result = env.initialize(tileset_name_);
43 if (!env_result.has_value()) {
47 env.stderr_diag.fatal(env_fail_result);
48 throw CLI::RuntimeError{1};
54 if (!allow_missing_tileset_) {
56 if (!metadata_provider.exists(tileset_name_)) {
58 "Tileset '{}' does not exist. Pass '{}' to dump its config anyway.",
60 FormatParam{
"--allow-missing-tileset", Style::bold}}};
61 env.diag->fatal(not_found_err);
62 throw CLI::RuntimeError{1};
66 env.config.dump_config(std::cout, ConfigScopeType::tileset, tileset_name_);
69 static constexpr auto command_name =
"dump-tileset-config";
70 static constexpr auto command_desc =
"Dump the full configuration provenance chain for a tileset.";
71 static constexpr auto command_group =
"UTILITIES";
72 std::string tileset_name_;
73 bool allow_missing_tileset_{
false};
Command is an abstract class that provides basic command functionality for the Porytiles CLI driver.
CLI::App & get_app() const
DumpTilesetConfigCommand(CLI::App &parent_app)
std::filesystem::path project_root() const
void RegisterOpt(CLI::App &app) override
A result type that maintains a chainable sequence of errors for debugging and error reporting.
Bootstrap class so every tileset command can share common config and diagnostic setup.
void register_config_options(CLI::App &app, CliOptionStorage &storage)
Registers all config options with a CLI11 App.
Storage struct for CLI option values.