Add confirmation prompts for modifications of lots of tasks

This commit is contained in:
Dustin J. Mitchell
2021-06-07 14:57:57 -04:00
parent 31ff46bee6
commit 0de4fc1dee
7 changed files with 170 additions and 24 deletions

View File

@@ -2,13 +2,14 @@
use crate::argparse::{Command, Subcommand};
use crate::settings::Settings;
use taskchampion::{Replica, Server, ServerConfig, StorageConfig, Task, Uuid};
use taskchampion::{Replica, Server, ServerConfig, StorageConfig, Uuid};
use termcolor::{ColorChoice, StandardStream};
mod cmd;
mod filter;
mod modify;
mod report;
mod util;
#[cfg(test)]
mod test;
@@ -60,7 +61,7 @@ pub(crate) fn invoke(command: Command, settings: Settings) -> Result<(), crate::
modification,
},
..
} => return cmd::modify::execute(&mut w, &mut replica, filter, modification),
} => return cmd::modify::execute(&mut w, &mut replica, &settings, filter, modification),
Command {
subcommand:
@@ -149,14 +150,3 @@ fn get_writer() -> StandardStream {
ColorChoice::Never
})
}
/// Summarize a task in a single line
fn summarize_task(replica: &mut Replica, task: &Task) -> anyhow::Result<String> {
let ws = replica.working_set()?;
let uuid = task.get_uuid();
if let Some(id) = ws.by_uuid(uuid) {
Ok(format!("{} - {}", id, task.get_description()))
} else {
Ok(format!("{} - {}", uuid, task.get_description()))
}
}