Ver Fonte

bin/tau: show task number with title when creating a task

Dastan-glitch há 3 anos atrás
pai
commit
dc76d43b74

+ 4 - 2
bin/tau/tau-cli/src/main.rs

@@ -221,8 +221,10 @@ async fn main() -> Result<()> {
                 }
                 }
 
 
                 let title = task.clone().title;
                 let title = task.clone().title;
-                if tau.add(task).await? {
-                    println!("Created task \"{}\"", title);
+
+                let task_id = tau.add(task).await?;
+                if task_id > 0 {
+                    println!("Created task {} \"{}\"", task_id, title);
                 }
                 }
                 Ok(())
                 Ok(())
             }
             }

+ 2 - 2
bin/tau/tau-cli/src/rpc.rs

@@ -32,12 +32,12 @@ impl Tau {
     }
     }
 
 
     /// Add a new task.
     /// Add a new task.
-    pub async fn add(&self, task: BaseTask) -> Result<bool> {
+    pub async fn add(&self, task: BaseTask) -> Result<u32> {
         let req = JsonRequest::new("add", json!([task]));
         let req = JsonRequest::new("add", json!([task]));
         let rep = self.rpc_client.request(req).await?;
         let rep = self.rpc_client.request(req).await?;
 
 
         debug!("Got reply: {:?}", rep);
         debug!("Got reply: {:?}", rep);
-        let reply: bool = from_value(rep)?;
+        let reply: u32 = from_value(rep)?;
         Ok(reply)
         Ok(reply)
     }
     }
 
 

+ 2 - 2
bin/tau/taud/src/jsonrpc.rs

@@ -178,8 +178,8 @@ impl JsonRpcInterface {
         new_task.set_assign(&task.assign);
         new_task.set_assign(&task.assign);
         new_task.set_tags(&task.tags);
         new_task.set_tags(&task.tags);
 
 
-        self.notify_queue_sender.send(new_task).await.map_err(Error::from)?;
-        Ok(json!(true))
+        self.notify_queue_sender.send(new_task.clone()).await.map_err(Error::from)?;
+        Ok(json!(new_task.id))
     }
     }
 
 
     // RPCAPI:
     // RPCAPI: