tas/src/cli/finish.rs

18 lines
563 B
Rust

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