Skip to content

Commit

Permalink
Use clap directly
Browse files Browse the repository at this point in the history
  • Loading branch information
szeweq committed May 13, 2024
1 parent 293326c commit 48978b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 1 addition & 8 deletions src/bin/mc-repack/cli_args.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::path::PathBuf;


#[derive(Debug, clap::Parser)]
#[command(version)]
pub struct Args {
Expand All @@ -18,14 +19,6 @@ pub struct Args {
#[arg(short = 'b', long)]
pub use_blacklist: bool
}

impl Args {
#[inline]
pub fn env() -> Self {
use clap::Parser;
Self::parse()
}
}
pub struct RepackOpts {
pub silent: bool,
pub use_blacklist: bool
Expand Down
4 changes: 2 additions & 2 deletions src/bin/mc-repack/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{fs, io, path::{PathBuf, Path}, thread::{self, JoinHandle}, any::Any, ffi::OsString};

use clap::Parser;
use cli_args::RepackOpts;
use crossbeam_channel::Sender;
use indicatif::{ProgressBar, ProgressStyle, MultiProgress};
Expand All @@ -16,7 +16,7 @@ type Error_ = anyhow::Error;
type Result_<T> = Result<T, Error_>;

fn main() -> Result_<()> {
let args = cli_args::Args::env();
let args = cli_args::Args::parse();
println!("█▀▄▀█ █▀▀ ▄▄ █▀█ █▀▀ █▀█ ▄▀█ █▀▀ █▄▀\n█ ▀ █ █▄▄ █▀▄ ██▄ █▀▀ █▀█ █▄▄ █ █ by Szeweq (https://szeweq.xyz/mc-repack)\n");

let path = &args.path;
Expand Down

0 comments on commit 48978b2

Please sign in to comment.