yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
message_commands.cc
Go to the documentation of this file.
2
3#include "absl/strings/str_format.h"
4
5namespace yaze {
6namespace cli {
7namespace handlers {
8
10 Rom* rom, const resources::ArgumentParser& parser,
11 resources::OutputFormatter& formatter) {
12 auto limit = parser.GetInt("limit").value_or(50);
13
14 formatter.BeginObject("Message List");
15 formatter.AddField("limit", limit);
16 formatter.AddField("total_messages", 0);
17 formatter.AddField("status", "not_implemented");
18 formatter.AddField("message",
19 "Message listing requires message system integration");
20
21 formatter.BeginArray("messages");
22 formatter.EndArray();
23 formatter.EndObject();
24
25 return absl::OkStatus();
26}
27
29 Rom* rom, const resources::ArgumentParser& parser,
30 resources::OutputFormatter& formatter) {
31 auto message_id = parser.GetString("id").value();
32
33 formatter.BeginObject("Message");
34 formatter.AddField("message_id", message_id);
35 formatter.AddField("status", "not_implemented");
36 formatter.AddField("message",
37 "Message reading requires message system integration");
38
39 formatter.BeginObject("content");
40 formatter.AddField("text", "Message content would appear here");
41 formatter.AddField("length", 0);
42 formatter.EndObject();
43 formatter.EndObject();
44
45 return absl::OkStatus();
46}
47
49 Rom* rom, const resources::ArgumentParser& parser,
50 resources::OutputFormatter& formatter) {
51 auto query = parser.GetString("query").value();
52 auto limit = parser.GetInt("limit").value_or(10);
53
54 formatter.BeginObject("Message Search Results");
55 formatter.AddField("query", query);
56 formatter.AddField("limit", limit);
57 formatter.AddField("matches_found", 0);
58 formatter.AddField("status", "not_implemented");
59 formatter.AddField("message",
60 "Message search requires message system integration");
61
62 formatter.BeginArray("matches");
63 formatter.EndArray();
64 formatter.EndObject();
65
66 return absl::OkStatus();
67}
68
69} // namespace handlers
70} // namespace cli
71} // namespace yaze
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
Utility for parsing common CLI argument patterns.
std::optional< std::string > GetString(const std::string &name) const
Parse a named argument (e.g., –format=json or –format json)
absl::StatusOr< int > GetInt(const std::string &name) const
Parse an integer argument (supports hex with 0x prefix)
Utility for consistent output formatting across commands.
void BeginArray(const std::string &key)
Begin an array.
void BeginObject(const std::string &title="")
Start a JSON object or text section.
void EndObject()
End a JSON object or text section.
void AddField(const std::string &key, const std::string &value)
Add a key-value pair.