From ae45871a575b8266faa554d0a305f19756c9e870 Mon Sep 17 00:00:00 2001 From: Vomitblood Date: Mon, 22 Apr 2024 08:49:17 +0800 Subject: [PATCH] cleaned up print.rs --- build/arch/PKGBUILD | 8 ++++---- src/print.rs | 23 ----------------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/build/arch/PKGBUILD b/build/arch/PKGBUILD index c420d16..96ac2f7 100644 --- a/build/arch/PKGBUILD +++ b/build/arch/PKGBUILD @@ -3,12 +3,12 @@ pkgname=rustmon-git pkgdesc="Pokemon Colorscripts written in Rust" _gitname=rustmon -pkgver=r40.fce6c7b +pkgver=r41.bc2beb1 pkgrel=1 arch=('x86_64') url="https://github.com/Vomitblood/$_gitname" license=('GPL') -depends=('glibc' 'gcc-libs') +depends=('glibc' 'gcc-libs' 'base-devel') makedepends=('git' 'cargo') provides=("$_gitname") source=("git+$url.git") @@ -24,13 +24,13 @@ pkgver() { build() { cd "$srcdir/$_gitname" # build main program - cargo build --release + cargo build --release --bin rustmon # build mini program cargo build --release --bin minimon } package() { cd "$srcdir/$_gitname" - install -Dm755 target/release/$_gitname "$pkgdir/usr/bin/$_gitname" + install -Dm755 target/release/rustmon "$pkgdir/usr/bin/rustmon" install -Dm755 target/release/minimon "$pkgdir/usr/bin/minimon" } diff --git a/src/print.rs b/src/print.rs index a1d362c..faae857 100644 --- a/src/print.rs +++ b/src/print.rs @@ -120,29 +120,6 @@ fn get_pokemon_data(pokedex_number: u16) -> crate::structs::Pokemon { return pokemon_data; } -fn find_pokemon_by_pokedex( - pokedex_number_string: &str, -) -> Result> { - // handle random - if pokedex_number_string == "0" { - return Ok("random".to_string()); - } else { - // read the file - let mut file = std::fs::File::open(crate::constants::DATA_DIRECTORY.join("pokemon.json"))?; - let mut contents = String::new(); - file.read_to_string(&mut contents)?; - - // deserialize into the struct - let pokemons: Vec = serde_json::from_str(&contents)?; - - let pokedex_number = pokedex_number_string.parse::().unwrap(); - - let pokemon_data = pokemons.get(pokedex_number).unwrap(); - - return Ok(pokemon_data.name.clone()); - } -} - fn find_pokedex_by_pokemon(pokemon_name: &str) -> Result> { // handle random if pokemon_name == "random" {