ghassmo 4 лет назад
Родитель
Сommit
702305bbf0
2 измененных файлов с 5 добавлено и 10 удалено
  1. 1 1
      bin/taud/Cargo.toml
  2. 4 9
      bin/taud/src/main.rs

+ 1 - 1
bin/taud/Cargo.toml

@@ -19,7 +19,7 @@ async-channel = "1.6.1"
 async-executor = "1.4.1"
 
 # Misc
-clap = {version = "3.0.7", features = ["derive"]}
+clap = {version = "3.1.6", features = ["derive"]}
 log = "0.4.14"
 num_cpus = "1.13.1"
 simplelog = "0.11.2"

+ 4 - 9
bin/taud/src/main.rs

@@ -202,7 +202,7 @@ impl JsonRpcInterface {
             Err(e) => return JsonResult::Err(jsonerr(InternalError, Some(e.to_string()), id)),
         }
 
-        let mut result = || -> std::result::Result<(), &str> {
+        let mut result = || -> std::result::Result<(), String> {
             if data.contains_key("title") {
                 let title = data
                     .get("title")
@@ -271,9 +271,8 @@ impl JsonRpcInterface {
 
             let save = task.save();
 
-            // TODO print the error
-            if let Err(_e) = save {
-                return Err("Unable to save the task")
+            if let Err(e) = save {
+                return Err(format!("Unable to save the task: {}", e))
             }
 
             Ok(())
@@ -313,10 +312,6 @@ impl JsonRpcInterface {
     // --> {"jsonrpc": "2.0", "method": "set_state", "params": [task_id, state], "id": 1}
     // <-- {"jsonrpc": "2.0", "result": true, "id": 1}
     async fn set_state(&self, id: Value, params: Value) -> JsonResult {
-        //
-        // TODO remove from MonthTasks
-        //
-
         let args = params.as_array().unwrap();
 
         if !args[0].is_u64() {
@@ -438,7 +433,7 @@ async fn start(config: TauConfig, executor: Arc<Executor<'_>>) -> Result<()> {
 #[async_std::main]
 async fn main() -> Result<()> {
     let args = CliTaud::parse();
-    let matches = CliTaud::into_app().get_matches();
+    let matches = CliTaud::command().get_matches();
 
     let config_path = if args.config.is_some() {
         expand_path(&args.config.unwrap())?