21 :
Command{parent_app, command_name, command_desc, command_group}
24 cmd.add_option(
"<tileset-name>", tileset_name_,
"Name of the tileset to decompile")->required();
38 const auto env_result = env.initialize(tileset_name_);
39 if (!env_result.has_value()) {
43 env.stderr_diag.fatal(env_fail_result);
44 throw CLI::RuntimeError{1};
48 if (!attribute_context.has_value()) {
52 env.diag->fatal(fail_result);
53 throw CLI::RuntimeError{1};
61 services.tile_printer.get(),
62 services.palette_printer.get()};
67 &services.metadata_provider,
68 &services.tileset_manager,
74 auto decompile_result = decompile_use_case.
decompile(tileset_name_);
75 if (!decompile_result.has_value()) {
79 env.diag->fatal(fail_result);
80 throw CLI::RuntimeError{1};
84 static constexpr auto command_name =
"decompile-tileset";
85 static constexpr auto command_desc =
86 "Decompile a tileset -- update the Porytiles assets to match the Porymap assets.";
87 static constexpr auto command_group =
"COMMANDS";
88 std::string tileset_name_;
Command is an abstract class that provides basic command functionality for the Porytiles CLI driver.
CLI::App & get_app() const
DecompileTilesetCommand(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.
Use case for decompiling a primary Tileset.
ChainableResult< void > decompile(const std::string &tileset_name) const
Decompiles the primary Tileset with the given tileset name.
Bootstrap class so every tileset command can share common config and diagnostic setup.
The schema-driven service graph shared by the compile, create, import, and decompile commands.
void register_config_options(CLI::App &app, CliOptionStorage &storage)
Registers all config options with a CLI11 App.
ChainableResult< ResolvedAttributeContext > resolve_attribute_context(TilesetCommandEnv &env, const std::string &tileset_name)
Resolves the invocation's metatile attribute schema and builds the provider map for its fields.
Storage struct for CLI option values.