Explorar o código

bin/tau: rename update() to modify()

Dastan-glitch %!s(int64=2) %!d(string=hai) anos
pai
achega
343c319228
Modificáronse 3 ficheiros con 11 adicións e 11 borrados
  1. 1 1
      bin/tau/tau-cli/src/main.rs
  2. 3 3
      bin/tau/tau-cli/src/rpc.rs
  3. 7 7
      bin/tau/taud/src/jsonrpc.rs

+ 1 - 1
bin/tau/tau-cli/src/main.rs

@@ -255,7 +255,7 @@ fn main() -> Result<()> {
                     let base_task = task_from_cli(values)?;
                     for id in ids_clone {
                         let task = tasks_local_id.get(&(id as usize)).unwrap();
-                        let res = tau.update(&task.ref_id, base_task.clone()).await?;
+                        let res = tau.modify(&task.ref_id, base_task.clone()).await?;
                         if res {
                             let tsk = tau.get_task_by_ref_id(&task.ref_id).await?;
                             print_task_info(id as usize, tsk)?;

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

@@ -75,8 +75,8 @@ impl Tau {
         Ok(ret)
     }
 
-    /// Update existing task given it's ID and some params.
-    pub async fn update(&self, ref_id: &str, task: BaseTask) -> Result<bool> {
+    /// modify existing task given it's ID and some params.
+    pub async fn modify(&self, ref_id: &str, task: BaseTask) -> Result<bool> {
         let mut params = HashMap::new();
 
         let map = |x: &String| JsonValue::String(x.clone().to_owned());
@@ -98,7 +98,7 @@ impl Tau {
         params.insert("rank".into(), rank);
 
         let req = JsonRequest::new(
-            "update",
+            "modify",
             vec![JsonValue::String(ref_id.into()), JsonValue::Object(params)],
         );
         let rep = self.rpc_client.request(req).await?;

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

@@ -65,7 +65,7 @@ impl RequestHandler for JsonRpcInterface {
         let rep = match req.method.as_str() {
             "add" => self.add(req.params).await,
             "get_ref_ids" => self.get_ref_ids(req.params).await,
-            "update" => self.update(req.params).await,
+            "modify" => self.modify(req.params).await,
             "set_state" => self.set_state(req.params).await,
             "set_comment" => self.set_comment(req.params).await,
             "get_task_by_ref_id" => self.get_task_by_ref_id(req.params).await,
@@ -279,12 +279,12 @@ impl JsonRpcInterface {
     }
 
     // RPCAPI:
-    // Update task and returns `true` upon success.
-    // --> {"jsonrpc": "2.0", "method": "update", "params": [task_id, {"title": "new title"} ], "id": 1}
+    // Modify task and returns `true` upon success.
+    // --> {"jsonrpc": "2.0", "method": "modify", "params": [task_id, {"title": "new title"} ], "id": 1}
     // <-- {"jsonrpc": "2.0", "result": true, "id": 1}
-    async fn update(&self, params: JsonValue) -> TaudResult<JsonValue> {
+    async fn modify(&self, params: JsonValue) -> TaudResult<JsonValue> {
         let params = params.get::<Vec<JsonValue>>().unwrap();
-        debug!(target: "tau", "JsonRpc::update() params {:?}", params);
+        debug!(target: "tau", "JsonRpc::modify() params {:?}", params);
 
         if params.len() != 2 || !params[0].is_string() || !params[1].is_object() {
             return Err(TaudError::InvalidData("len of params should be 2".into()))
@@ -292,7 +292,7 @@ impl JsonRpcInterface {
 
         let ws = self.workspace.lock().await.clone();
 
-        let task = self.check_params_for_update(
+        let task = self.check_params_for_modify(
             params[0].get::<String>().unwrap(),
             params[1].get::<HashMap<String, JsonValue>>().unwrap(),
             ws,
@@ -524,7 +524,7 @@ impl JsonRpcInterface {
         task.ok_or(TaudError::InvalidId)
     }
 
-    fn check_params_for_update(
+    fn check_params_for_modify(
         &self,
         task_ref_id: &str,
         fields: &HashMap<String, JsonValue>,