19 Command(CLI::App &parent_app,
const std::string &name,
const std::string &desc,
const std::string &group)
25 app_ = parent_app.add_subcommand(name, desc);
32 app_->callback([
this] { this->
Run(); });
42 if (app_ ==
nullptr) {
49 virtual void Run() = 0;
58 :
Command{parent_app, kCommandName, kCommandDesc, kCommandGroup} {
65 std::cout <<
"Compile tileset command called." << std::endl;
69 static constexpr auto kCommandName =
"compile-tileset";
70 static constexpr auto kCommandDesc =
"Compile a Porytiles-format tileset to a Porymap-format tileset.";
71 static constexpr auto kCommandGroup =
"COMMANDS";
80 :
Command{parent_app, kCommandName, kCommandDesc, kCommandGroup} {
87 std::cout <<
"Compile layout command called." << std::endl;
91 static constexpr auto kCommandName =
"compile-layout";
92 static constexpr auto kCommandDesc =
"Compile a Porytiles-format layout to a Porymap-format layout.";
93 static constexpr auto kCommandGroup =
"COMMANDS";
102 :
Command{parent_app, kCommandName, kCommandDesc, kCommandGroup} {
109 std::cout <<
"Compile spritesheet command called." << std::endl;
113 static constexpr auto kCommandName =
"compile-spritesheet";
114 static constexpr auto kCommandDesc =
"Compile a Porytiles-format spritesheet to a Porymap-format spritesheet.";
115 static constexpr auto kCommandGroup =
"COMMANDS";
124 :
Command{parent_app, kCommandName, kCommandDesc, kCommandGroup} {
131 std::cout <<
"Decompile tileset command called." << std::endl;
135 static constexpr auto kCommandName =
"decompile-tileset";
136 static constexpr auto kCommandDesc =
"Decompile a Porymap-format tileset back to a Porytiles-format tileset.";
137 static constexpr auto kCommandGroup =
"COMMANDS";
146 :
Command{parent_app, kCommandName, kCommandDesc, kCommandGroup} {
153 std::cout <<
"Decompile layout command called." << std::endl;
157 static constexpr auto kCommandName =
"decompile-layout";
158 static constexpr auto kCommandDesc =
"Decompile a Porymap-format layout back to a Porytiles-format layout.";
159 static constexpr auto kCommandGroup =
"COMMANDS";
168 :
Command{parent_app, kCommandName, kCommandDesc, kCommandGroup} {}
171 std::cout <<
"Reduce bit depth command called." << std::endl;
175 static constexpr auto kCommandName =
"reduce-bit-depth";
176 static constexpr auto kCommandDesc =
"Reduce bit depth for given input assets.";
177 static constexpr auto kCommandGroup =
"COMMANDS";
Command is an abstract class that provides basic command functionality for the Porytiles CLI driver.
Command & operator=(const Command &)=delete
Command(const Command &)=delete
Command(Command &&)=delete
virtual ~Command()=default
Command(CLI::App &parent_app, const std::string &name, const std::string &desc, const std::string &group)
CLI::App & get_app() const
Command & operator=(Command &&)=delete
CompileLayoutCommand(CLI::App &parent_app)
CompileSpritesheetCommand(CLI::App &parent_app)
CompileTilesetCommand(CLI::App &parent_app)
DecompileLayoutCommand(CLI::App &parent_app)
DecompileTilesetCommand(CLI::App &parent_app)
void RegisterGroup(CLI::App &app) override
void RegisterGroup(CLI::App &app) override
ReduceBitDepthCommand(CLI::App &parent_app)
void Panic(const StringViewSourceLoc &s) noexcept
void AssertOrPanic(const bool condition, const StringViewSourceLoc &s)