18 lines
517 B
Rust
18 lines
517 B
Rust
use crate::cli::print_task_detail;
|
|
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,
|
|
};
|
|
|
|
println!("The task was paused successfully");
|
|
print_task_detail(&task);
|
|
}
|