tas/src/main.rs
2022-08-18 11:37:52 +03:00

72 lines
2.1 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/>.
//!
//---------------------------------------------------------------------
// Rustc lints
#![deny(
unused_imports,
unused_qualifications,
rust_2018_idioms,
unsafe_code,
non_ascii_idents
)]
// Clippy lints
#![deny(clippy::all)]
//---------------------------------------------------------------------
use clap::Parser;
use repo::fs::FsRepo;
use xdg::BaseDirectories;
mod cli;
pub mod domain;
pub mod repo;
fn main() {
let args = cli::Args::parse();
let xdg_dirs = BaseDirectories::with_prefix(env!("CARGO_PKG_NAME")).unwrap();
let repo = FsRepo::new(xdg_dirs);
match args.command {
cli::SubCommand::Add(args) => {
cli::add::execute(repo, args);
}
cli::SubCommand::Edit(args) => {
cli::edit::execute(repo, args);
}
cli::SubCommand::Remove(args) => {
cli::remove::execute(repo, args);
}
cli::SubCommand::List => {
cli::list::execute(repo);
}
cli::SubCommand::Priority(args) => {
cli::priority::execute(repo, args);
}
cli::SubCommand::Start(args) => {
cli::start::execute(repo, args);
}
cli::SubCommand::Pause => {
cli::pause::execute(repo);
}
cli::SubCommand::Finish(args) => {
cli::finish::execute(repo, args);
}
cli::SubCommand::Show(args) => {
cli::show::execute(repo, args);
}
}
}