72 lines
1.9 KiB
Rust
72 lines
1.9 KiB
Rust
//! Copyright (C) 2022, Dmitriy Pleshevskiy <dmitriy@ideascup.me>
|
|
//!
|
|
//! tas is free software: you can redistribute it and/or modify
|
|
//! it under the terms of the GNU General Public License as published by
|
|
//! the Free Software Foundation, either version 3 of the License, or
|
|
//! (at your option) any later version.
|
|
//!
|
|
//! tas is distributed in the hope that it will be useful,
|
|
//! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
//! GNU General Public License for more details.
|
|
//!
|
|
//! You should have received a copy of the GNU General Public License
|
|
//! along with tas. If not, see <https://www.gnu.org/licenses/>.
|
|
//!
|
|
|
|
use crate::domain;
|
|
|
|
pub mod add;
|
|
pub mod edit;
|
|
pub mod finish;
|
|
pub mod list;
|
|
pub mod pause;
|
|
pub mod priority;
|
|
pub mod remove;
|
|
pub mod show;
|
|
pub mod start;
|
|
|
|
#[derive(clap::Parser)]
|
|
#[clap(author, version, about = "Experemental task manager")]
|
|
pub struct Args {
|
|
#[clap(subcommand)]
|
|
pub command: SubCommand,
|
|
}
|
|
|
|
#[derive(clap::Subcommand)]
|
|
pub enum SubCommand {
|
|
Add(self::add::Args),
|
|
Edit(self::edit::Args),
|
|
#[clap(visible_alias("rm"))]
|
|
Remove(self::remove::Args),
|
|
Priority(self::priority::Args),
|
|
#[clap(visible_alias("ls"))]
|
|
List(self::list::Args),
|
|
#[clap(visible_alias("st"))]
|
|
Start(self::start::Args),
|
|
Pause,
|
|
Finish(self::finish::Args),
|
|
#[clap(visible_alias("sh"))]
|
|
Show(self::show::Args),
|
|
}
|
|
|
|
pub fn print_task_detail(task: &domain::Task) {
|
|
print_task_detail_opt(task, " ")
|
|
}
|
|
|
|
pub fn print_task_detail_opt(task: &domain::Task, prefix: &str) {
|
|
print!("{prefix}");
|
|
if let Some(project) = task.project.as_ref() {
|
|
print!("[{}]: ", project);
|
|
}
|
|
println!("{}", task.name);
|
|
|
|
if let Some(link) = task.link.as_ref() {
|
|
println!("{prefix}link: {}", link);
|
|
}
|
|
|
|
if let Some(dir_path) = task.dir_path.as_ref() {
|
|
println!("{prefix}path: {}", dir_path.to_string_lossy());
|
|
}
|
|
}
|