24 cmd.add_option(
"<tileset-name>", tileset_name_,
"Name of the tileset to import")->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};
59 &services.resolved.schema,
63 services.tile_printer.get(),
64 services.palette_printer.get(),
65 &services.metadata_provider,
66 &services.png_indexed_loader,
67 &services.jasc_loader,
73 services.tile_printer.get(),
74 services.palette_printer.get()};
80 &services.metadata_provider,
81 &services.tileset_manager,
87 auto import_result = import_use_case.
import(tileset_name_);
88 if (!import_result.has_value()) {
92 env.diag->fatal(fail_result);
93 throw CLI::RuntimeError{1};
97 static constexpr auto command_name =
"import-tileset";
98 static constexpr auto command_desc =
"Import a pre-existing tileset into Porytiles.";
99 static constexpr auto command_group =
"COMMANDS";
100 std::string tileset_name_;
Command is an abstract class that provides basic command functionality for the Porytiles CLI driver.
CLI::App & get_app() const
ImportTilesetCommand(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 importing a primary Tileset.
ChainableResult< void > import(const std::string &tileset_name) const
Infra-layer implementation of PrimaryTilesetImporter for pokeemerald project structure.
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.