diff --git a/PKGBUILD b/PKGBUILD index 6d06552..2596922 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -10,6 +10,7 @@ url="https://github.com/crystal-linux/pkg-warner" license=('GPL3') source=("git+$url?rev=v0.1.0") sha256sums=('SKIP') +depends=('coreutils') makedepends=('cargo') prepare() { diff --git a/src/args.rs b/src/args.rs index 7d035d3..8bbe3ee 100644 --- a/src/args.rs +++ b/src/args.rs @@ -1,17 +1,17 @@ use clap::{ArgAction, Parser}; #[derive(Debug, Clone, Parser)] -#[clap(name=env!("CARGO_PKG_NAME"), version=env!("CARGO_PKG_VERSION"), about=env!("CARGO_PKG_DESCRIPTION"))] +#[clap(name=env!("CARGO_PKG_NAME"), version=env!("CARGO_PKG_VERSION"), about=env!("CARGO_PKG_DESCRIPTION"), ignore_errors=true)] pub struct Args { #[clap(long, short, action=ArgAction::SetTrue)] - pub init: bool, + pub init: Option, #[clap(long = "dest-dir", short)] pub dest_dir: Option, #[clap(long, action=ArgAction::SetTrue)] - pub test: bool, + pub test: Option, #[clap(long, short, action=ArgAction::SetTrue)] - pub verbose: bool, + pub verbose: Option, } diff --git a/src/internal/strings.rs b/src/internal/strings.rs index c821ef4..94bb22a 100644 --- a/src/internal/strings.rs +++ b/src/internal/strings.rs @@ -17,7 +17,7 @@ macro_rules! log { } pub fn log_fn(msg: &str) { - if crate::args::Args::parse().verbose { + if crate::args::Args::parse().verbose.unwrap_or(false) { eprintln!( "{} {}", SystemTime::now() diff --git a/src/internal/structs.rs b/src/internal/structs.rs index 6403b52..9cc05f4 100644 --- a/src/internal/structs.rs +++ b/src/internal/structs.rs @@ -1,4 +1,4 @@ pub enum AppExitCode { - Success = 1, // the correct package manager + Success = 1, // Success technically is still wrong since the user used the wrong package manager CalledDirectly = 2, } diff --git a/src/main.rs b/src/main.rs index bc7d8da..7b9564f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,13 +31,13 @@ fn main() { let dist = env!("PKG_WARNER_DISTRO").to_string(); // If --test is specified, print the warn message and exit - if args.test { + if args.test.unwrap_or(false) { warn(&bin, &dist, &pman); } // Check if the binary is called directly by the user, if so tell them off if bin == "pkg-warner" { - if args.init { + if args.init.unwrap_or(false) { init(&pkgs, args.dest_dir); } else { crash!(