Files
yaze/src/cli/modern_cli.h
scawful 04a4d04f4e feat(cli): Enhance CLI with resource catalog and sandbox management
- Added resource catalog for introspecting CLI resources, including schemas for palettes, ROMs, patches, overworlds, dungeons, and agents.
- Implemented serialization methods for resource schemas in both JSON and YAML formats.
- Introduced RomSandboxManager to manage sandboxed ROM copies, allowing for safe experimentation with ROM modifications.
- Updated ModernCLI to include new commands for palette management and enhanced help output.
- Added unit tests for resource catalog serialization and schema validation.
2025-10-01 14:34:58 -04:00

63 lines
2.4 KiB
C++

#ifndef YAZE_SRC_CLI_MODERN_CLI_H_
#define YAZE_SRC_CLI_MODERN_CLI_H_
#include <functional>
#include <map>
#include <string>
#include <vector>
#include "absl/status/status.h"
#include "cli/z3ed.h"
namespace yaze {
namespace cli {
struct CommandInfo {
std::string name;
std::string description;
std::string usage;
std::function<absl::Status(const std::vector<std::string>&)> handler;
};
class ModernCLI {
public:
ModernCLI();
absl::Status Run(int argc, char* argv[]);
CommandHandler* GetCommandHandler(const std::string& name);
void PrintTopLevelHelp() const;
std::map<std::string, CommandInfo> commands_;
private:
void SetupCommands();
void ShowHelp();
// Command Handlers
absl::Status HandleAsarPatchCommand(const std::vector<std::string>& args);
absl::Status HandleBpsPatchCommand(const std::vector<std::string>& args);
absl::Status HandleExtractSymbolsCommand(const std::vector<std::string>& args);
absl::Status HandleAgentCommand(const std::vector<std::string>& args);
absl::Status HandleProjectBuildCommand(const std::vector<std::string>& args);
absl::Status HandleProjectInitCommand(const std::vector<std::string>& args);
absl::Status HandleRomInfoCommand(const std::vector<std::string>& args);
absl::Status HandleRomGenerateGoldenCommand(const std::vector<std::string>& args);
absl::Status HandleRomDiffCommand(const std::vector<std::string>& args);
absl::Status HandleDungeonExportCommand(const std::vector<std::string>& args);
absl::Status HandleDungeonListObjectsCommand(const std::vector<std::string>& args);
absl::Status HandleGfxExportCommand(const std::vector<std::string>& args);
absl::Status HandleGfxImportCommand(const std::vector<std::string>& args);
absl::Status HandleCommandPaletteCommand(const std::vector<std::string>& args);
absl::Status HandlePaletteExportCommand(const std::vector<std::string>& args);
absl::Status HandlePaletteImportCommand(const std::vector<std::string>& args);
absl::Status HandlePaletteCommand(const std::vector<std::string>& args);
absl::Status HandleRomValidateCommand(const std::vector<std::string>& args);
absl::Status HandleOverworldGetTileCommand(const std::vector<std::string>& args);
absl::Status HandleOverworldSetTileCommand(const std::vector<std::string>& args);
absl::Status HandleSpriteCreateCommand(const std::vector<std::string>& args);
};
} // namespace cli
} // namespace yaze
#endif // YAZE_SRC_CLI_MODERN_CLI_H_