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/commands.h"
|
||||||
|
#include "cli/handlers/agent/todo_commands.h"
|
||||||
#include "cli/z3ed.h"
|
#include "cli/z3ed.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -66,6 +67,7 @@ constexpr absl::string_view kUsage =
|
|||||||
" commit Commit changes\n"
|
" commit Commit changes\n"
|
||||||
" revert Revert changes\n"
|
" revert Revert changes\n"
|
||||||
" describe Describe agent capabilities\n"
|
" describe Describe agent capabilities\n"
|
||||||
|
" todo Manage tasks and project planning\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Global Options:\n"
|
"Global Options:\n"
|
||||||
" --rom=<path> Path to Zelda3 ROM file (required for most commands)\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") {
|
if (subcommand == "simple-chat") {
|
||||||
return agent::HandleSimpleChatCommand(subcommand_args, &rom_, absl::GetFlag(FLAGS_quiet));
|
return agent::HandleSimpleChatCommand(subcommand_args, &rom_, absl::GetFlag(FLAGS_quiet));
|
||||||
}
|
}
|
||||||
|
if (subcommand == "todo") {
|
||||||
|
return handlers::HandleTodoCommand(subcommand_args);
|
||||||
|
}
|
||||||
|
|
||||||
// Hex manipulation commands
|
// Hex manipulation commands
|
||||||
if (subcommand == "hex-read") {
|
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) {
|
absl::Status PaletteExport::Run(const std::vector<std::string>& arg_vec) {
|
||||||
if (arg_vec.size() < 3) {
|
std::string group_name;
|
||||||
return absl::InvalidArgumentError("Usage: palette export --group <group> --id <id> --to <file>");
|
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
|
if (group_name.empty() || palette_id == -1 || output_file.empty()) {
|
||||||
std::string group_name = arg_vec[0];
|
return absl::InvalidArgumentError("Usage: palette export --group <group> --id <id> --to <file>");
|
||||||
int palette_id = std::stoi(arg_vec[1]);
|
}
|
||||||
std::string output_file = arg_vec[2];
|
|
||||||
|
|
||||||
std::string rom_file = absl::GetFlag(FLAGS_rom);
|
std::string rom_file = absl::GetFlag(FLAGS_rom);
|
||||||
if (rom_file.empty()) {
|
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) {
|
absl::Status PaletteImport::Run(const std::vector<std::string>& arg_vec) {
|
||||||
if (arg_vec.size() < 3) {
|
std::string group_name;
|
||||||
return absl::InvalidArgumentError("Usage: palette import --group <group> --id <id> --from <file>");
|
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
|
if (group_name.empty() || palette_id == -1 || input_file.empty()) {
|
||||||
std::string group_name = arg_vec[0];
|
return absl::InvalidArgumentError("Usage: palette import --group <group> --id <id> --from <file>");
|
||||||
int palette_id = std::stoi(arg_vec[1]);
|
}
|
||||||
std::string input_file = arg_vec[2];
|
|
||||||
|
|
||||||
std::string rom_file = absl::GetFlag(FLAGS_rom);
|
std::string rom_file = absl::GetFlag(FLAGS_rom);
|
||||||
if (rom_file.empty()) {
|
if (rom_file.empty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user