From c7d5b5e52b7c91bcb1a3ba993ff6546aa62ee5f3 Mon Sep 17 00:00:00 2001 From: talwat <83217276+talwat@users.noreply.github.com> Date: Sun, 8 Sep 2024 23:24:00 +0200 Subject: [PATCH] docs: fix mistakes, and elaborate in the docs --- OTHER_PROJECTS.md | 9 +++++--- README.md | 53 +++++++++++++++++++++++++++++++++-------------- src/list.rs | 4 ++-- 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/OTHER_PROJECTS.md b/OTHER_PROJECTS.md index 39e911d..3bb79ab 100644 --- a/OTHER_PROJECTS.md +++ b/OTHER_PROJECTS.md @@ -4,11 +4,11 @@ Please note some of these might not be maintained. ## [pokemon-colorscripts](https://gitlab.com/phoneybadger/pokemon-colorscripts/) -It's changed quite a bit since I last looked at it. -It's now written in python, and many of my previous issues with it have been fixed. +It's changed quite a bit since I last looked at it, +as it is now written in python, and many of my previous issues with it have been fixed. It actually uses the same sprite database that pokeget does, which is quite cool. -It still requires the actual sprite files be on your machine, so it isn't very portable. +However, it also requires the actual sprite files be on your machine, so it isn't very portable. ## [pokeshell](https://github.com/acxz/pokeshell) @@ -19,5 +19,8 @@ Other than that, it's still extremely feature rich with animations and a lot of ## [krabby](https://github.com/yannjor/krabby) Krabby is also written in rust, but it isn't very fast and can't display multiple sprites at once. +The slowness is because it uses a full JSON API to retrieve forms and pokemon data, while pokeget +settles with simpler guesses and compromises. As a result, pokeget is much faster than Krabby by a +factor of about ~5x on an M1 Macbook. Although it has a random shiny option, which in my opinion is absolutely awesome. diff --git a/README.md b/README.md index 3adf2ec..e024f82 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,33 @@ A better rust version of pokeget. `pokeget ` -for more info, run `pokeget --help` +For more info, run `pokeget --help`. -Also, if you're using pokeget in your `.bashrc`, then instead of running `pokeget `, -you can just write the output to a file by doing: `pokeget > file.txt` and then -have something like `cat file.txt` bashrc. +### .bashrc -You can also use multiple pokemon with names: +If you're using pokeget on shell startup, such as in `.bashrc`, +then instead of running `pokeget `, you can write the output +to a file by doing: `pokeget > file.txt` +and then have something like `cat file.txt` in your bashrc. + +This makes your shell initialization practically instant, but obviously +won't work with random pokemon. pokeget is already fairly fast, +so using it on shell initialization is also not a very large bottleneck. + +### Examples + +#### Using multiple pokemon `pokeget bulbasaur pikachu random` -Or pokedex ID's: +#### Using pokedex ID's `pokeget 1 2 3` +#### Using alternative forms + +`pokeget raichu sandslash meowth --alolan` + ## Installation ### Cargo *(recommended)* @@ -57,10 +70,6 @@ mv target/release/pokeget ~/.local/bin and making sure `$HOME/.local/bin` is added to `$PATH`. -## Updating - -Just rerun `cargo install pokeget` or `git pull` on the repository and then recompile. - ### Adding a directory to $PATH #### Bash & Zsh @@ -79,12 +88,17 @@ Run this in your CLI: fish_add_path ``` +## Updating + +Just rerun `cargo install pokeget` or `git pull` on the repository and then recompile. + ## Why? -Because the first pokeget was slow, bloated, and super complicated I decided to make a better version in rust. +Because the first pokeget was slow, bloated, and super complicated, so I decided to make a better version in rust. Now, instead of precomputing all the sprites and uploading them to a repo, pokeget will -be able to compute them on the fly which makes everything much more flexible while still retaining performance. +be able to compute them on-demand which makes everything much more flexible. +Rust enables that computation to be done much more quickly than something like python. It will also draw the sprites 2x smaller by using half squares. @@ -100,10 +114,19 @@ For more info, go to [OTHER_PROJECTS.md](OTHER_PROJECTS.md). Gone. Reduced to atoms. -In all seriousness, i've just decided to not deal with them since it's extra work that I don't want to deal with. +In all seriousness, I've just decided to not deal with them since it's significantly +extra work that I don't want to deal with. They were rarely used, and looked ugly +in small terminal windows, so there was little use in keeping them. ## Credits -This time, the sprites are from [pokesprite](https://github.com/msikma/pokesprite) and pokeget uses them with a submodule. +This time, the sprites are from [pokesprite](https://github.com/msikma/pokesprite) and pokeget uses them with a git submodule. + +Sprites are embedded into the binary, so pokeget won't download them. This is a good compromise, +since while the binary may be large, pokeget can execute almost instantly and while offline. + +## License -Sprites are embedded into the binary, so pokeget won't download them. +pokeget uses the MIT license, so feel free to fork it and customize it as you please. +If you're unsure about any of the internal workings of pokeget, [open an issue](https://github.com/talwat/pokeget-rs/issues), +and I'll answer whatever question you might have. diff --git a/src/list.rs b/src/list.rs index 676a595..6fa655a 100644 --- a/src/list.rs +++ b/src/list.rs @@ -15,7 +15,7 @@ pub struct List { names: Vec, } -impl<'a> Index for List { +impl Index for List { type Output = String; fn index(&self, index: usize) -> &Self::Output { @@ -23,7 +23,7 @@ impl<'a> Index for List { } } -impl<'a> Index<&str> for List { +impl Index<&str> for List { type Output = usize; fn index(&self, index: &str) -> &Self::Output {