Fixed issue with arguments after package manager

main
Michal 2 years ago
parent 66c34661bd
commit f948c28287
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -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() {

@ -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<bool>,
#[clap(long = "dest-dir", short)]
pub dest_dir: Option<String>,
#[clap(long, action=ArgAction::SetTrue)]
pub test: bool,
pub test: Option<bool>,
#[clap(long, short, action=ArgAction::SetTrue)]
pub verbose: bool,
pub verbose: Option<bool>,
}

@ -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()

@ -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,
}

@ -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!(

Loading…
Cancel
Save