feat: Add Todo Command and Improve Argument Parsing in Palette Export/Import
- Introduced a new 'todo' command in the agent handler for managing tasks and project planning. - Enhanced argument parsing in PaletteExport and PaletteImport to ensure proper usage and error handling, improving user feedback for command execution.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "cli/handlers/agent/commands.h"
|
||||
#include "cli/handlers/agent/todo_commands.h"
|
||||
#include "cli/z3ed.h"
|
||||
|
||||
#include <string>
|
||||
@@ -66,6 +67,7 @@ constexpr absl::string_view kUsage =
|
||||
" commit Commit changes\n"
|
||||
" revert Revert changes\n"
|
||||
" describe Describe agent capabilities\n"
|
||||
" todo Manage tasks and project planning\n"
|
||||
"\n"
|
||||
"Global Options:\n"
|
||||
" --rom=<path> Path to Zelda3 ROM file (required for most commands)\n"
|
||||
@@ -151,6 +153,9 @@ absl::Status Agent::Run(const std::vector<std::string>& arg_vec) {
|
||||
if (subcommand == "simple-chat") {
|
||||
return agent::HandleSimpleChatCommand(subcommand_args, &rom_, absl::GetFlag(FLAGS_quiet));
|
||||
}
|
||||
if (subcommand == "todo") {
|
||||
return handlers::HandleTodoCommand(subcommand_args);
|
||||
}
|
||||
|
||||
// Hex manipulation commands
|
||||
if (subcommand == "hex-read") {
|
||||
|
||||
@@ -38,14 +38,24 @@ void Palette::RunTUI(ftxui::ScreenInteractive& screen) {
|
||||
}
|
||||
|
||||
absl::Status PaletteExport::Run(const std::vector<std::string>& arg_vec) {
|
||||
if (arg_vec.size() < 3) {
|
||||
return absl::InvalidArgumentError("Usage: palette export --group <group> --id <id> --to <file>");
|
||||
std::string group_name;
|
||||
int palette_id = -1;
|
||||
std::string output_file;
|
||||
|
||||
for (size_t i = 0; i < arg_vec.size(); ++i) {
|
||||
const std::string& arg = arg_vec[i];
|
||||
if ((arg == "--group") && i + 1 < arg_vec.size()) {
|
||||
group_name = arg_vec[++i];
|
||||
} else if ((arg == "--id") && i + 1 < arg_vec.size()) {
|
||||
palette_id = std::stoi(arg_vec[++i]);
|
||||
} else if ((arg == "--to") && i + 1 < arg_vec.size()) {
|
||||
output_file = arg_vec[++i];
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Implement proper argument parsing
|
||||
std::string group_name = arg_vec[0];
|
||||
int palette_id = std::stoi(arg_vec[1]);
|
||||
std::string output_file = arg_vec[2];
|
||||
if (group_name.empty() || palette_id == -1 || output_file.empty()) {
|
||||
return absl::InvalidArgumentError("Usage: palette export --group <group> --id <id> --to <file>");
|
||||
}
|
||||
|
||||
std::string rom_file = absl::GetFlag(FLAGS_rom);
|
||||
if (rom_file.empty()) {
|
||||
@@ -88,14 +98,24 @@ absl::Status PaletteExport::Run(const std::vector<std::string>& arg_vec) {
|
||||
}
|
||||
|
||||
absl::Status PaletteImport::Run(const std::vector<std::string>& arg_vec) {
|
||||
if (arg_vec.size() < 3) {
|
||||
return absl::InvalidArgumentError("Usage: palette import --group <group> --id <id> --from <file>");
|
||||
std::string group_name;
|
||||
int palette_id = -1;
|
||||
std::string input_file;
|
||||
|
||||
for (size_t i = 0; i < arg_vec.size(); ++i) {
|
||||
const std::string& arg = arg_vec[i];
|
||||
if ((arg == "--group") && i + 1 < arg_vec.size()) {
|
||||
group_name = arg_vec[++i];
|
||||
} else if ((arg == "--id") && i + 1 < arg_vec.size()) {
|
||||
palette_id = std::stoi(arg_vec[++i]);
|
||||
} else if ((arg == "--from") && i + 1 < arg_vec.size()) {
|
||||
input_file = arg_vec[++i];
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Implement proper argument parsing
|
||||
std::string group_name = arg_vec[0];
|
||||
int palette_id = std::stoi(arg_vec[1]);
|
||||
std::string input_file = arg_vec[2];
|
||||
if (group_name.empty() || palette_id == -1 || input_file.empty()) {
|
||||
return absl::InvalidArgumentError("Usage: palette import --group <group> --id <id> --from <file>");
|
||||
}
|
||||
|
||||
std::string rom_file = absl::GetFlag(FLAGS_rom);
|
||||
if (rom_file.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user