tas/src/cli/pause.rs

26 lines
758 B
Rust

use crate::repo::{self, Repository};
pub fn execute(repo: impl Repository) {
let task = match repo.stop_task() {
Err(repo::Error::NotFound) => {
return eprintln!("You can use the pause subcommand only when you have an active task")
}
Err(err) => {
return eprintln!("Cannot read current task: {}", err);
}
Ok(task) => task,
};
match repo.stop_task() {
Ok(_) => {
println!("The task was paused successfully");
println!(" {}", task.name);
if let Some(link) = task.link {
println!(" link: {}", link);
}
}
Err(err) => {
eprintln!("Cannot pause the task: {}", err);
}
}
}