소스 검색

JSON as default

Rain 1 개월 전
부모
커밋
2a85e20e49
1개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 7 7
      client_cli/src/main.rs

+ 7 - 7
client_cli/src/main.rs

@@ -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 } => {