From 6bcc0bc4679d27ddd37d0aadc09a850bb61d0a01 Mon Sep 17 00:00:00 2001 From: michal Date: Tue, 18 Jan 2022 23:53:21 +0000 Subject: [PATCH] initial commit --- .gitignore | 2 ++ Cargo.toml | 14 ++++++++++++ src/main.rs | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a0038a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +.idea \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..8980836 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "Malachite" +version = "0.1.0" +authors = [ "michal " ] +edition = "2021" +description = "Packaging tool for pacman repositories" +license-file = "LICENSE.md" + +[[bin]] +name = "mlc" +path = "src/main.rs" + +[dependencies] +clap = { version = "2.34.0", default-features = false } diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..6c9600e --- /dev/null +++ b/src/main.rs @@ -0,0 +1,62 @@ +use clap::{App, AppSettings, Arg, ArgSettings, SubCommand}; + +fn main() { + fn build_app() -> App<'static, 'static> { + let app = App::new("Malachite") + .version(env!("CARGO_PKG_VERSION")) + .about(env!("CARGO_PKG_DESCRIPTION")) + .arg( + Arg::with_name("verbose") + .short("v") + .long("verbose") + .multiple(true) + .set(ArgSettings::Global) + .help("Sets the level of verbosity") + ) + .arg( + Arg::with_name("exclude") + .short("e") + .long("exclude") + .multiple(true) + .set(ArgSettings::Global) + .help("Excludes packages from given operation") + ) + .arg( + Arg::with_name("all") + .long("all") + .set(ArgSettings::Global) + .help("Operates on every possible package") + ) + .subcommand( + SubCommand::with_name("build") + .about("Builds the given packages") + .arg( + Arg::with_name("package(s)") + .help("The packages to operate on") + .required(true) + .multiple(true) + .index(1), + ) + ) + .subcommand( + SubCommand::with_name("prune") + .about("Prunes duplicate packages older than X days from the repository") + .arg( + Arg::with_name("days") + .help("How old a duplicate package needs to be (in days) to be pruned") + .required(true) + .index(1) + ) + ) + .settings(&[ + AppSettings::GlobalVersion, + AppSettings::VersionlessSubcommands, + AppSettings::ArgRequiredElseHelp, + AppSettings::InferSubcommands + ]); + app + } + + let matches = build_app().get_matches(); + +}