Explorar o código

bin/tau: show info on one id instead of listing it

Dastan-glitch %!s(int64=3) %!d(string=hai) anos
pai
achega
64abd7db65
Modificáronse 2 ficheiros con 10 adicións e 3 borrados
  1. 8 3
      bin/tau/tau-cli/src/main.rs
  2. 2 0
      bin/tau/tau-cli/src/view.rs

+ 8 - 3
bin/tau/tau-cli/src/main.rs

@@ -177,6 +177,7 @@ async fn main() -> Result<()> {
     // then remove IDs from filter so we can do apply_filter() normally.
     // If not provided we use get_ids() to get them from the daemon.
     let ids = get_ids(&mut filters)?;
+    let ids_clone = ids.clone();
     let task_ids = if ids.is_empty() { tau.get_ids().await? } else { ids };
 
     let mut tasks =
@@ -189,6 +190,13 @@ async fn main() -> Result<()> {
         tasks.push(tau.get_task_by_id(id).await?);
     }
 
+    if ids_clone.len() == 1 && args.command.is_none() {
+        let tsk = tasks[0].clone();
+        print_task_info(tsk)?;
+
+        return Ok(())
+    }
+
     for filter in filters {
         apply_filter(&mut tasks, &filter);
     }
@@ -229,7 +237,6 @@ async fn main() -> Result<()> {
                     if res {
                         let tsk = tau.get_task_by_id(task.id.into()).await?;
                         print_task_info(tsk)?;
-                        println!()
                     }
                 }
 
@@ -312,7 +319,6 @@ async fn main() -> Result<()> {
                     if res {
                         let tsk = tau.get_task_by_id(task.id.into()).await?;
                         print_task_info(tsk)?;
-                        println!()
                     }
                 }
                 Ok(())
@@ -322,7 +328,6 @@ async fn main() -> Result<()> {
                 for task in tasks {
                     let task = tau.get_task_by_id(task.id.into()).await?;
                     print_task_info(task)?;
-                    println!()
                 }
                 Ok(())
             }

+ 2 - 0
bin/tau/tau-cli/src/view.rs

@@ -180,6 +180,8 @@ pub fn print_task_info(taskinfo: TaskInfo) -> Result<()> {
     let comments_table = comments_table(taskinfo)?;
     comments_table.printstd();
 
+    println!();
+
     Ok(())
 }