|
|
@@ -42,10 +42,10 @@ struct Args {
|
|
|
enum Commands {
|
|
|
Get {
|
|
|
#[arg(
|
|
|
- long = "json",
|
|
|
- help = "Return data as JSON."
|
|
|
+ long = "plain",
|
|
|
+ help = "Return data in a human-readable format."
|
|
|
)]
|
|
|
- json: bool,
|
|
|
+ plaintext: bool,
|
|
|
},
|
|
|
|
|
|
Send {
|
|
|
@@ -71,7 +71,7 @@ fn main() {
|
|
|
let args = Args::parse();
|
|
|
|
|
|
match args.command {
|
|
|
- Commands::Get { json } => {
|
|
|
+ Commands::Get { plaintext } => {
|
|
|
let mut messages = rx_messages(&args.host, &args.password, args.timeout_sec)
|
|
|
.expect("Failed to load messages.");
|
|
|
|
|
|
@@ -79,7 +79,9 @@ fn main() {
|
|
|
a.time.cmp(&b.time)
|
|
|
});
|
|
|
|
|
|
- if json {
|
|
|
+ if plaintext {
|
|
|
+ todo!();
|
|
|
+ } else {
|
|
|
let mut messages_json = json::JsonValue::new_array();
|
|
|
for msg in &messages {
|
|
|
if msg.channel.to_lowercase() == args.channel.to_lowercase() {
|
|
|
@@ -93,8 +95,6 @@ fn main() {
|
|
|
}
|
|
|
|
|
|
println!("{}", messages_json.pretty(2));
|
|
|
- } else {
|
|
|
- todo!()
|
|
|
}
|
|
|
},
|
|
|
Commands::Send { ref name, ref content } => {
|