├── .github └── workflows │ └── rust.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── docs └── assets │ ├── 2025-02-11 00-03-13.mkv │ ├── demo.gif │ └── snapshot_2025-02-24_00-28-16.png ├── flake.lock ├── flake.nix ├── resources └── english.txt └── src ├── config ├── config_tables │ ├── cursor_style.rs │ ├── graph_colors.rs │ ├── language.rs │ ├── mod.rs │ ├── mode_settings.rs │ └── theme.rs ├── config_utils.rs ├── mod.rs └── toml_parser.rs ├── main.rs ├── mode ├── mod.rs └── mode_selector.rs ├── scores ├── finish_overview.rs ├── graph.rs ├── mod.rs ├── progress │ ├── data.rs │ ├── display.rs │ └── mod.rs └── stats.rs ├── terminal ├── game.rs ├── keyboard.rs ├── mod.rs └── terminal_utils.rs └── word_provider ├── finder.rs └── mod.rs /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Build 20 | run: cargo build --verbose 21 | - name: Run tests 22 | run: cargo test --verbose 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Prerequisites 3 | *.d 4 | 5 | # Compiled Object files 6 | *.slo 7 | *.lo 8 | *.o 9 | *.obj 10 | 11 | # Precompiled Headers 12 | *.gch 13 | *.pch 14 | 15 | # Compiled Dynamic libraries 16 | *.so 17 | *.dylib 18 | *.dll 19 | 20 | # Fortran module files 21 | *.mod 22 | *.smod 23 | 24 | # Compiled Static libraries 25 | *.lai 26 | *.la 27 | *.a 28 | *.lib 29 | 30 | # Executables 31 | *.exe 32 | *.out 33 | *.app 34 | 35 | # CMake GitIgnore 36 | 37 | CMakeLists.txt.user 38 | CMakeCache.txt 39 | CMakeFiles 40 | CMakeScripts 41 | Testing 42 | Makefile 43 | cmake_install.cmake 44 | install_manifest.txt 45 | compile_commands.json 46 | CTestTestfile.cmake 47 | _deps 48 | 49 | # Exclude Out Folder - As Everything there is compiled using CMake 50 | build/ 51 | target/ 52 | 53 | # IDE Specific 54 | .vscode/ 55 | .idea/ 56 | .cache/ 57 | 58 | [Oo][Uu][Tt] 59 | 60 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributing to typy 3 | 4 | First off, thanks for taking the time to contribute! ❤️ 5 | 6 | All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 7 | 8 | > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: 9 | > - Star the project 10 | > - Tweet about it 11 | > - Refer this project in your project's readme 12 | > - Mention the project at local meetups and tell your friends/colleagues 13 | 14 | 15 | ## Table of Contents 16 | 17 | - [Code of Conduct](#code-of-conduct) 18 | - [I Have a Question](#i-have-a-question) 19 | - [I Want To Contribute](#i-want-to-contribute) 20 | - [Reporting Bugs](#reporting-bugs) 21 | - [Suggesting Enhancements](#suggesting-enhancements) 22 | - [Your First Code Contribution](#your-first-code-contribution) 23 | - [Improving The Documentation](#improving-the-documentation) 24 | - [Styleguides](#styleguides) 25 | - [Commit Messages](#commit-messages) 26 | 27 | 28 | ## Code of Conduct 29 | 30 | This project and everyone participating in it is governed by the 31 | [typy Code of Conduct](https://github.com/Pazl27/typy-cli/blob/master/CODE_OF_CONDUCT.md). 32 | By participating, you are expected to uphold this code. Please report unacceptable behavior 33 | to Pazl27. 34 | 35 | 36 | ## I Have a Question 37 | 38 | > If you want to ask a question, we assume that you have read the available [Documentation](). 39 | 40 | Before you ask a question, it is best to search for existing [Issues](https://github.com/Pazl27/typy-cli/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. 41 | 42 | If you then still feel the need to ask a question and need clarification, we recommend the following: 43 | 44 | - Open an [Issue](https://github.com/Pazl27/typy-cli/issues/new). 45 | - Provide as much context as you can about what you're running into. 46 | - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. 47 | 48 | We will then take care of the issue as soon as possible. 49 | 50 | 64 | 65 | ## I Want To Contribute 66 | 67 | > ### Legal Notice 68 | > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project licence. 69 | 70 | ### Reporting Bugs 71 | 72 | 73 | #### Before Submitting a Bug Report 74 | 75 | A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. 76 | 77 | - Make sure that you are using the latest version. 78 | - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)). 79 | - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/Pazl27/typy-cli/issues?q=label%3Abug). 80 | - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. 81 | - Collect information about the bug: 82 | - Stack trace (Traceback) 83 | - OS, Platform and Version (Windows, Linux, macOS, x86, ARM) 84 | - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. 85 | - Possibly your input and the output 86 | - Can you reliably reproduce the issue? And can you also reproduce it with older versions? 87 | 88 | 89 | #### How Do I Submit a Good Bug Report? 90 | 91 | > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>. 92 | 93 | 94 | We use GitHub issues to track bugs and errors. If you run into an issue with the project: 95 | 96 | - Open an [Issue](https://github.com/Pazl27/typy-cli/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) 97 | - Explain the behavior you would expect and the actual behavior. 98 | - Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. 99 | - Provide the information you collected in the previous section. 100 | 101 | Once it's filed: 102 | 103 | - The project team will label the issue accordingly. 104 | - A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. 105 | - If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). 106 | 107 | 108 | 109 | 110 | ### Suggesting Enhancements 111 | 112 | This section guides you through submitting an enhancement suggestion for typy, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. 113 | 114 | 115 | #### Before Submitting an Enhancement 116 | 117 | - Make sure that you are using the latest version. 118 | - Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration. 119 | - Perform a [search](https://github.com/Pazl27/typy-cli/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. 120 | - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. 121 | 122 | 123 | #### How Do I Submit a Good Enhancement Suggestion? 124 | 125 | Enhancement suggestions are tracked as [GitHub issues](https://github.com/Pazl27/typy-cli/issues). 126 | 127 | - Use a **clear and descriptive title** for the issue to identify the suggestion. 128 | - Provide a **step-by-step description of the suggested enhancement** in as many details as possible. 129 | - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. 130 | - You may want to **include screenshots or screen recordings** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [LICEcap](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and the built-in [screen recorder in GNOME](https://help.gnome.org/users/gnome-help/stable/screen-shot-record.html.en) or [SimpleScreenRecorder](https://github.com/MaartenBaert/ssr) on Linux. 131 | - **Explain why this enhancement would be useful** to most typy users. You may also want to point out the other projects that solved it better and which could serve as inspiration. 132 | 133 | 134 | 135 | ### Your First Code Contribution 136 | 139 | You only need cargo to run this project and a terminal emulator like kitty etc. 140 | 141 | ## Styleguides 142 | ### Commit Messages 143 | 145 | Short discription what the goal of this commit was. 146 | 147 | 148 | ## Attribution 149 | This guide is based on the [contributing.md](https://contributing.md/generator)! 150 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.24.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler2" 16 | version = "2.0.0" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 19 | 20 | [[package]] 21 | name = "android-tzdata" 22 | version = "0.1.1" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" 25 | 26 | [[package]] 27 | name = "android_system_properties" 28 | version = "0.1.5" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 31 | dependencies = [ 32 | "libc", 33 | ] 34 | 35 | [[package]] 36 | name = "anstream" 37 | version = "0.6.18" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" 40 | dependencies = [ 41 | "anstyle", 42 | "anstyle-parse", 43 | "anstyle-query", 44 | "anstyle-wincon", 45 | "colorchoice", 46 | "is_terminal_polyfill", 47 | "utf8parse", 48 | ] 49 | 50 | [[package]] 51 | name = "anstyle" 52 | version = "1.0.10" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" 55 | 56 | [[package]] 57 | name = "anstyle-parse" 58 | version = "0.2.6" 59 | source = "registry+https://github.com/rust-lang/crates.io-index" 60 | checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" 61 | dependencies = [ 62 | "utf8parse", 63 | ] 64 | 65 | [[package]] 66 | name = "anstyle-query" 67 | version = "1.1.2" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" 70 | dependencies = [ 71 | "windows-sys 0.59.0", 72 | ] 73 | 74 | [[package]] 75 | name = "anstyle-wincon" 76 | version = "3.0.7" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" 79 | dependencies = [ 80 | "anstyle", 81 | "once_cell", 82 | "windows-sys 0.59.0", 83 | ] 84 | 85 | [[package]] 86 | name = "anyhow" 87 | version = "1.0.95" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" 90 | 91 | [[package]] 92 | name = "atomic-waker" 93 | version = "1.1.2" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" 96 | 97 | [[package]] 98 | name = "autocfg" 99 | version = "1.4.0" 100 | source = "registry+https://github.com/rust-lang/crates.io-index" 101 | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" 102 | 103 | [[package]] 104 | name = "backtrace" 105 | version = "0.3.74" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" 108 | dependencies = [ 109 | "addr2line", 110 | "cfg-if", 111 | "libc", 112 | "miniz_oxide", 113 | "object", 114 | "rustc-demangle", 115 | "windows-targets 0.52.6", 116 | ] 117 | 118 | [[package]] 119 | name = "base64" 120 | version = "0.22.1" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 123 | 124 | [[package]] 125 | name = "bitflags" 126 | version = "1.3.2" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 129 | 130 | [[package]] 131 | name = "bitflags" 132 | version = "2.8.0" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" 135 | 136 | [[package]] 137 | name = "bumpalo" 138 | version = "3.17.0" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" 141 | 142 | [[package]] 143 | name = "byteorder" 144 | version = "1.5.0" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 147 | 148 | [[package]] 149 | name = "bytes" 150 | version = "1.10.0" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9" 153 | 154 | [[package]] 155 | name = "cassowary" 156 | version = "0.3.0" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" 159 | 160 | [[package]] 161 | name = "cc" 162 | version = "1.2.15" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af" 165 | dependencies = [ 166 | "shlex", 167 | ] 168 | 169 | [[package]] 170 | name = "cfg-if" 171 | version = "1.0.0" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 174 | 175 | [[package]] 176 | name = "chrono" 177 | version = "0.4.39" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" 180 | dependencies = [ 181 | "android-tzdata", 182 | "iana-time-zone", 183 | "js-sys", 184 | "num-traits", 185 | "serde", 186 | "wasm-bindgen", 187 | "windows-targets 0.52.6", 188 | ] 189 | 190 | [[package]] 191 | name = "clap" 192 | version = "4.5.30" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "92b7b18d71fad5313a1e320fa9897994228ce274b60faa4d694fe0ea89cd9e6d" 195 | dependencies = [ 196 | "clap_builder", 197 | "clap_derive", 198 | ] 199 | 200 | [[package]] 201 | name = "clap_builder" 202 | version = "4.5.30" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "a35db2071778a7344791a4fb4f95308b5673d219dee3ae348b86642574ecc90c" 205 | dependencies = [ 206 | "anstream", 207 | "anstyle", 208 | "clap_lex", 209 | "strsim", 210 | ] 211 | 212 | [[package]] 213 | name = "clap_derive" 214 | version = "4.5.28" 215 | source = "registry+https://github.com/rust-lang/crates.io-index" 216 | checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed" 217 | dependencies = [ 218 | "heck", 219 | "proc-macro2", 220 | "quote", 221 | "syn", 222 | ] 223 | 224 | [[package]] 225 | name = "clap_lex" 226 | version = "0.7.4" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" 229 | 230 | [[package]] 231 | name = "colorchoice" 232 | version = "1.0.3" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" 235 | 236 | [[package]] 237 | name = "comfy-table" 238 | version = "7.1.4" 239 | source = "registry+https://github.com/rust-lang/crates.io-index" 240 | checksum = "4a65ebfec4fb190b6f90e944a817d60499ee0744e582530e2c9900a22e591d9a" 241 | dependencies = [ 242 | "crossterm 0.28.1", 243 | "unicode-segmentation", 244 | "unicode-width 0.2.0", 245 | ] 246 | 247 | [[package]] 248 | name = "core-foundation" 249 | version = "0.9.4" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 252 | dependencies = [ 253 | "core-foundation-sys", 254 | "libc", 255 | ] 256 | 257 | [[package]] 258 | name = "core-foundation-sys" 259 | version = "0.8.7" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" 262 | 263 | [[package]] 264 | name = "crossterm" 265 | version = "0.25.0" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" 268 | dependencies = [ 269 | "bitflags 1.3.2", 270 | "crossterm_winapi", 271 | "libc", 272 | "mio 0.8.11", 273 | "parking_lot", 274 | "signal-hook", 275 | "signal-hook-mio", 276 | "winapi", 277 | ] 278 | 279 | [[package]] 280 | name = "crossterm" 281 | version = "0.28.1" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" 284 | dependencies = [ 285 | "bitflags 2.8.0", 286 | "crossterm_winapi", 287 | "mio 1.0.3", 288 | "parking_lot", 289 | "rustix", 290 | "signal-hook", 291 | "signal-hook-mio", 292 | "winapi", 293 | ] 294 | 295 | [[package]] 296 | name = "crossterm_winapi" 297 | version = "0.9.1" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" 300 | dependencies = [ 301 | "winapi", 302 | ] 303 | 304 | [[package]] 305 | name = "dirs" 306 | version = "6.0.0" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" 309 | dependencies = [ 310 | "dirs-sys", 311 | ] 312 | 313 | [[package]] 314 | name = "dirs-sys" 315 | version = "0.5.0" 316 | source = "registry+https://github.com/rust-lang/crates.io-index" 317 | checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" 318 | dependencies = [ 319 | "libc", 320 | "option-ext", 321 | "redox_users", 322 | "windows-sys 0.59.0", 323 | ] 324 | 325 | [[package]] 326 | name = "displaydoc" 327 | version = "0.2.5" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" 330 | dependencies = [ 331 | "proc-macro2", 332 | "quote", 333 | "syn", 334 | ] 335 | 336 | [[package]] 337 | name = "encoding_rs" 338 | version = "0.8.35" 339 | source = "registry+https://github.com/rust-lang/crates.io-index" 340 | checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" 341 | dependencies = [ 342 | "cfg-if", 343 | ] 344 | 345 | [[package]] 346 | name = "equivalent" 347 | version = "1.0.1" 348 | source = "registry+https://github.com/rust-lang/crates.io-index" 349 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 350 | 351 | [[package]] 352 | name = "errno" 353 | version = "0.3.10" 354 | source = "registry+https://github.com/rust-lang/crates.io-index" 355 | checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" 356 | dependencies = [ 357 | "libc", 358 | "windows-sys 0.59.0", 359 | ] 360 | 361 | [[package]] 362 | name = "fastrand" 363 | version = "2.3.0" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 366 | 367 | [[package]] 368 | name = "fnv" 369 | version = "1.0.7" 370 | source = "registry+https://github.com/rust-lang/crates.io-index" 371 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 372 | 373 | [[package]] 374 | name = "foreign-types" 375 | version = "0.3.2" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 378 | dependencies = [ 379 | "foreign-types-shared", 380 | ] 381 | 382 | [[package]] 383 | name = "foreign-types-shared" 384 | version = "0.1.1" 385 | source = "registry+https://github.com/rust-lang/crates.io-index" 386 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 387 | 388 | [[package]] 389 | name = "form_urlencoded" 390 | version = "1.2.1" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 393 | dependencies = [ 394 | "percent-encoding", 395 | ] 396 | 397 | [[package]] 398 | name = "futures-channel" 399 | version = "0.3.31" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" 402 | dependencies = [ 403 | "futures-core", 404 | "futures-sink", 405 | ] 406 | 407 | [[package]] 408 | name = "futures-core" 409 | version = "0.3.31" 410 | source = "registry+https://github.com/rust-lang/crates.io-index" 411 | checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 412 | 413 | [[package]] 414 | name = "futures-io" 415 | version = "0.3.31" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" 418 | 419 | [[package]] 420 | name = "futures-sink" 421 | version = "0.3.31" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 424 | 425 | [[package]] 426 | name = "futures-task" 427 | version = "0.3.31" 428 | source = "registry+https://github.com/rust-lang/crates.io-index" 429 | checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 430 | 431 | [[package]] 432 | name = "futures-util" 433 | version = "0.3.31" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 436 | dependencies = [ 437 | "futures-core", 438 | "futures-io", 439 | "futures-sink", 440 | "futures-task", 441 | "memchr", 442 | "pin-project-lite", 443 | "pin-utils", 444 | "slab", 445 | ] 446 | 447 | [[package]] 448 | name = "getrandom" 449 | version = "0.2.15" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 452 | dependencies = [ 453 | "cfg-if", 454 | "libc", 455 | "wasi 0.11.0+wasi-snapshot-preview1", 456 | ] 457 | 458 | [[package]] 459 | name = "getrandom" 460 | version = "0.3.1" 461 | source = "registry+https://github.com/rust-lang/crates.io-index" 462 | checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" 463 | dependencies = [ 464 | "cfg-if", 465 | "libc", 466 | "wasi 0.13.3+wasi-0.2.2", 467 | "windows-targets 0.52.6", 468 | ] 469 | 470 | [[package]] 471 | name = "gimli" 472 | version = "0.31.1" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" 475 | 476 | [[package]] 477 | name = "h2" 478 | version = "0.4.8" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" 481 | dependencies = [ 482 | "atomic-waker", 483 | "bytes", 484 | "fnv", 485 | "futures-core", 486 | "futures-sink", 487 | "http", 488 | "indexmap", 489 | "slab", 490 | "tokio", 491 | "tokio-util", 492 | "tracing", 493 | ] 494 | 495 | [[package]] 496 | name = "hashbrown" 497 | version = "0.15.2" 498 | source = "registry+https://github.com/rust-lang/crates.io-index" 499 | checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" 500 | 501 | [[package]] 502 | name = "heck" 503 | version = "0.5.0" 504 | source = "registry+https://github.com/rust-lang/crates.io-index" 505 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 506 | 507 | [[package]] 508 | name = "http" 509 | version = "1.2.0" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" 512 | dependencies = [ 513 | "bytes", 514 | "fnv", 515 | "itoa", 516 | ] 517 | 518 | [[package]] 519 | name = "http-body" 520 | version = "1.0.1" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" 523 | dependencies = [ 524 | "bytes", 525 | "http", 526 | ] 527 | 528 | [[package]] 529 | name = "http-body-util" 530 | version = "0.1.2" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" 533 | dependencies = [ 534 | "bytes", 535 | "futures-util", 536 | "http", 537 | "http-body", 538 | "pin-project-lite", 539 | ] 540 | 541 | [[package]] 542 | name = "httparse" 543 | version = "1.10.0" 544 | source = "registry+https://github.com/rust-lang/crates.io-index" 545 | checksum = "f2d708df4e7140240a16cd6ab0ab65c972d7433ab77819ea693fde9c43811e2a" 546 | 547 | [[package]] 548 | name = "hyper" 549 | version = "1.6.0" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" 552 | dependencies = [ 553 | "bytes", 554 | "futures-channel", 555 | "futures-util", 556 | "h2", 557 | "http", 558 | "http-body", 559 | "httparse", 560 | "itoa", 561 | "pin-project-lite", 562 | "smallvec", 563 | "tokio", 564 | "want", 565 | ] 566 | 567 | [[package]] 568 | name = "hyper-rustls" 569 | version = "0.27.5" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" 572 | dependencies = [ 573 | "futures-util", 574 | "http", 575 | "hyper", 576 | "hyper-util", 577 | "rustls", 578 | "rustls-pki-types", 579 | "tokio", 580 | "tokio-rustls", 581 | "tower-service", 582 | ] 583 | 584 | [[package]] 585 | name = "hyper-tls" 586 | version = "0.6.0" 587 | source = "registry+https://github.com/rust-lang/crates.io-index" 588 | checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" 589 | dependencies = [ 590 | "bytes", 591 | "http-body-util", 592 | "hyper", 593 | "hyper-util", 594 | "native-tls", 595 | "tokio", 596 | "tokio-native-tls", 597 | "tower-service", 598 | ] 599 | 600 | [[package]] 601 | name = "hyper-util" 602 | version = "0.1.10" 603 | source = "registry+https://github.com/rust-lang/crates.io-index" 604 | checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" 605 | dependencies = [ 606 | "bytes", 607 | "futures-channel", 608 | "futures-util", 609 | "http", 610 | "http-body", 611 | "hyper", 612 | "pin-project-lite", 613 | "socket2", 614 | "tokio", 615 | "tower-service", 616 | "tracing", 617 | ] 618 | 619 | [[package]] 620 | name = "iana-time-zone" 621 | version = "0.1.61" 622 | source = "registry+https://github.com/rust-lang/crates.io-index" 623 | checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" 624 | dependencies = [ 625 | "android_system_properties", 626 | "core-foundation-sys", 627 | "iana-time-zone-haiku", 628 | "js-sys", 629 | "wasm-bindgen", 630 | "windows-core", 631 | ] 632 | 633 | [[package]] 634 | name = "iana-time-zone-haiku" 635 | version = "0.1.2" 636 | source = "registry+https://github.com/rust-lang/crates.io-index" 637 | checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" 638 | dependencies = [ 639 | "cc", 640 | ] 641 | 642 | [[package]] 643 | name = "icu_collections" 644 | version = "1.5.0" 645 | source = "registry+https://github.com/rust-lang/crates.io-index" 646 | checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" 647 | dependencies = [ 648 | "displaydoc", 649 | "yoke", 650 | "zerofrom", 651 | "zerovec", 652 | ] 653 | 654 | [[package]] 655 | name = "icu_locid" 656 | version = "1.5.0" 657 | source = "registry+https://github.com/rust-lang/crates.io-index" 658 | checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" 659 | dependencies = [ 660 | "displaydoc", 661 | "litemap", 662 | "tinystr", 663 | "writeable", 664 | "zerovec", 665 | ] 666 | 667 | [[package]] 668 | name = "icu_locid_transform" 669 | version = "1.5.0" 670 | source = "registry+https://github.com/rust-lang/crates.io-index" 671 | checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" 672 | dependencies = [ 673 | "displaydoc", 674 | "icu_locid", 675 | "icu_locid_transform_data", 676 | "icu_provider", 677 | "tinystr", 678 | "zerovec", 679 | ] 680 | 681 | [[package]] 682 | name = "icu_locid_transform_data" 683 | version = "1.5.0" 684 | source = "registry+https://github.com/rust-lang/crates.io-index" 685 | checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" 686 | 687 | [[package]] 688 | name = "icu_normalizer" 689 | version = "1.5.0" 690 | source = "registry+https://github.com/rust-lang/crates.io-index" 691 | checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" 692 | dependencies = [ 693 | "displaydoc", 694 | "icu_collections", 695 | "icu_normalizer_data", 696 | "icu_properties", 697 | "icu_provider", 698 | "smallvec", 699 | "utf16_iter", 700 | "utf8_iter", 701 | "write16", 702 | "zerovec", 703 | ] 704 | 705 | [[package]] 706 | name = "icu_normalizer_data" 707 | version = "1.5.0" 708 | source = "registry+https://github.com/rust-lang/crates.io-index" 709 | checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" 710 | 711 | [[package]] 712 | name = "icu_properties" 713 | version = "1.5.1" 714 | source = "registry+https://github.com/rust-lang/crates.io-index" 715 | checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" 716 | dependencies = [ 717 | "displaydoc", 718 | "icu_collections", 719 | "icu_locid_transform", 720 | "icu_properties_data", 721 | "icu_provider", 722 | "tinystr", 723 | "zerovec", 724 | ] 725 | 726 | [[package]] 727 | name = "icu_properties_data" 728 | version = "1.5.0" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" 731 | 732 | [[package]] 733 | name = "icu_provider" 734 | version = "1.5.0" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" 737 | dependencies = [ 738 | "displaydoc", 739 | "icu_locid", 740 | "icu_provider_macros", 741 | "stable_deref_trait", 742 | "tinystr", 743 | "writeable", 744 | "yoke", 745 | "zerofrom", 746 | "zerovec", 747 | ] 748 | 749 | [[package]] 750 | name = "icu_provider_macros" 751 | version = "1.5.0" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" 754 | dependencies = [ 755 | "proc-macro2", 756 | "quote", 757 | "syn", 758 | ] 759 | 760 | [[package]] 761 | name = "idna" 762 | version = "1.0.3" 763 | source = "registry+https://github.com/rust-lang/crates.io-index" 764 | checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" 765 | dependencies = [ 766 | "idna_adapter", 767 | "smallvec", 768 | "utf8_iter", 769 | ] 770 | 771 | [[package]] 772 | name = "idna_adapter" 773 | version = "1.2.0" 774 | source = "registry+https://github.com/rust-lang/crates.io-index" 775 | checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" 776 | dependencies = [ 777 | "icu_normalizer", 778 | "icu_properties", 779 | ] 780 | 781 | [[package]] 782 | name = "indexmap" 783 | version = "2.7.1" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" 786 | dependencies = [ 787 | "equivalent", 788 | "hashbrown", 789 | ] 790 | 791 | [[package]] 792 | name = "ipnet" 793 | version = "2.11.0" 794 | source = "registry+https://github.com/rust-lang/crates.io-index" 795 | checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" 796 | 797 | [[package]] 798 | name = "is_terminal_polyfill" 799 | version = "1.70.1" 800 | source = "registry+https://github.com/rust-lang/crates.io-index" 801 | checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 802 | 803 | [[package]] 804 | name = "itoa" 805 | version = "1.0.14" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" 808 | 809 | [[package]] 810 | name = "js-sys" 811 | version = "0.3.77" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" 814 | dependencies = [ 815 | "once_cell", 816 | "wasm-bindgen", 817 | ] 818 | 819 | [[package]] 820 | name = "lazy_static" 821 | version = "1.5.0" 822 | source = "registry+https://github.com/rust-lang/crates.io-index" 823 | checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 824 | 825 | [[package]] 826 | name = "libc" 827 | version = "0.2.169" 828 | source = "registry+https://github.com/rust-lang/crates.io-index" 829 | checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" 830 | 831 | [[package]] 832 | name = "libredox" 833 | version = "0.1.3" 834 | source = "registry+https://github.com/rust-lang/crates.io-index" 835 | checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" 836 | dependencies = [ 837 | "bitflags 2.8.0", 838 | "libc", 839 | ] 840 | 841 | [[package]] 842 | name = "linux-raw-sys" 843 | version = "0.4.15" 844 | source = "registry+https://github.com/rust-lang/crates.io-index" 845 | checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" 846 | 847 | [[package]] 848 | name = "litemap" 849 | version = "0.7.4" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" 852 | 853 | [[package]] 854 | name = "lock_api" 855 | version = "0.4.12" 856 | source = "registry+https://github.com/rust-lang/crates.io-index" 857 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 858 | dependencies = [ 859 | "autocfg", 860 | "scopeguard", 861 | ] 862 | 863 | [[package]] 864 | name = "log" 865 | version = "0.4.25" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" 868 | 869 | [[package]] 870 | name = "memchr" 871 | version = "2.7.4" 872 | source = "registry+https://github.com/rust-lang/crates.io-index" 873 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 874 | 875 | [[package]] 876 | name = "mime" 877 | version = "0.3.17" 878 | source = "registry+https://github.com/rust-lang/crates.io-index" 879 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 880 | 881 | [[package]] 882 | name = "miniz_oxide" 883 | version = "0.8.5" 884 | source = "registry+https://github.com/rust-lang/crates.io-index" 885 | checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" 886 | dependencies = [ 887 | "adler2", 888 | ] 889 | 890 | [[package]] 891 | name = "mio" 892 | version = "0.8.11" 893 | source = "registry+https://github.com/rust-lang/crates.io-index" 894 | checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" 895 | dependencies = [ 896 | "libc", 897 | "log", 898 | "wasi 0.11.0+wasi-snapshot-preview1", 899 | "windows-sys 0.48.0", 900 | ] 901 | 902 | [[package]] 903 | name = "mio" 904 | version = "1.0.3" 905 | source = "registry+https://github.com/rust-lang/crates.io-index" 906 | checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" 907 | dependencies = [ 908 | "libc", 909 | "log", 910 | "wasi 0.11.0+wasi-snapshot-preview1", 911 | "windows-sys 0.52.0", 912 | ] 913 | 914 | [[package]] 915 | name = "native-tls" 916 | version = "0.2.14" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" 919 | dependencies = [ 920 | "libc", 921 | "log", 922 | "openssl", 923 | "openssl-probe", 924 | "openssl-sys", 925 | "schannel", 926 | "security-framework", 927 | "security-framework-sys", 928 | "tempfile", 929 | ] 930 | 931 | [[package]] 932 | name = "num-traits" 933 | version = "0.2.19" 934 | source = "registry+https://github.com/rust-lang/crates.io-index" 935 | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 936 | dependencies = [ 937 | "autocfg", 938 | ] 939 | 940 | [[package]] 941 | name = "object" 942 | version = "0.36.7" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" 945 | dependencies = [ 946 | "memchr", 947 | ] 948 | 949 | [[package]] 950 | name = "once_cell" 951 | version = "1.20.3" 952 | source = "registry+https://github.com/rust-lang/crates.io-index" 953 | checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" 954 | 955 | [[package]] 956 | name = "openssl" 957 | version = "0.10.71" 958 | source = "registry+https://github.com/rust-lang/crates.io-index" 959 | checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" 960 | dependencies = [ 961 | "bitflags 2.8.0", 962 | "cfg-if", 963 | "foreign-types", 964 | "libc", 965 | "once_cell", 966 | "openssl-macros", 967 | "openssl-sys", 968 | ] 969 | 970 | [[package]] 971 | name = "openssl-macros" 972 | version = "0.1.1" 973 | source = "registry+https://github.com/rust-lang/crates.io-index" 974 | checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 975 | dependencies = [ 976 | "proc-macro2", 977 | "quote", 978 | "syn", 979 | ] 980 | 981 | [[package]] 982 | name = "openssl-probe" 983 | version = "0.1.6" 984 | source = "registry+https://github.com/rust-lang/crates.io-index" 985 | checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" 986 | 987 | [[package]] 988 | name = "openssl-sys" 989 | version = "0.9.106" 990 | source = "registry+https://github.com/rust-lang/crates.io-index" 991 | checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" 992 | dependencies = [ 993 | "cc", 994 | "libc", 995 | "pkg-config", 996 | "vcpkg", 997 | ] 998 | 999 | [[package]] 1000 | name = "option-ext" 1001 | version = "0.2.0" 1002 | source = "registry+https://github.com/rust-lang/crates.io-index" 1003 | checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" 1004 | 1005 | [[package]] 1006 | name = "parking_lot" 1007 | version = "0.12.3" 1008 | source = "registry+https://github.com/rust-lang/crates.io-index" 1009 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 1010 | dependencies = [ 1011 | "lock_api", 1012 | "parking_lot_core", 1013 | ] 1014 | 1015 | [[package]] 1016 | name = "parking_lot_core" 1017 | version = "0.9.10" 1018 | source = "registry+https://github.com/rust-lang/crates.io-index" 1019 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 1020 | dependencies = [ 1021 | "cfg-if", 1022 | "libc", 1023 | "redox_syscall", 1024 | "smallvec", 1025 | "windows-targets 0.52.6", 1026 | ] 1027 | 1028 | [[package]] 1029 | name = "percent-encoding" 1030 | version = "2.3.1" 1031 | source = "registry+https://github.com/rust-lang/crates.io-index" 1032 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 1033 | 1034 | [[package]] 1035 | name = "pin-project-lite" 1036 | version = "0.2.16" 1037 | source = "registry+https://github.com/rust-lang/crates.io-index" 1038 | checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 1039 | 1040 | [[package]] 1041 | name = "pin-utils" 1042 | version = "0.1.0" 1043 | source = "registry+https://github.com/rust-lang/crates.io-index" 1044 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1045 | 1046 | [[package]] 1047 | name = "pkg-config" 1048 | version = "0.3.31" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" 1051 | 1052 | [[package]] 1053 | name = "ppv-lite86" 1054 | version = "0.2.20" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" 1057 | dependencies = [ 1058 | "zerocopy 0.7.35", 1059 | ] 1060 | 1061 | [[package]] 1062 | name = "proc-macro2" 1063 | version = "1.0.93" 1064 | source = "registry+https://github.com/rust-lang/crates.io-index" 1065 | checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" 1066 | dependencies = [ 1067 | "unicode-ident", 1068 | ] 1069 | 1070 | [[package]] 1071 | name = "quote" 1072 | version = "1.0.38" 1073 | source = "registry+https://github.com/rust-lang/crates.io-index" 1074 | checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" 1075 | dependencies = [ 1076 | "proc-macro2", 1077 | ] 1078 | 1079 | [[package]] 1080 | name = "rand" 1081 | version = "0.9.0" 1082 | source = "registry+https://github.com/rust-lang/crates.io-index" 1083 | checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" 1084 | dependencies = [ 1085 | "rand_chacha", 1086 | "rand_core", 1087 | "zerocopy 0.8.14", 1088 | ] 1089 | 1090 | [[package]] 1091 | name = "rand_chacha" 1092 | version = "0.9.0" 1093 | source = "registry+https://github.com/rust-lang/crates.io-index" 1094 | checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" 1095 | dependencies = [ 1096 | "ppv-lite86", 1097 | "rand_core", 1098 | ] 1099 | 1100 | [[package]] 1101 | name = "rand_core" 1102 | version = "0.9.0" 1103 | source = "registry+https://github.com/rust-lang/crates.io-index" 1104 | checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff" 1105 | dependencies = [ 1106 | "getrandom 0.3.1", 1107 | "zerocopy 0.8.14", 1108 | ] 1109 | 1110 | [[package]] 1111 | name = "redox_syscall" 1112 | version = "0.5.8" 1113 | source = "registry+https://github.com/rust-lang/crates.io-index" 1114 | checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" 1115 | dependencies = [ 1116 | "bitflags 2.8.0", 1117 | ] 1118 | 1119 | [[package]] 1120 | name = "redox_users" 1121 | version = "0.5.0" 1122 | source = "registry+https://github.com/rust-lang/crates.io-index" 1123 | checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" 1124 | dependencies = [ 1125 | "getrandom 0.2.15", 1126 | "libredox", 1127 | "thiserror", 1128 | ] 1129 | 1130 | [[package]] 1131 | name = "reqwest" 1132 | version = "0.12.12" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" 1135 | dependencies = [ 1136 | "base64", 1137 | "bytes", 1138 | "encoding_rs", 1139 | "futures-channel", 1140 | "futures-core", 1141 | "futures-util", 1142 | "h2", 1143 | "http", 1144 | "http-body", 1145 | "http-body-util", 1146 | "hyper", 1147 | "hyper-rustls", 1148 | "hyper-tls", 1149 | "hyper-util", 1150 | "ipnet", 1151 | "js-sys", 1152 | "log", 1153 | "mime", 1154 | "native-tls", 1155 | "once_cell", 1156 | "percent-encoding", 1157 | "pin-project-lite", 1158 | "rustls-pemfile", 1159 | "serde", 1160 | "serde_json", 1161 | "serde_urlencoded", 1162 | "sync_wrapper", 1163 | "system-configuration", 1164 | "tokio", 1165 | "tokio-native-tls", 1166 | "tower", 1167 | "tower-service", 1168 | "url", 1169 | "wasm-bindgen", 1170 | "wasm-bindgen-futures", 1171 | "web-sys", 1172 | "windows-registry", 1173 | ] 1174 | 1175 | [[package]] 1176 | name = "ring" 1177 | version = "0.17.11" 1178 | source = "registry+https://github.com/rust-lang/crates.io-index" 1179 | checksum = "da5349ae27d3887ca812fb375b45a4fbb36d8d12d2df394968cd86e35683fe73" 1180 | dependencies = [ 1181 | "cc", 1182 | "cfg-if", 1183 | "getrandom 0.2.15", 1184 | "libc", 1185 | "untrusted", 1186 | "windows-sys 0.52.0", 1187 | ] 1188 | 1189 | [[package]] 1190 | name = "rustc-demangle" 1191 | version = "0.1.24" 1192 | source = "registry+https://github.com/rust-lang/crates.io-index" 1193 | checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 1194 | 1195 | [[package]] 1196 | name = "rustix" 1197 | version = "0.38.44" 1198 | source = "registry+https://github.com/rust-lang/crates.io-index" 1199 | checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" 1200 | dependencies = [ 1201 | "bitflags 2.8.0", 1202 | "errno", 1203 | "libc", 1204 | "linux-raw-sys", 1205 | "windows-sys 0.59.0", 1206 | ] 1207 | 1208 | [[package]] 1209 | name = "rustls" 1210 | version = "0.23.23" 1211 | source = "registry+https://github.com/rust-lang/crates.io-index" 1212 | checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" 1213 | dependencies = [ 1214 | "once_cell", 1215 | "rustls-pki-types", 1216 | "rustls-webpki", 1217 | "subtle", 1218 | "zeroize", 1219 | ] 1220 | 1221 | [[package]] 1222 | name = "rustls-pemfile" 1223 | version = "2.2.0" 1224 | source = "registry+https://github.com/rust-lang/crates.io-index" 1225 | checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" 1226 | dependencies = [ 1227 | "rustls-pki-types", 1228 | ] 1229 | 1230 | [[package]] 1231 | name = "rustls-pki-types" 1232 | version = "1.11.0" 1233 | source = "registry+https://github.com/rust-lang/crates.io-index" 1234 | checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" 1235 | 1236 | [[package]] 1237 | name = "rustls-webpki" 1238 | version = "0.102.8" 1239 | source = "registry+https://github.com/rust-lang/crates.io-index" 1240 | checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" 1241 | dependencies = [ 1242 | "ring", 1243 | "rustls-pki-types", 1244 | "untrusted", 1245 | ] 1246 | 1247 | [[package]] 1248 | name = "rustversion" 1249 | version = "1.0.19" 1250 | source = "registry+https://github.com/rust-lang/crates.io-index" 1251 | checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" 1252 | 1253 | [[package]] 1254 | name = "ryu" 1255 | version = "1.0.19" 1256 | source = "registry+https://github.com/rust-lang/crates.io-index" 1257 | checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" 1258 | 1259 | [[package]] 1260 | name = "schannel" 1261 | version = "0.1.27" 1262 | source = "registry+https://github.com/rust-lang/crates.io-index" 1263 | checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" 1264 | dependencies = [ 1265 | "windows-sys 0.59.0", 1266 | ] 1267 | 1268 | [[package]] 1269 | name = "scopeguard" 1270 | version = "1.2.0" 1271 | source = "registry+https://github.com/rust-lang/crates.io-index" 1272 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1273 | 1274 | [[package]] 1275 | name = "security-framework" 1276 | version = "2.11.1" 1277 | source = "registry+https://github.com/rust-lang/crates.io-index" 1278 | checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" 1279 | dependencies = [ 1280 | "bitflags 2.8.0", 1281 | "core-foundation", 1282 | "core-foundation-sys", 1283 | "libc", 1284 | "security-framework-sys", 1285 | ] 1286 | 1287 | [[package]] 1288 | name = "security-framework-sys" 1289 | version = "2.14.0" 1290 | source = "registry+https://github.com/rust-lang/crates.io-index" 1291 | checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" 1292 | dependencies = [ 1293 | "core-foundation-sys", 1294 | "libc", 1295 | ] 1296 | 1297 | [[package]] 1298 | name = "serde" 1299 | version = "1.0.217" 1300 | source = "registry+https://github.com/rust-lang/crates.io-index" 1301 | checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" 1302 | dependencies = [ 1303 | "serde_derive", 1304 | ] 1305 | 1306 | [[package]] 1307 | name = "serde_derive" 1308 | version = "1.0.217" 1309 | source = "registry+https://github.com/rust-lang/crates.io-index" 1310 | checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" 1311 | dependencies = [ 1312 | "proc-macro2", 1313 | "quote", 1314 | "syn", 1315 | ] 1316 | 1317 | [[package]] 1318 | name = "serde_json" 1319 | version = "1.0.139" 1320 | source = "registry+https://github.com/rust-lang/crates.io-index" 1321 | checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6" 1322 | dependencies = [ 1323 | "itoa", 1324 | "memchr", 1325 | "ryu", 1326 | "serde", 1327 | ] 1328 | 1329 | [[package]] 1330 | name = "serde_spanned" 1331 | version = "0.6.8" 1332 | source = "registry+https://github.com/rust-lang/crates.io-index" 1333 | checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" 1334 | dependencies = [ 1335 | "serde", 1336 | ] 1337 | 1338 | [[package]] 1339 | name = "serde_urlencoded" 1340 | version = "0.7.1" 1341 | source = "registry+https://github.com/rust-lang/crates.io-index" 1342 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1343 | dependencies = [ 1344 | "form_urlencoded", 1345 | "itoa", 1346 | "ryu", 1347 | "serde", 1348 | ] 1349 | 1350 | [[package]] 1351 | name = "shlex" 1352 | version = "1.3.0" 1353 | source = "registry+https://github.com/rust-lang/crates.io-index" 1354 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1355 | 1356 | [[package]] 1357 | name = "signal-hook" 1358 | version = "0.3.17" 1359 | source = "registry+https://github.com/rust-lang/crates.io-index" 1360 | checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" 1361 | dependencies = [ 1362 | "libc", 1363 | "signal-hook-registry", 1364 | ] 1365 | 1366 | [[package]] 1367 | name = "signal-hook-mio" 1368 | version = "0.2.4" 1369 | source = "registry+https://github.com/rust-lang/crates.io-index" 1370 | checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" 1371 | dependencies = [ 1372 | "libc", 1373 | "mio 0.8.11", 1374 | "mio 1.0.3", 1375 | "signal-hook", 1376 | ] 1377 | 1378 | [[package]] 1379 | name = "signal-hook-registry" 1380 | version = "1.4.2" 1381 | source = "registry+https://github.com/rust-lang/crates.io-index" 1382 | checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 1383 | dependencies = [ 1384 | "libc", 1385 | ] 1386 | 1387 | [[package]] 1388 | name = "slab" 1389 | version = "0.4.9" 1390 | source = "registry+https://github.com/rust-lang/crates.io-index" 1391 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 1392 | dependencies = [ 1393 | "autocfg", 1394 | ] 1395 | 1396 | [[package]] 1397 | name = "smallvec" 1398 | version = "1.13.2" 1399 | source = "registry+https://github.com/rust-lang/crates.io-index" 1400 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 1401 | 1402 | [[package]] 1403 | name = "socket2" 1404 | version = "0.5.8" 1405 | source = "registry+https://github.com/rust-lang/crates.io-index" 1406 | checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" 1407 | dependencies = [ 1408 | "libc", 1409 | "windows-sys 0.52.0", 1410 | ] 1411 | 1412 | [[package]] 1413 | name = "stable_deref_trait" 1414 | version = "1.2.0" 1415 | source = "registry+https://github.com/rust-lang/crates.io-index" 1416 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 1417 | 1418 | [[package]] 1419 | name = "strsim" 1420 | version = "0.11.1" 1421 | source = "registry+https://github.com/rust-lang/crates.io-index" 1422 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 1423 | 1424 | [[package]] 1425 | name = "subtle" 1426 | version = "2.6.1" 1427 | source = "registry+https://github.com/rust-lang/crates.io-index" 1428 | checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" 1429 | 1430 | [[package]] 1431 | name = "syn" 1432 | version = "2.0.98" 1433 | source = "registry+https://github.com/rust-lang/crates.io-index" 1434 | checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" 1435 | dependencies = [ 1436 | "proc-macro2", 1437 | "quote", 1438 | "unicode-ident", 1439 | ] 1440 | 1441 | [[package]] 1442 | name = "sync_wrapper" 1443 | version = "1.0.2" 1444 | source = "registry+https://github.com/rust-lang/crates.io-index" 1445 | checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" 1446 | dependencies = [ 1447 | "futures-core", 1448 | ] 1449 | 1450 | [[package]] 1451 | name = "synstructure" 1452 | version = "0.13.1" 1453 | source = "registry+https://github.com/rust-lang/crates.io-index" 1454 | checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" 1455 | dependencies = [ 1456 | "proc-macro2", 1457 | "quote", 1458 | "syn", 1459 | ] 1460 | 1461 | [[package]] 1462 | name = "system-configuration" 1463 | version = "0.6.1" 1464 | source = "registry+https://github.com/rust-lang/crates.io-index" 1465 | checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" 1466 | dependencies = [ 1467 | "bitflags 2.8.0", 1468 | "core-foundation", 1469 | "system-configuration-sys", 1470 | ] 1471 | 1472 | [[package]] 1473 | name = "system-configuration-sys" 1474 | version = "0.6.0" 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" 1476 | checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" 1477 | dependencies = [ 1478 | "core-foundation-sys", 1479 | "libc", 1480 | ] 1481 | 1482 | [[package]] 1483 | name = "tempfile" 1484 | version = "3.17.1" 1485 | source = "registry+https://github.com/rust-lang/crates.io-index" 1486 | checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230" 1487 | dependencies = [ 1488 | "cfg-if", 1489 | "fastrand", 1490 | "getrandom 0.3.1", 1491 | "once_cell", 1492 | "rustix", 1493 | "windows-sys 0.59.0", 1494 | ] 1495 | 1496 | [[package]] 1497 | name = "thiserror" 1498 | version = "2.0.11" 1499 | source = "registry+https://github.com/rust-lang/crates.io-index" 1500 | checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" 1501 | dependencies = [ 1502 | "thiserror-impl", 1503 | ] 1504 | 1505 | [[package]] 1506 | name = "thiserror-impl" 1507 | version = "2.0.11" 1508 | source = "registry+https://github.com/rust-lang/crates.io-index" 1509 | checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" 1510 | dependencies = [ 1511 | "proc-macro2", 1512 | "quote", 1513 | "syn", 1514 | ] 1515 | 1516 | [[package]] 1517 | name = "tinystr" 1518 | version = "0.7.6" 1519 | source = "registry+https://github.com/rust-lang/crates.io-index" 1520 | checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" 1521 | dependencies = [ 1522 | "displaydoc", 1523 | "zerovec", 1524 | ] 1525 | 1526 | [[package]] 1527 | name = "tokio" 1528 | version = "1.43.0" 1529 | source = "registry+https://github.com/rust-lang/crates.io-index" 1530 | checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" 1531 | dependencies = [ 1532 | "backtrace", 1533 | "bytes", 1534 | "libc", 1535 | "mio 1.0.3", 1536 | "pin-project-lite", 1537 | "socket2", 1538 | "windows-sys 0.52.0", 1539 | ] 1540 | 1541 | [[package]] 1542 | name = "tokio-native-tls" 1543 | version = "0.3.1" 1544 | source = "registry+https://github.com/rust-lang/crates.io-index" 1545 | checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1546 | dependencies = [ 1547 | "native-tls", 1548 | "tokio", 1549 | ] 1550 | 1551 | [[package]] 1552 | name = "tokio-rustls" 1553 | version = "0.26.1" 1554 | source = "registry+https://github.com/rust-lang/crates.io-index" 1555 | checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" 1556 | dependencies = [ 1557 | "rustls", 1558 | "tokio", 1559 | ] 1560 | 1561 | [[package]] 1562 | name = "tokio-util" 1563 | version = "0.7.13" 1564 | source = "registry+https://github.com/rust-lang/crates.io-index" 1565 | checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" 1566 | dependencies = [ 1567 | "bytes", 1568 | "futures-core", 1569 | "futures-sink", 1570 | "pin-project-lite", 1571 | "tokio", 1572 | ] 1573 | 1574 | [[package]] 1575 | name = "toml" 1576 | version = "0.8.20" 1577 | source = "registry+https://github.com/rust-lang/crates.io-index" 1578 | checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" 1579 | dependencies = [ 1580 | "serde", 1581 | "serde_spanned", 1582 | "toml_datetime", 1583 | "toml_edit", 1584 | ] 1585 | 1586 | [[package]] 1587 | name = "toml_datetime" 1588 | version = "0.6.8" 1589 | source = "registry+https://github.com/rust-lang/crates.io-index" 1590 | checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" 1591 | dependencies = [ 1592 | "serde", 1593 | ] 1594 | 1595 | [[package]] 1596 | name = "toml_edit" 1597 | version = "0.22.23" 1598 | source = "registry+https://github.com/rust-lang/crates.io-index" 1599 | checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee" 1600 | dependencies = [ 1601 | "indexmap", 1602 | "serde", 1603 | "serde_spanned", 1604 | "toml_datetime", 1605 | "winnow", 1606 | ] 1607 | 1608 | [[package]] 1609 | name = "tower" 1610 | version = "0.5.2" 1611 | source = "registry+https://github.com/rust-lang/crates.io-index" 1612 | checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" 1613 | dependencies = [ 1614 | "futures-core", 1615 | "futures-util", 1616 | "pin-project-lite", 1617 | "sync_wrapper", 1618 | "tokio", 1619 | "tower-layer", 1620 | "tower-service", 1621 | ] 1622 | 1623 | [[package]] 1624 | name = "tower-layer" 1625 | version = "0.3.3" 1626 | source = "registry+https://github.com/rust-lang/crates.io-index" 1627 | checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" 1628 | 1629 | [[package]] 1630 | name = "tower-service" 1631 | version = "0.3.3" 1632 | source = "registry+https://github.com/rust-lang/crates.io-index" 1633 | checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" 1634 | 1635 | [[package]] 1636 | name = "tracing" 1637 | version = "0.1.41" 1638 | source = "registry+https://github.com/rust-lang/crates.io-index" 1639 | checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 1640 | dependencies = [ 1641 | "pin-project-lite", 1642 | "tracing-core", 1643 | ] 1644 | 1645 | [[package]] 1646 | name = "tracing-core" 1647 | version = "0.1.33" 1648 | source = "registry+https://github.com/rust-lang/crates.io-index" 1649 | checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" 1650 | dependencies = [ 1651 | "once_cell", 1652 | ] 1653 | 1654 | [[package]] 1655 | name = "try-lock" 1656 | version = "0.2.5" 1657 | source = "registry+https://github.com/rust-lang/crates.io-index" 1658 | checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 1659 | 1660 | [[package]] 1661 | name = "tui" 1662 | version = "0.19.0" 1663 | source = "registry+https://github.com/rust-lang/crates.io-index" 1664 | checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1" 1665 | dependencies = [ 1666 | "bitflags 1.3.2", 1667 | "cassowary", 1668 | "crossterm 0.25.0", 1669 | "unicode-segmentation", 1670 | "unicode-width 0.1.14", 1671 | ] 1672 | 1673 | [[package]] 1674 | name = "typy" 1675 | version = "0.7.0" 1676 | dependencies = [ 1677 | "anyhow", 1678 | "chrono", 1679 | "clap", 1680 | "comfy-table", 1681 | "crossterm 0.28.1", 1682 | "dirs", 1683 | "lazy_static", 1684 | "rand", 1685 | "reqwest", 1686 | "serde", 1687 | "serde_json", 1688 | "toml", 1689 | "tui", 1690 | ] 1691 | 1692 | [[package]] 1693 | name = "unicode-ident" 1694 | version = "1.0.16" 1695 | source = "registry+https://github.com/rust-lang/crates.io-index" 1696 | checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" 1697 | 1698 | [[package]] 1699 | name = "unicode-segmentation" 1700 | version = "1.12.0" 1701 | source = "registry+https://github.com/rust-lang/crates.io-index" 1702 | checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" 1703 | 1704 | [[package]] 1705 | name = "unicode-width" 1706 | version = "0.1.14" 1707 | source = "registry+https://github.com/rust-lang/crates.io-index" 1708 | checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 1709 | 1710 | [[package]] 1711 | name = "unicode-width" 1712 | version = "0.2.0" 1713 | source = "registry+https://github.com/rust-lang/crates.io-index" 1714 | checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" 1715 | 1716 | [[package]] 1717 | name = "untrusted" 1718 | version = "0.9.0" 1719 | source = "registry+https://github.com/rust-lang/crates.io-index" 1720 | checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" 1721 | 1722 | [[package]] 1723 | name = "url" 1724 | version = "2.5.4" 1725 | source = "registry+https://github.com/rust-lang/crates.io-index" 1726 | checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" 1727 | dependencies = [ 1728 | "form_urlencoded", 1729 | "idna", 1730 | "percent-encoding", 1731 | ] 1732 | 1733 | [[package]] 1734 | name = "utf16_iter" 1735 | version = "1.0.5" 1736 | source = "registry+https://github.com/rust-lang/crates.io-index" 1737 | checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" 1738 | 1739 | [[package]] 1740 | name = "utf8_iter" 1741 | version = "1.0.4" 1742 | source = "registry+https://github.com/rust-lang/crates.io-index" 1743 | checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" 1744 | 1745 | [[package]] 1746 | name = "utf8parse" 1747 | version = "0.2.2" 1748 | source = "registry+https://github.com/rust-lang/crates.io-index" 1749 | checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 1750 | 1751 | [[package]] 1752 | name = "vcpkg" 1753 | version = "0.2.15" 1754 | source = "registry+https://github.com/rust-lang/crates.io-index" 1755 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1756 | 1757 | [[package]] 1758 | name = "want" 1759 | version = "0.3.1" 1760 | source = "registry+https://github.com/rust-lang/crates.io-index" 1761 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 1762 | dependencies = [ 1763 | "try-lock", 1764 | ] 1765 | 1766 | [[package]] 1767 | name = "wasi" 1768 | version = "0.11.0+wasi-snapshot-preview1" 1769 | source = "registry+https://github.com/rust-lang/crates.io-index" 1770 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1771 | 1772 | [[package]] 1773 | name = "wasi" 1774 | version = "0.13.3+wasi-0.2.2" 1775 | source = "registry+https://github.com/rust-lang/crates.io-index" 1776 | checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" 1777 | dependencies = [ 1778 | "wit-bindgen-rt", 1779 | ] 1780 | 1781 | [[package]] 1782 | name = "wasm-bindgen" 1783 | version = "0.2.100" 1784 | source = "registry+https://github.com/rust-lang/crates.io-index" 1785 | checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" 1786 | dependencies = [ 1787 | "cfg-if", 1788 | "once_cell", 1789 | "rustversion", 1790 | "wasm-bindgen-macro", 1791 | ] 1792 | 1793 | [[package]] 1794 | name = "wasm-bindgen-backend" 1795 | version = "0.2.100" 1796 | source = "registry+https://github.com/rust-lang/crates.io-index" 1797 | checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" 1798 | dependencies = [ 1799 | "bumpalo", 1800 | "log", 1801 | "proc-macro2", 1802 | "quote", 1803 | "syn", 1804 | "wasm-bindgen-shared", 1805 | ] 1806 | 1807 | [[package]] 1808 | name = "wasm-bindgen-futures" 1809 | version = "0.4.50" 1810 | source = "registry+https://github.com/rust-lang/crates.io-index" 1811 | checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" 1812 | dependencies = [ 1813 | "cfg-if", 1814 | "js-sys", 1815 | "once_cell", 1816 | "wasm-bindgen", 1817 | "web-sys", 1818 | ] 1819 | 1820 | [[package]] 1821 | name = "wasm-bindgen-macro" 1822 | version = "0.2.100" 1823 | source = "registry+https://github.com/rust-lang/crates.io-index" 1824 | checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" 1825 | dependencies = [ 1826 | "quote", 1827 | "wasm-bindgen-macro-support", 1828 | ] 1829 | 1830 | [[package]] 1831 | name = "wasm-bindgen-macro-support" 1832 | version = "0.2.100" 1833 | source = "registry+https://github.com/rust-lang/crates.io-index" 1834 | checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" 1835 | dependencies = [ 1836 | "proc-macro2", 1837 | "quote", 1838 | "syn", 1839 | "wasm-bindgen-backend", 1840 | "wasm-bindgen-shared", 1841 | ] 1842 | 1843 | [[package]] 1844 | name = "wasm-bindgen-shared" 1845 | version = "0.2.100" 1846 | source = "registry+https://github.com/rust-lang/crates.io-index" 1847 | checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" 1848 | dependencies = [ 1849 | "unicode-ident", 1850 | ] 1851 | 1852 | [[package]] 1853 | name = "web-sys" 1854 | version = "0.3.77" 1855 | source = "registry+https://github.com/rust-lang/crates.io-index" 1856 | checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" 1857 | dependencies = [ 1858 | "js-sys", 1859 | "wasm-bindgen", 1860 | ] 1861 | 1862 | [[package]] 1863 | name = "winapi" 1864 | version = "0.3.9" 1865 | source = "registry+https://github.com/rust-lang/crates.io-index" 1866 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1867 | dependencies = [ 1868 | "winapi-i686-pc-windows-gnu", 1869 | "winapi-x86_64-pc-windows-gnu", 1870 | ] 1871 | 1872 | [[package]] 1873 | name = "winapi-i686-pc-windows-gnu" 1874 | version = "0.4.0" 1875 | source = "registry+https://github.com/rust-lang/crates.io-index" 1876 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1877 | 1878 | [[package]] 1879 | name = "winapi-x86_64-pc-windows-gnu" 1880 | version = "0.4.0" 1881 | source = "registry+https://github.com/rust-lang/crates.io-index" 1882 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1883 | 1884 | [[package]] 1885 | name = "windows-core" 1886 | version = "0.52.0" 1887 | source = "registry+https://github.com/rust-lang/crates.io-index" 1888 | checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" 1889 | dependencies = [ 1890 | "windows-targets 0.52.6", 1891 | ] 1892 | 1893 | [[package]] 1894 | name = "windows-registry" 1895 | version = "0.2.0" 1896 | source = "registry+https://github.com/rust-lang/crates.io-index" 1897 | checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" 1898 | dependencies = [ 1899 | "windows-result", 1900 | "windows-strings", 1901 | "windows-targets 0.52.6", 1902 | ] 1903 | 1904 | [[package]] 1905 | name = "windows-result" 1906 | version = "0.2.0" 1907 | source = "registry+https://github.com/rust-lang/crates.io-index" 1908 | checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" 1909 | dependencies = [ 1910 | "windows-targets 0.52.6", 1911 | ] 1912 | 1913 | [[package]] 1914 | name = "windows-strings" 1915 | version = "0.1.0" 1916 | source = "registry+https://github.com/rust-lang/crates.io-index" 1917 | checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" 1918 | dependencies = [ 1919 | "windows-result", 1920 | "windows-targets 0.52.6", 1921 | ] 1922 | 1923 | [[package]] 1924 | name = "windows-sys" 1925 | version = "0.48.0" 1926 | source = "registry+https://github.com/rust-lang/crates.io-index" 1927 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1928 | dependencies = [ 1929 | "windows-targets 0.48.5", 1930 | ] 1931 | 1932 | [[package]] 1933 | name = "windows-sys" 1934 | version = "0.52.0" 1935 | source = "registry+https://github.com/rust-lang/crates.io-index" 1936 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1937 | dependencies = [ 1938 | "windows-targets 0.52.6", 1939 | ] 1940 | 1941 | [[package]] 1942 | name = "windows-sys" 1943 | version = "0.59.0" 1944 | source = "registry+https://github.com/rust-lang/crates.io-index" 1945 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 1946 | dependencies = [ 1947 | "windows-targets 0.52.6", 1948 | ] 1949 | 1950 | [[package]] 1951 | name = "windows-targets" 1952 | version = "0.48.5" 1953 | source = "registry+https://github.com/rust-lang/crates.io-index" 1954 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1955 | dependencies = [ 1956 | "windows_aarch64_gnullvm 0.48.5", 1957 | "windows_aarch64_msvc 0.48.5", 1958 | "windows_i686_gnu 0.48.5", 1959 | "windows_i686_msvc 0.48.5", 1960 | "windows_x86_64_gnu 0.48.5", 1961 | "windows_x86_64_gnullvm 0.48.5", 1962 | "windows_x86_64_msvc 0.48.5", 1963 | ] 1964 | 1965 | [[package]] 1966 | name = "windows-targets" 1967 | version = "0.52.6" 1968 | source = "registry+https://github.com/rust-lang/crates.io-index" 1969 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 1970 | dependencies = [ 1971 | "windows_aarch64_gnullvm 0.52.6", 1972 | "windows_aarch64_msvc 0.52.6", 1973 | "windows_i686_gnu 0.52.6", 1974 | "windows_i686_gnullvm", 1975 | "windows_i686_msvc 0.52.6", 1976 | "windows_x86_64_gnu 0.52.6", 1977 | "windows_x86_64_gnullvm 0.52.6", 1978 | "windows_x86_64_msvc 0.52.6", 1979 | ] 1980 | 1981 | [[package]] 1982 | name = "windows_aarch64_gnullvm" 1983 | version = "0.48.5" 1984 | source = "registry+https://github.com/rust-lang/crates.io-index" 1985 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1986 | 1987 | [[package]] 1988 | name = "windows_aarch64_gnullvm" 1989 | version = "0.52.6" 1990 | source = "registry+https://github.com/rust-lang/crates.io-index" 1991 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 1992 | 1993 | [[package]] 1994 | name = "windows_aarch64_msvc" 1995 | version = "0.48.5" 1996 | source = "registry+https://github.com/rust-lang/crates.io-index" 1997 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1998 | 1999 | [[package]] 2000 | name = "windows_aarch64_msvc" 2001 | version = "0.52.6" 2002 | source = "registry+https://github.com/rust-lang/crates.io-index" 2003 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 2004 | 2005 | [[package]] 2006 | name = "windows_i686_gnu" 2007 | version = "0.48.5" 2008 | source = "registry+https://github.com/rust-lang/crates.io-index" 2009 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 2010 | 2011 | [[package]] 2012 | name = "windows_i686_gnu" 2013 | version = "0.52.6" 2014 | source = "registry+https://github.com/rust-lang/crates.io-index" 2015 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 2016 | 2017 | [[package]] 2018 | name = "windows_i686_gnullvm" 2019 | version = "0.52.6" 2020 | source = "registry+https://github.com/rust-lang/crates.io-index" 2021 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 2022 | 2023 | [[package]] 2024 | name = "windows_i686_msvc" 2025 | version = "0.48.5" 2026 | source = "registry+https://github.com/rust-lang/crates.io-index" 2027 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 2028 | 2029 | [[package]] 2030 | name = "windows_i686_msvc" 2031 | version = "0.52.6" 2032 | source = "registry+https://github.com/rust-lang/crates.io-index" 2033 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 2034 | 2035 | [[package]] 2036 | name = "windows_x86_64_gnu" 2037 | version = "0.48.5" 2038 | source = "registry+https://github.com/rust-lang/crates.io-index" 2039 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 2040 | 2041 | [[package]] 2042 | name = "windows_x86_64_gnu" 2043 | version = "0.52.6" 2044 | source = "registry+https://github.com/rust-lang/crates.io-index" 2045 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 2046 | 2047 | [[package]] 2048 | name = "windows_x86_64_gnullvm" 2049 | version = "0.48.5" 2050 | source = "registry+https://github.com/rust-lang/crates.io-index" 2051 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 2052 | 2053 | [[package]] 2054 | name = "windows_x86_64_gnullvm" 2055 | version = "0.52.6" 2056 | source = "registry+https://github.com/rust-lang/crates.io-index" 2057 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 2058 | 2059 | [[package]] 2060 | name = "windows_x86_64_msvc" 2061 | version = "0.48.5" 2062 | source = "registry+https://github.com/rust-lang/crates.io-index" 2063 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 2064 | 2065 | [[package]] 2066 | name = "windows_x86_64_msvc" 2067 | version = "0.52.6" 2068 | source = "registry+https://github.com/rust-lang/crates.io-index" 2069 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 2070 | 2071 | [[package]] 2072 | name = "winnow" 2073 | version = "0.7.1" 2074 | source = "registry+https://github.com/rust-lang/crates.io-index" 2075 | checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f" 2076 | dependencies = [ 2077 | "memchr", 2078 | ] 2079 | 2080 | [[package]] 2081 | name = "wit-bindgen-rt" 2082 | version = "0.33.0" 2083 | source = "registry+https://github.com/rust-lang/crates.io-index" 2084 | checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" 2085 | dependencies = [ 2086 | "bitflags 2.8.0", 2087 | ] 2088 | 2089 | [[package]] 2090 | name = "write16" 2091 | version = "1.0.0" 2092 | source = "registry+https://github.com/rust-lang/crates.io-index" 2093 | checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" 2094 | 2095 | [[package]] 2096 | name = "writeable" 2097 | version = "0.5.5" 2098 | source = "registry+https://github.com/rust-lang/crates.io-index" 2099 | checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" 2100 | 2101 | [[package]] 2102 | name = "yoke" 2103 | version = "0.7.5" 2104 | source = "registry+https://github.com/rust-lang/crates.io-index" 2105 | checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" 2106 | dependencies = [ 2107 | "serde", 2108 | "stable_deref_trait", 2109 | "yoke-derive", 2110 | "zerofrom", 2111 | ] 2112 | 2113 | [[package]] 2114 | name = "yoke-derive" 2115 | version = "0.7.5" 2116 | source = "registry+https://github.com/rust-lang/crates.io-index" 2117 | checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" 2118 | dependencies = [ 2119 | "proc-macro2", 2120 | "quote", 2121 | "syn", 2122 | "synstructure", 2123 | ] 2124 | 2125 | [[package]] 2126 | name = "zerocopy" 2127 | version = "0.7.35" 2128 | source = "registry+https://github.com/rust-lang/crates.io-index" 2129 | checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" 2130 | dependencies = [ 2131 | "byteorder", 2132 | "zerocopy-derive 0.7.35", 2133 | ] 2134 | 2135 | [[package]] 2136 | name = "zerocopy" 2137 | version = "0.8.14" 2138 | source = "registry+https://github.com/rust-lang/crates.io-index" 2139 | checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" 2140 | dependencies = [ 2141 | "zerocopy-derive 0.8.14", 2142 | ] 2143 | 2144 | [[package]] 2145 | name = "zerocopy-derive" 2146 | version = "0.7.35" 2147 | source = "registry+https://github.com/rust-lang/crates.io-index" 2148 | checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" 2149 | dependencies = [ 2150 | "proc-macro2", 2151 | "quote", 2152 | "syn", 2153 | ] 2154 | 2155 | [[package]] 2156 | name = "zerocopy-derive" 2157 | version = "0.8.14" 2158 | source = "registry+https://github.com/rust-lang/crates.io-index" 2159 | checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" 2160 | dependencies = [ 2161 | "proc-macro2", 2162 | "quote", 2163 | "syn", 2164 | ] 2165 | 2166 | [[package]] 2167 | name = "zerofrom" 2168 | version = "0.1.5" 2169 | source = "registry+https://github.com/rust-lang/crates.io-index" 2170 | checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" 2171 | dependencies = [ 2172 | "zerofrom-derive", 2173 | ] 2174 | 2175 | [[package]] 2176 | name = "zerofrom-derive" 2177 | version = "0.1.5" 2178 | source = "registry+https://github.com/rust-lang/crates.io-index" 2179 | checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" 2180 | dependencies = [ 2181 | "proc-macro2", 2182 | "quote", 2183 | "syn", 2184 | "synstructure", 2185 | ] 2186 | 2187 | [[package]] 2188 | name = "zeroize" 2189 | version = "1.8.1" 2190 | source = "registry+https://github.com/rust-lang/crates.io-index" 2191 | checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" 2192 | 2193 | [[package]] 2194 | name = "zerovec" 2195 | version = "0.10.4" 2196 | source = "registry+https://github.com/rust-lang/crates.io-index" 2197 | checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" 2198 | dependencies = [ 2199 | "yoke", 2200 | "zerofrom", 2201 | "zerovec-derive", 2202 | ] 2203 | 2204 | [[package]] 2205 | name = "zerovec-derive" 2206 | version = "0.10.3" 2207 | source = "registry+https://github.com/rust-lang/crates.io-index" 2208 | checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" 2209 | dependencies = [ 2210 | "proc-macro2", 2211 | "quote", 2212 | "syn", 2213 | ] 2214 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "typy" 3 | version = "0.7.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | crossterm = "0.28.1" 8 | clap = {version = "4.5.30", features = ["derive"]} 9 | rand = "0.9" 10 | tui = "0.19.0" 11 | dirs = "6.0" 12 | toml = "0.8.20" 13 | serde = { version = "1.0", features = ["derive"] } 14 | serde_json = "1.0" 15 | lazy_static = "1.5.0" 16 | anyhow = "1.0.95" 17 | chrono = { version = "0.4", features = ["serde"] } 18 | comfy-table = "7.1.4" 19 | reqwest = { version = "0.12.12", features = ["blocking"] } 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Pazl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
  3 | ,--------.,--.   ,--.,------.,--.   ,--.  
  4 | '--.  .--' \  `.'  / |  .--. '\  `.'  /  
  5 |    |  |     '.    /  |  '--' | '.    /   
  6 |    |  |       |  |   |  | --'    |  |    
  7 |    `--'       `--'   `--'        `--'    
  8 |   
9 |
10 | 11 | > [!WARNING] 12 | > When the terminal is too small it can lead to strange behavior. 13 | 14 | ## Table of contents 15 | - [Overview](#overview) 16 | - [Installation](#installation) 17 | - [Flags](#flags) 18 | - [Configuration](#configuration) 19 | - [Stats](#stats) 20 | - [Uninstall](#uninstall) 21 | 22 | ## Overview 23 | ![Description of the GIF](./docs/assets/demo.gif) 24 | I wanted to create a simple typing game to improve my typing speed and accuracy. I really like using [monkeytype](https://monkeytype.com/) and I thought, why not create something similar 25 | in the terminal? I searched for some but didn't find anything I really liked, so I built it myself. Typy is a terminal-based typing game that displays a random 26 | word and asks you to type it as fast as possible. The game tracks your typing speed and accuracy, allowing you to monitor your progress over time. Typy also supports 27 | different game modes, such as uppercase and punctuation, to help you improve your typing skills in different areas. 28 | 29 | ## Installation 30 | To install Typy, you can use the [Cargo] package manager: 31 | 32 | [Cargo]: https://doc.rust-lang.org/cargo/ 33 | 34 | ```bash 35 | cargo install --git "https://github.com/Pazl27/typy-cli.git" --tag "v0.9.0" 36 | ``` 37 | 38 | If you prefer to get the newest version and compile it yourself, follow these steps: 39 | 40 | 1. Clone the Typy repository: 41 | ```bash 42 | git clone https://github.com/Pazl27/typy-cli.git 43 | cd typy-cli 44 | ``` 45 | 46 | 2. Compile the project: 47 | ```bash 48 | cargo build --release 49 | ``` 50 | 51 | 3. Move the compiled binary to a directory in your PATH: 52 | ```bash 53 | sudo mv target/release/typy /usr/local/bin/ 54 | ``` 55 | 56 | 4. Ensure the `english.txt` file is in the correct location: 57 | ```bash 58 | mkdir -p ~/.local/share/typy 59 | cp resources/english.txt ~/.local/share/typy/ 60 | ``` 61 | 62 | If you have Nix with flakes enabled, you can install typy-cli directly: 63 | 64 | ```bash 65 | nix profile install github:Pazl27/typy-cli 66 | ``` 67 | 68 | Or to run without installing: 69 | 70 | ```bash 71 | nix run github:Pazl27/typy-cli 72 | ``` 73 | 74 | ## Flags 75 | The `Typy` application supports the following flags: 76 | 77 | - `-t, --time `: Sets the duration of the game. The default value is `30`. 78 | - if you set the time to a too low value the graph ends up scuffed. 79 | - e.g., `typy-cli -t 60` sets the game duration to 60 seconds. 80 | 81 | - `-s, --stats`: Shows the stats of the game. 82 | - not implemented atm. 83 | - e.g., `typy-cli --stats` displays the game statistics. 84 | 85 | - `-c, --config`: Creates a config file if it doesn't exist and opens it. 86 | - e.g., `typy-cli --config` creates and opens the configuration file. 87 | 88 | - `-m, --mode `: Sets the mode of the game. Multiple values can be specified. 89 | - possible modes are `uppercase`, `punctuation` and `normal`. 90 | - e.g., `typy-cli -m uppercase,punctuation` sets the game mode to uppercase and punctuation. 91 | 92 | 93 | ## Configuration 94 | Typy allows you to configure the colors (theme) via a TOML file. The configuration file is located at `~/.config/typy/config.toml`. You can also configure Typy using the command line with the `typy -c` option. 95 | Inside of the configuration file, you can specify the colors for the theme, graph, and cursor style. Also you can specify some default settings. 96 | 97 | Here is an example configuration block for the `config.toml` file: 98 | 99 | ```toml 100 | # ~/.config/typy/config.toml 101 | 102 | [theme] 103 | fg = "#516D49" 104 | missing = "#918273" 105 | error = "#FB4934" 106 | accent = "#D3869B" 107 | 108 | [graph] 109 | data = "#8EC07C" 110 | title = "#458588" 111 | axis = "#B16286" 112 | 113 | [cursor] 114 | style = "SteadyBar" # possible options are: DefaultUserShape, BlinkingBlock, SteadyBlock, BlinkingUnderScore, SteadyUnderScore, BlinkingBar, SteadyBar, 115 | 116 | [modes] 117 | default_mode = "normal" # possible modes are "normal"|"uppercase"|"punctuation", combinations of modes is also possible e.g: "uppercase, punctuation" 118 | uppercase_chance = "3" # possible are values between 0 and 1, if value is too high it gets clamped to 1, if too low it gets clamped to 0 119 | punctuation_chance = "0.5" # possible are values between 0 and 1, if value is too high it gets clamped to 1, if too low it gets clamped to 0 120 | 121 | [language] 122 | lang = "english" # select your desired language 123 | ``` 124 | 125 | To apply the configuration, you can either edit the `config.toml` file directly or use the `typy -c` command to to open the file in your preferred editor: 126 | 127 | ```bash 128 | typy -c 129 | ``` 130 | 131 | This allows you to customize the appearance of Typy to match your preferences. 132 | 133 | ## Stats 134 | The stats are saved in a file located at `~/.local/share/typy/stats.json`. The stats file tracks the stats of the past 10 games. Also it shows the average WPM, 135 | RAW and accuracy of the all games played. 136 | To check your stats you can use the `typy --stats` command. 137 | 138 | ```bash 139 | typy -s 140 | ``` 141 | This will display the stats of the last 10 games and looks something like this: 142 | ![Stats](./docs/assets/snapshot_2025-02-24_00-28-16.png) 143 | To close this view press `Ctrl + c` or `esc`. 144 | 145 | ## Language 146 | The language files are located at `~/.local/share/typy/`. The default language is `english`. You can change the language by editing the `config.toml` file or by using the 147 | `typy -c` command. If you want to add a new language you can create a new file in the `~/.local/share/typy/` directory and add the words in the following format: 148 | ```txt 149 | word1 150 | word2 151 | ... 152 | ``` 153 | The language file should be named after the language you want to add. For example, if you want to add a German language file, you would create a file named `german.txt` and add the German words to it. 154 | If you want to use the new language you need to change the `lang` field in the `config.toml` file to the name of the language file without the `.txt` extension. 155 | If you want to provide a new language to the Typy repository, feel free to create a pull request. Atm I only have the `english.txt` file in the repository. 156 | 157 | ## Uninstall 158 | ```bash 159 | cargo uninstall typy 160 | ``` 161 | -------------------------------------------------------------------------------- /docs/assets/2025-02-11 00-03-13.mkv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pazl27/typy-cli/0eb751cee5af85b39bfd331995b79dd5241468aa/docs/assets/2025-02-11 00-03-13.mkv -------------------------------------------------------------------------------- /docs/assets/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pazl27/typy-cli/0eb751cee5af85b39bfd331995b79dd5241468aa/docs/assets/demo.gif -------------------------------------------------------------------------------- /docs/assets/snapshot_2025-02-24_00-28-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pazl27/typy-cli/0eb751cee5af85b39bfd331995b79dd5241468aa/docs/assets/snapshot_2025-02-24_00-28-16.png -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-utils": { 4 | "inputs": { 5 | "systems": "systems" 6 | }, 7 | "locked": { 8 | "lastModified": 1731533236, 9 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 10 | "owner": "numtide", 11 | "repo": "flake-utils", 12 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 13 | "type": "github" 14 | }, 15 | "original": { 16 | "owner": "numtide", 17 | "repo": "flake-utils", 18 | "type": "github" 19 | } 20 | }, 21 | "nixpkgs": { 22 | "locked": { 23 | "lastModified": 1743583204, 24 | "narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=", 25 | "owner": "NixOS", 26 | "repo": "nixpkgs", 27 | "rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434", 28 | "type": "github" 29 | }, 30 | "original": { 31 | "owner": "NixOS", 32 | "ref": "nixos-unstable", 33 | "repo": "nixpkgs", 34 | "type": "github" 35 | } 36 | }, 37 | "root": { 38 | "inputs": { 39 | "flake-utils": "flake-utils", 40 | "nixpkgs": "nixpkgs", 41 | "rust-overlay": "rust-overlay" 42 | } 43 | }, 44 | "rust-overlay": { 45 | "inputs": { 46 | "nixpkgs": [ 47 | "nixpkgs" 48 | ] 49 | }, 50 | "locked": { 51 | "lastModified": 1743820323, 52 | "narHash": "sha256-UXxJogXhPhBFaX4uxmMudcD/x3sEGFtoSc4busTcftY=", 53 | "owner": "oxalica", 54 | "repo": "rust-overlay", 55 | "rev": "b4734ce867252f92cdc7d25f8cc3b7cef153e703", 56 | "type": "github" 57 | }, 58 | "original": { 59 | "owner": "oxalica", 60 | "repo": "rust-overlay", 61 | "type": "github" 62 | } 63 | }, 64 | "systems": { 65 | "locked": { 66 | "lastModified": 1681028828, 67 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 68 | "owner": "nix-systems", 69 | "repo": "default", 70 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 71 | "type": "github" 72 | }, 73 | "original": { 74 | "owner": "nix-systems", 75 | "repo": "default", 76 | "type": "github" 77 | } 78 | } 79 | }, 80 | "root": "root", 81 | "version": 7 82 | } 83 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "typy-cli - Minimalistic Monkeytype clone for the CLI"; 3 | inputs = { 4 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 5 | rust-overlay = { 6 | url = "github:oxalica/rust-overlay"; 7 | inputs.nixpkgs.follows = "nixpkgs"; 8 | }; 9 | flake-utils.url = "github:numtide/flake-utils"; 10 | }; 11 | outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: 12 | flake-utils.lib.eachDefaultSystem (system: 13 | let 14 | overlays = [ (import rust-overlay) ]; 15 | pkgs = import nixpkgs { 16 | inherit system overlays; 17 | }; 18 | 19 | buildInputs = with pkgs; [ ]; 20 | 21 | nativeBuildInputs = with pkgs; [ 22 | rust-bin.stable.latest.default 23 | pkg-config 24 | makeWrapper 25 | ]; 26 | 27 | in 28 | { 29 | packages.default = pkgs.rustPlatform.buildRustPackage { 30 | pname = "typy-cli"; 31 | version = "0.7.0"; 32 | src = ./.; 33 | cargoLock = { 34 | lockFile = ./Cargo.lock; 35 | }; 36 | inherit buildInputs nativeBuildInputs; 37 | postInstall = '' 38 | mkdir -p $out/share/typy 39 | cp $src/resources/english.txt $out/share/typy/english.txt 40 | 41 | wrapProgram $out/bin/typy \ 42 | --run "mkdir -p ~/.local/share/typy" \ 43 | --run "cp -n $out/share/typy/english.txt ~/.local/share/typy/english.txt" 44 | ''; 45 | 46 | meta = with pkgs.lib; { 47 | description = "typy-cli - Minimalistic Monkeytype clone for the CLI"; 48 | homepage = "https://github.com/Pazl27/typy-cli"; 49 | license = licenses.mit; 50 | }; 51 | }; 52 | } 53 | ); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /src/config/config_tables/cursor_style.rs: -------------------------------------------------------------------------------- 1 | use crossterm::cursor::SetCursorStyle; 2 | 3 | use crate::config::toml_parser::get_config; 4 | use crate::config::toml_parser::CursorTable; 5 | 6 | pub struct CursorKind { 7 | pub style: SetCursorStyle, 8 | } 9 | 10 | impl CursorKind { 11 | pub fn new() -> Self { 12 | let cursor_table: CursorTable = 13 | get_config() 14 | .lock() 15 | .unwrap() 16 | .get_cursor() 17 | .unwrap_or(CursorTable { 18 | style: Some("DefaultUserShape".to_owned()), 19 | }); 20 | 21 | let cursor_kind = match cursor_table.style.as_deref() { 22 | Some("DefaultUserShape") => SetCursorStyle::DefaultUserShape, 23 | Some("BlinkingBlock") => SetCursorStyle::BlinkingBlock, 24 | Some("SteadyBlock") => SetCursorStyle::SteadyBlock, 25 | Some("BlinkingUnderScore") => SetCursorStyle::BlinkingUnderScore, 26 | Some("SteadyUnderScore") => SetCursorStyle::SteadyUnderScore, 27 | Some("BlinkingBar") => SetCursorStyle::BlinkingBar, 28 | Some("SteadyBar") => SetCursorStyle::SteadyBar, 29 | _ => SetCursorStyle::DefaultUserShape, 30 | }; 31 | 32 | CursorKind { style: cursor_kind } 33 | } 34 | } 35 | 36 | impl Default for CursorKind { 37 | fn default() -> Self { 38 | CursorKind { 39 | style: SetCursorStyle::DefaultUserShape, 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/config/config_tables/graph_colors.rs: -------------------------------------------------------------------------------- 1 | use tui::style::Color; 2 | 3 | use crate::config::toml_parser::get_config; 4 | 5 | pub struct Graph { 6 | pub data: Color, 7 | pub title: Color, 8 | pub axis: Color, 9 | } 10 | 11 | impl Graph { 12 | pub fn new() -> Self { 13 | let theme_colors: Graph = match get_config().lock().unwrap().get_graph() { 14 | Some(colors) => { 15 | let data = colors 16 | .data 17 | .and_then(|c| hex_to_rgb(&c)) 18 | .unwrap_or(Color::Yellow); 19 | let title = colors 20 | .title 21 | .and_then(|c| hex_to_rgb(&c)) 22 | .unwrap_or(Color::Red); 23 | let axis = colors 24 | .axis 25 | .and_then(|c| hex_to_rgb(&c)) 26 | .unwrap_or(Color::White); 27 | 28 | Graph { data, title, axis } 29 | } 30 | None => Graph::default(), 31 | }; 32 | theme_colors 33 | } 34 | } 35 | 36 | impl Default for Graph { 37 | fn default() -> Self { 38 | Graph { 39 | data: Color::Yellow, 40 | title: Color::Red, 41 | axis: Color::White, 42 | } 43 | } 44 | } 45 | 46 | fn hex_to_rgb(hex: &str) -> Option { 47 | if hex.len() == 7 && hex.starts_with('#') { 48 | let r = u8::from_str_radix(&hex[1..3], 16).ok()?; 49 | let g = u8::from_str_radix(&hex[3..5], 16).ok()?; 50 | let b = u8::from_str_radix(&hex[5..7], 16).ok()?; 51 | Some(Color::Rgb(r, g, b)) 52 | } else { 53 | None 54 | } 55 | } 56 | 57 | #[cfg(test)] 58 | mod graph_tests { 59 | use super::*; 60 | 61 | #[test] 62 | fn test_hex_to_rgb() { 63 | assert_eq!(hex_to_rgb("#FFFFFF"), Some(Color::Rgb(255, 255, 255))); 64 | assert_eq!(hex_to_rgb("#000000"), Some(Color::Rgb(0, 0, 0))); 65 | assert_eq!(hex_to_rgb("#FF0000"), Some(Color::Rgb(255, 0, 0))); 66 | assert_eq!(hex_to_rgb("#00FF00"), Some(Color::Rgb(0, 255, 0))); 67 | assert_eq!(hex_to_rgb("#0000FF"), Some(Color::Rgb(0, 0, 255))); 68 | assert_eq!(hex_to_rgb("#123456"), Some(Color::Rgb(18, 52, 86))); 69 | assert_eq!(hex_to_rgb("123456"), None); 70 | assert_eq!(hex_to_rgb("#12345G"), None); 71 | assert_eq!(hex_to_rgb("#12345"), None); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/config/config_tables/language.rs: -------------------------------------------------------------------------------- 1 | use crate::config::toml_parser::get_config; 2 | 3 | pub struct Language { 4 | pub lang: String, 5 | } 6 | 7 | impl Language { 8 | pub fn new() -> Self { 9 | let theme_colors: Language = match get_config().lock().unwrap().get_language() { 10 | Some(language) => { 11 | let lang = language.lang.unwrap_or("english".to_string()); 12 | 13 | Language { lang } 14 | } 15 | None => Language::default(), 16 | }; 17 | theme_colors 18 | } 19 | } 20 | 21 | impl Default for Language { 22 | fn default() -> Self { 23 | Language { 24 | lang: "english".to_string(), 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/config/config_tables/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod cursor_style; 2 | pub mod graph_colors; 3 | pub mod mode_settings; 4 | pub mod theme; 5 | pub mod language; 6 | -------------------------------------------------------------------------------- /src/config/config_tables/mode_settings.rs: -------------------------------------------------------------------------------- 1 | use crate::config::toml_parser::get_config; 2 | use crate::mode::ModeType; 3 | use std::str::FromStr; 4 | 5 | #[derive(Debug)] 6 | pub struct ModeSettings { 7 | pub default_modes: Vec, 8 | pub uppercase_chance: f32, 9 | pub punctuation_chance: f32, 10 | } 11 | 12 | impl ModeSettings { 13 | pub fn new() -> Self { 14 | let theme_colors: ModeSettings = match get_config().lock().unwrap().get_modes() { 15 | Some(settings) => { 16 | let default_modes = settings 17 | .default_mode 18 | .map(|m| { 19 | let modes: Vec = m 20 | .split(',') 21 | .filter_map(|mode| ModeType::from_str(mode.trim()).ok()) 22 | .collect(); 23 | if modes.contains(&ModeType::Normal) { 24 | vec![ModeType::Normal] 25 | } else { 26 | modes 27 | } 28 | }) 29 | .unwrap_or(vec![ModeType::Normal]); 30 | let uppercase_chance = settings 31 | .uppercase_chance 32 | .and_then(|c| c.parse::().ok()) 33 | .map(|c| c.clamp(0.0, 1.0)) 34 | .unwrap_or(0.2); 35 | let punctuation_chance = settings 36 | .punctuation_chance 37 | .and_then(|c| c.parse::().ok()) 38 | .map(|c| c.clamp(0.0, 1.0)) 39 | .unwrap_or(0.2); 40 | 41 | ModeSettings { 42 | default_modes, 43 | uppercase_chance, 44 | punctuation_chance, 45 | } 46 | } 47 | None => ModeSettings::default(), 48 | }; 49 | theme_colors 50 | } 51 | } 52 | 53 | impl Default for ModeSettings { 54 | fn default() -> Self { 55 | ModeSettings { 56 | default_modes: vec![ModeType::Normal], 57 | uppercase_chance: 0.2, 58 | punctuation_chance: 0.2, 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/config/config_tables/theme.rs: -------------------------------------------------------------------------------- 1 | use crossterm::style::Color; 2 | 3 | use crate::config::toml_parser::get_config; 4 | 5 | #[derive(Debug)] 6 | pub struct ThemeColors { 7 | pub fg: Color, 8 | pub missing: Color, 9 | pub error: Color, 10 | pub accent: Color, 11 | } 12 | 13 | impl ThemeColors { 14 | pub fn new() -> Self { 15 | let theme_colors: ThemeColors = match get_config().lock().unwrap().get_theme() { 16 | Some(colors) => { 17 | let fg = colors 18 | .fg 19 | .and_then(|c| hex_to_rgb(&c)) 20 | .unwrap_or(Color::White); 21 | let missing = colors 22 | .missing 23 | .and_then(|c| hex_to_rgb(&c)) 24 | .unwrap_or(Color::Grey); 25 | let error = colors 26 | .error 27 | .and_then(|c| hex_to_rgb(&c)) 28 | .unwrap_or(Color::Red); 29 | let accent = colors 30 | .accent 31 | .and_then(|c| hex_to_rgb(&c)) 32 | .unwrap_or(Color::Yellow); 33 | 34 | ThemeColors { 35 | fg, 36 | missing, 37 | error, 38 | accent, 39 | } 40 | } 41 | None => ThemeColors::default(), 42 | }; 43 | theme_colors 44 | } 45 | } 46 | 47 | impl Default for ThemeColors { 48 | fn default() -> Self { 49 | ThemeColors { 50 | fg: Color::White, 51 | missing: Color::Grey, 52 | error: Color::Red, 53 | accent: Color::Yellow, 54 | } 55 | } 56 | } 57 | 58 | fn hex_to_rgb(hex: &str) -> Option { 59 | if hex.len() == 7 && hex.starts_with('#') { 60 | let r = u8::from_str_radix(&hex[1..3], 16).ok()?; 61 | let g = u8::from_str_radix(&hex[3..5], 16).ok()?; 62 | let b = u8::from_str_radix(&hex[5..7], 16).ok()?; 63 | Some(Color::Rgb { r, g, b }) 64 | } else { 65 | None 66 | } 67 | } 68 | 69 | #[cfg(test)] 70 | mod theme_tests { 71 | use super::*; 72 | 73 | #[test] 74 | fn test_hex_to_rgb() { 75 | assert_eq!( 76 | hex_to_rgb("#ffffff"), 77 | Some(Color::Rgb { 78 | r: 255, 79 | g: 255, 80 | b: 255 81 | }) 82 | ); 83 | assert_eq!(hex_to_rgb("#000000"), Some(Color::Rgb { r: 0, g: 0, b: 0 })); 84 | assert_eq!( 85 | hex_to_rgb("#ff0000"), 86 | Some(Color::Rgb { r: 255, g: 0, b: 0 }) 87 | ); 88 | assert_eq!( 89 | hex_to_rgb("#00ff00"), 90 | Some(Color::Rgb { r: 0, g: 255, b: 0 }) 91 | ); 92 | assert_eq!( 93 | hex_to_rgb("#0000ff"), 94 | Some(Color::Rgb { r: 0, g: 0, b: 255 }) 95 | ); 96 | assert_eq!( 97 | hex_to_rgb("#123456"), 98 | Some(Color::Rgb { 99 | r: 18, 100 | g: 52, 101 | b: 86 102 | }) 103 | ); 104 | assert_eq!( 105 | hex_to_rgb("#abcdef"), 106 | Some(Color::Rgb { 107 | r: 171, 108 | g: 205, 109 | b: 239 110 | }) 111 | ); 112 | assert_eq!(hex_to_rgb("#12345"), None); 113 | assert_eq!(hex_to_rgb("#1234567"), None); 114 | assert_eq!(hex_to_rgb("123456"), None); 115 | assert_eq!(hex_to_rgb("#12345g"), None); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/config/config_utils.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{Context, Result}; 2 | use dirs::home_dir; 3 | use std::{fs, io::Write, process::Command}; 4 | 5 | pub fn create_config() -> Result<()> { 6 | if let Some(home_path) = home_dir() { 7 | let config_dir = home_path.join(".config/typy"); 8 | let config_file = config_dir.join("config.toml"); 9 | 10 | if !config_dir.exists() { 11 | fs::create_dir_all(&config_dir).context("Failed to create config directory")?; 12 | } 13 | 14 | if !config_file.exists() { 15 | let mut file = 16 | fs::File::create(&config_file).context("Failed to create config file")?; 17 | 18 | file.write_all(b"# For more information about the configuration check:\n# https://github.com/Pazl27/typy-cli?tab=readme-ov-file#configuration") 19 | .context("Failed to write to config file")?; 20 | } 21 | } else { 22 | eprintln!("Failed to get home directory"); 23 | } 24 | Ok(()) 25 | } 26 | 27 | pub fn open_config() -> Result<()> { 28 | if let Some(home_path) = home_dir() { 29 | let config_dir = home_path.join(".config/typy"); 30 | let config_file = config_dir.join("config.toml"); 31 | 32 | if !config_file.exists() { 33 | eprintln!("Config file doesn't exist"); 34 | return Ok(()); 35 | } 36 | 37 | let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string()); 38 | Command::new(editor.clone()) 39 | .arg(config_file) 40 | .status() 41 | .with_context(|| format!("Failed to open config file with editor: {}", editor))?; 42 | } else { 43 | eprintln!("Failed to get home directory"); 44 | } 45 | Ok(()) 46 | } 47 | -------------------------------------------------------------------------------- /src/config/mod.rs: -------------------------------------------------------------------------------- 1 | mod config_tables; 2 | mod config_utils; 3 | pub mod toml_parser; 4 | 5 | pub use config_tables::*; 6 | pub use config_utils::*; 7 | -------------------------------------------------------------------------------- /src/config/toml_parser.rs: -------------------------------------------------------------------------------- 1 | use dirs::home_dir; 2 | use lazy_static::lazy_static; 3 | use serde::{Deserialize, Serialize}; 4 | use std::fs; 5 | use std::path::PathBuf; 6 | use std::sync::Mutex; 7 | use toml; 8 | 9 | #[derive(Serialize, Deserialize, Clone)] 10 | pub struct ThemeTable { 11 | pub fg: Option, 12 | pub missing: Option, 13 | pub error: Option, 14 | pub accent: Option, 15 | } 16 | 17 | #[derive(Serialize, Deserialize, Clone)] 18 | pub struct GraphTable { 19 | pub data: Option, 20 | pub title: Option, 21 | pub axis: Option, 22 | } 23 | 24 | #[derive(Serialize, Deserialize, Clone)] 25 | pub struct CursorTable { 26 | pub style: Option, 27 | } 28 | 29 | #[derive(Serialize, Deserialize, Clone)] 30 | pub struct ModesTable { 31 | pub default_mode: Option, 32 | pub uppercase_chance: Option, 33 | pub punctuation_chance: Option, 34 | } 35 | 36 | #[derive(Serialize, Deserialize, Clone)] 37 | pub struct LanguageTable { 38 | pub lang: Option, 39 | } 40 | 41 | #[derive(Serialize, Deserialize, Default)] 42 | pub struct ConfigToml { 43 | theme: Option, 44 | graph: Option, 45 | cursor: Option, 46 | modes: Option, 47 | language: Option, 48 | } 49 | 50 | impl ConfigToml { 51 | pub fn new() -> Self { 52 | let mut config_filepaths: Vec = vec![PathBuf::from("./config.toml")]; 53 | 54 | if let Some(home_path) = home_dir() { 55 | config_filepaths.push(home_path.join(".config/typy/config.toml")); 56 | } 57 | 58 | let mut content = "".to_owned(); 59 | 60 | for filepath in config_filepaths { 61 | let result = fs::read_to_string(filepath); 62 | 63 | if result.is_ok() { 64 | content = result.unwrap(); 65 | break; 66 | } 67 | } 68 | let config_toml: ConfigToml = 69 | toml::from_str(&content).unwrap_or_else(|_| ConfigToml::default()); 70 | config_toml 71 | } 72 | 73 | pub fn get_theme(&self) -> Option { 74 | self.theme.clone() 75 | } 76 | 77 | pub fn get_graph(&self) -> Option { 78 | self.graph.clone() 79 | } 80 | 81 | pub fn get_cursor(&self) -> Option { 82 | self.cursor.clone() 83 | } 84 | 85 | pub fn get_modes(&self) -> Option { 86 | self.modes.clone() 87 | } 88 | 89 | pub fn get_language(&self) -> Option { 90 | self.language.clone() 91 | } 92 | } 93 | 94 | // Declare the static instance of ConfigToml using lazy_static 95 | lazy_static! { 96 | static ref CONFIG: Mutex = Mutex::new(ConfigToml::new()); 97 | } 98 | 99 | // Helper function to access the static CONFIG 100 | pub fn get_config() -> &'static Mutex { 101 | &CONFIG 102 | } 103 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod config; 2 | mod mode; 3 | mod scores; 4 | mod terminal; 5 | mod word_provider; 6 | 7 | use anyhow::{Context, Result}; 8 | use clap::Parser; 9 | use mode::Mode; 10 | use scores::progress::display; 11 | 12 | #[derive(Parser)] 13 | #[command(name = "typy")] 14 | #[command(version = "0.1.0")] 15 | #[command(author = "Pazl27")] 16 | #[command( 17 | about = "Monkeytype clone in the terminal for more information check: https://github.com/Pazl27/typy-cli" 18 | )] 19 | #[command(long_about = None)] 20 | struct Cli { 21 | #[arg( 22 | short = 't', 23 | long = "time", 24 | default_value = "30", 25 | help = "Duration of the game" 26 | )] 27 | time: u64, 28 | 29 | #[arg(short = 's', long = "stats", help = "Display game stats")] 30 | stats: bool, 31 | 32 | #[arg(short = 'c', long = "config", help = "Create and open config file")] 33 | config: bool, 34 | 35 | #[arg(short = 'm', long = "mode", num_args = 1.., help = "Sets the mode of the game")] 36 | mode: Vec, 37 | } 38 | 39 | fn main() -> Result<()> { 40 | let cli = Cli::parse(); 41 | 42 | let duration: u64 = cli.time; 43 | 44 | let theme = config::theme::ThemeColors::new(); 45 | 46 | if cli.config { 47 | config::create_config()?; 48 | config::open_config()?; 49 | return Ok(()); 50 | } 51 | 52 | if cli.stats { 53 | display::draw()?; 54 | return Ok(()); 55 | } 56 | 57 | let mut mode_strs: Vec<&str> = cli.mode.iter().map(|s| s.as_str()).collect(); 58 | mode_strs.is_empty().then(|| mode_strs.clear()); 59 | 60 | let mode = Mode::from_str(mode_strs) 61 | .context("Failed to parse mode")? 62 | .add_duration(duration); 63 | 64 | terminal::run(mode, theme)?; 65 | 66 | Ok(()) 67 | } 68 | -------------------------------------------------------------------------------- /src/mode/mod.rs: -------------------------------------------------------------------------------- 1 | mod mode_selector; 2 | 3 | pub use mode_selector::{Mode, ModeType}; 4 | -------------------------------------------------------------------------------- /src/mode/mode_selector.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Result; 2 | use rand::Rng; 3 | use std::str::FromStr; 4 | 5 | use crate::config::mode_settings::ModeSettings; 6 | 7 | #[derive(Debug, PartialEq, Clone)] 8 | pub enum ModeType { 9 | Normal, 10 | Uppercase, 11 | Punctuation, 12 | } 13 | 14 | impl FromStr for ModeType { 15 | type Err = (); 16 | 17 | fn from_str(input: &str) -> Result { 18 | match input { 19 | "uppercase" => Ok(ModeType::Uppercase), 20 | "punctuation" => Ok(ModeType::Punctuation), 21 | "normal" => Ok(ModeType::Normal), 22 | _ => Err(()), 23 | } 24 | } 25 | } 26 | 27 | #[derive(Debug)] 28 | pub struct Mode { 29 | modes: Vec, 30 | pub duration: u64, 31 | settings: ModeSettings, 32 | } 33 | 34 | impl Mode { 35 | pub fn from_str(mode_strs: Vec<&str>) -> Result { 36 | let mut modes = Vec::new(); 37 | let settings = ModeSettings::new(); 38 | 39 | for mode_str in mode_strs { 40 | match mode_str { 41 | "normal" => modes.push(ModeType::Normal), 42 | "uppercase" => modes.push(ModeType::Uppercase), 43 | "punctuation" => modes.push(ModeType::Punctuation), 44 | _ => return Err(anyhow::anyhow!("Invalid mode: {}", mode_str)), 45 | } 46 | } 47 | 48 | // If no specific mode is provided, default to normal 49 | modes.is_empty().then(|| { 50 | settings.default_modes.iter().for_each(|m| { 51 | modes.push(m.clone()); 52 | }); 53 | }); 54 | 55 | modes.contains(&ModeType::Normal).then(|| { 56 | modes.clear(); 57 | modes.push(ModeType::Normal); 58 | }); 59 | 60 | Ok(Mode { 61 | modes, 62 | duration: 0, 63 | settings, 64 | }) 65 | } 66 | 67 | pub fn add_duration(mut self, duration: u64) -> Self { 68 | self.duration = duration; 69 | self 70 | } 71 | 72 | pub fn transform(&self, list: &mut [Vec]) { 73 | let mut rng = rand::rng(); 74 | let punctuations = [".", ",", "!", "?", ";", ":", "-"]; 75 | 76 | for mode in &self.modes { 77 | match mode { 78 | ModeType::Uppercase => { 79 | for sublist in list.iter_mut() { 80 | for item in sublist.iter_mut() { 81 | let mut new_item = String::new(); 82 | for c in item.chars() { 83 | if rng.random_bool(self.settings.uppercase_chance.into()) { 84 | new_item.push(c.to_uppercase().next().unwrap()); 85 | } else { 86 | new_item.push(c); 87 | } 88 | } 89 | *item = new_item; 90 | } 91 | } 92 | } 93 | ModeType::Punctuation => { 94 | for sublist in list.iter_mut() { 95 | let len = sublist.len(); 96 | if len > 1 { 97 | for item in sublist.iter_mut().take(len - 1) { 98 | if rng.random_bool(self.settings.punctuation_chance.into()) { 99 | let punctuation = 100 | punctuations[rng.random_range(0..punctuations.len())]; 101 | item.push_str(punctuation); 102 | } 103 | } 104 | } 105 | } 106 | } 107 | ModeType::Normal => {} 108 | } 109 | } 110 | } 111 | } 112 | 113 | #[cfg(test)] 114 | mod mode_tests { 115 | use super::*; 116 | 117 | #[test] 118 | fn test_from_str_valid_mode() { 119 | let mode = Mode::from_str(vec!["normal", "uppercase", "punctuation"]).unwrap(); 120 | assert_eq!(mode.modes, vec![ModeType::Normal]); 121 | } 122 | 123 | #[test] 124 | fn test_from_str_valid_modes() { 125 | let mode = Mode::from_str(vec!["uppercase", "punctuation"]).unwrap(); 126 | assert_eq!(mode.modes, vec![ModeType::Uppercase, ModeType::Punctuation]); 127 | } 128 | 129 | #[test] 130 | fn test_from_str_invalid_mode() { 131 | let mode = Mode::from_str(vec!["invalid"]); 132 | assert!(mode.is_err()); 133 | } 134 | 135 | #[test] 136 | fn test_add_duration() { 137 | let mode = Mode::from_str(vec!["normal"]).unwrap().add_duration(10); 138 | assert_eq!(mode.modes, vec![ModeType::Normal]); 139 | assert_eq!(mode.duration, 10); 140 | } 141 | 142 | #[test] 143 | fn test_transform_uppercase() { 144 | let mode = Mode::from_str(vec!["uppercase"]).unwrap(); 145 | let mut list = vec![vec!["hello".to_string(), "world".to_string()]]; 146 | mode.transform(&mut list); 147 | // Since the transformation is random, we can't assert exact values, but we can check the structure 148 | assert_eq!(list.len(), 1); 149 | assert_eq!(list[0].len(), 2); 150 | } 151 | 152 | #[test] 153 | fn test_transform_punctuation() { 154 | let mode = Mode::from_str(vec!["punctuation"]).unwrap(); 155 | let mut list = vec![vec!["hello".to_string(), "world".to_string()]]; 156 | mode.transform(&mut list); 157 | // Since the transformation is random, we can't assert exact values, but we can check the structure 158 | assert_eq!(list.len(), 1); 159 | assert_eq!(list[0].len(), 2); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/scores/finish_overview.rs: -------------------------------------------------------------------------------- 1 | use crate::scores::graph; 2 | use anyhow::{Context, Result}; 3 | use crossterm::cursor::MoveTo; 4 | use crossterm::event::{read, Event, KeyEvent}; 5 | use crossterm::style::SetForegroundColor; 6 | use crossterm::terminal::{Clear, ClearType}; 7 | use crossterm::ExecutableCommand; 8 | 9 | use crate::config::theme::ThemeColors; 10 | use crate::scores::Stats; 11 | use crate::terminal; 12 | 13 | pub fn show_stats(mut stdout: &std::io::Stdout, stats: Stats, theme: &ThemeColors) -> Result<()> { 14 | stdout 15 | .execute(Clear(ClearType::All)) 16 | .context("Failed to clear terminal")?; 17 | 18 | // Draw infos 19 | stdout 20 | .execute(MoveTo(15, 16)) 21 | .context("Failed to move cursor")?; 22 | stdout 23 | .execute(SetForegroundColor(theme.missing)) 24 | .context("Failed to set foreground color")?; 25 | print!("WPM"); 26 | stdout 27 | .execute(MoveTo(15, 17)) 28 | .context("Failed to move cursor")?; 29 | stdout 30 | .execute(SetForegroundColor(theme.accent)) 31 | .context("Failed to set foreground color")?; 32 | print!("{:02}", stats.wpm() as i32); 33 | stdout 34 | .execute(MoveTo(15, 20)) 35 | .context("Failed to move cursor")?; 36 | stdout 37 | .execute(SetForegroundColor(theme.missing)) 38 | .context("Failed to set foreground color")?; 39 | print!("RAW"); 40 | stdout 41 | .execute(MoveTo(15, 21)) 42 | .context("Failed to move cursor")?; 43 | stdout 44 | .execute(SetForegroundColor(theme.accent)) 45 | .context("Failed to set foreground color")?; 46 | print!("{:02}", stats.raw_wpm() as i32); 47 | stdout 48 | .execute(MoveTo(37, 25)) 49 | .context("Failed to move cursor")?; 50 | stdout 51 | .execute(SetForegroundColor(theme.accent)) 52 | .context("Failed to set foreground color")?; 53 | print!("ACCURACY: {:.2}%", stats.accuracy()); 54 | 55 | graph::draw_graph(stats.lps).context("Failed to draw graph")?; 56 | 57 | loop { 58 | if let Ok(Event::Key(KeyEvent { 59 | code, modifiers, .. 60 | })) = read() 61 | { 62 | if terminal::close_typy(&code, &modifiers).is_some() { 63 | break; 64 | } 65 | } 66 | } 67 | 68 | Ok(()) 69 | } 70 | -------------------------------------------------------------------------------- /src/scores/graph.rs: -------------------------------------------------------------------------------- 1 | use std::io; 2 | use tui::backend::CrosstermBackend; 3 | use tui::layout::Rect; 4 | use tui::style::Style; 5 | use tui::symbols::{self}; 6 | use tui::text::Span; 7 | use tui::widgets::Chart; 8 | use tui::widgets::Dataset; 9 | use tui::widgets::{Axis, GraphType}; 10 | use tui::Terminal; 11 | 12 | use crate::config::graph_colors::Graph; 13 | use anyhow::Result; 14 | 15 | pub fn draw_graph(data: Vec) -> Result<(), io::Error> { 16 | let stdout = io::stdout(); 17 | let backend = CrosstermBackend::new(stdout); 18 | let mut terminal = Terminal::new(backend)?; 19 | 20 | let graph_colors = Graph::new(); 21 | 22 | terminal.draw(|f| { 23 | let size = f.size(); 24 | 25 | let converted_data = data 26 | .iter() 27 | .enumerate() 28 | .map(|(i, &x)| (i as f64, x as f64)) 29 | .collect::>(); 30 | 31 | let datasets = vec![Dataset::default() 32 | .marker(symbols::Marker::Braille) 33 | .graph_type(GraphType::Line) 34 | .style(Style::default().fg(graph_colors.data)) 35 | .data(&converted_data)]; 36 | 37 | let end = data.len().to_string(); 38 | let max_y = data.iter().max().unwrap().to_string(); 39 | let chart = Chart::new(datasets) 40 | .x_axis( 41 | Axis::default() 42 | .title(Span::styled( 43 | "time in s", 44 | Style::default().fg(graph_colors.title), 45 | )) 46 | .style(Style::default().fg(graph_colors.axis)) 47 | .bounds([0.0, 10.0]) 48 | .labels( 49 | ["0", end.as_str()] 50 | .iter() 51 | .cloned() 52 | .map(Span::from) 53 | .collect(), 54 | ), 55 | ) 56 | .y_axis( 57 | Axis::default() 58 | .title(Span::styled( 59 | "letters", 60 | Style::default().fg(graph_colors.title), 61 | )) 62 | .style(Style::default().fg(graph_colors.axis)) 63 | .bounds([0.0, 10.0]) 64 | .labels( 65 | ["0", max_y.as_str()] 66 | .iter() 67 | .cloned() 68 | .map(Span::from) 69 | .collect(), 70 | ), 71 | ); 72 | let area = Rect::new( 73 | (size.width.saturating_sub(100)) / 2, 74 | (size.height.saturating_sub(10)) / 2, 75 | 100, 76 | 10, 77 | ); 78 | 79 | f.render_widget(chart, area); 80 | })?; 81 | 82 | Ok(()) 83 | } 84 | -------------------------------------------------------------------------------- /src/scores/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod finish_overview; 2 | mod graph; 3 | pub mod progress; 4 | mod stats; 5 | 6 | pub use stats::Stats; 7 | -------------------------------------------------------------------------------- /src/scores/progress/data.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{Context, Result}; 2 | use chrono::NaiveDateTime; 3 | use serde::{Deserialize, Serialize}; 4 | use serde_json::to_writer_pretty; 5 | use std::fs::{self, File}; 6 | 7 | #[derive(Debug, Serialize, Deserialize)] 8 | pub struct Averages { 9 | pub wpm_avg: WpmAvg, 10 | pub raw_avg: RawAvg, 11 | pub accuracy_avg: AccuracyAvg, 12 | } 13 | 14 | #[derive(Debug, Serialize, Deserialize)] 15 | pub struct WpmAvg { 16 | pub avg: f32, 17 | count: u32, 18 | sum_all: u32, 19 | } 20 | 21 | #[derive(Debug, Serialize, Deserialize)] 22 | pub struct RawAvg { 23 | pub avg: f32, 24 | count: u32, 25 | sum_all: u32, 26 | } 27 | 28 | #[derive(Debug, Serialize, Deserialize)] 29 | pub struct AccuracyAvg { 30 | pub avg: f32, 31 | count: u32, 32 | sum_all: f32, 33 | } 34 | 35 | #[derive(Debug, Clone, Serialize, Deserialize)] 36 | pub struct Score { 37 | pub timestamp: NaiveDateTime, 38 | pub wpm: u32, 39 | pub raw: u32, 40 | pub accuracy: f32, 41 | } 42 | 43 | #[derive(Debug, Serialize, Deserialize)] 44 | pub struct Data { 45 | pub scores: Vec, 46 | pub averages: Averages, 47 | } 48 | 49 | impl Data { 50 | fn new(scores: Vec, averages: Averages) -> Self { 51 | Data { scores, averages } 52 | } 53 | 54 | pub fn save_data(score: Score) -> Result<()> { 55 | let scores = Score::update_scores(&score)?; 56 | let averages = Averages::new(score)?; 57 | 58 | let data = Data::new(scores, averages); 59 | Self::write_to_file(data)?; 60 | Ok(()) 61 | } 62 | 63 | pub fn get_data() -> Result { 64 | let mut path = dirs::home_dir().context("Failed to get home directory")?; 65 | path.push(".local/share/typy/scores.json"); 66 | 67 | if !path.exists() { 68 | if let Some(parent) = path.parent() { 69 | fs::create_dir_all(parent).context("Failed to create directories")?; 70 | } 71 | File::create(&path).context("Failed to create scores.json file")?; 72 | } 73 | 74 | let file = File::open(&path).context("Failed to open scores.json file")?; 75 | let data: Data = match serde_json::from_reader(file) { 76 | Ok(data) => data, 77 | Err(e) if e.is_eof() => Data::default(), 78 | Err(e) => return Err(e).context("Failed to read scores from file"), 79 | }; 80 | Ok(data) 81 | } 82 | 83 | fn write_to_file(data: Data) -> Result<()> { 84 | let mut path = dirs::home_dir().context("Failed to get home directory")?; 85 | path.push(".local/share/typy/scores.json"); 86 | 87 | if !path.exists() { 88 | return Err(anyhow::anyhow!("File does not exist")); 89 | } 90 | 91 | let mut file = File::create(&path).context("Failed to truncate scores.json file")?; 92 | to_writer_pretty(&mut file, &data).context("Failed to write scores to file")?; 93 | 94 | Ok(()) 95 | } 96 | 97 | pub fn get_averages() -> Result { 98 | let data = Data::get_data()?; 99 | Ok(data.averages) 100 | } 101 | 102 | pub fn get_scores() -> Result> { 103 | let data = Data::get_data()?; 104 | Ok(data.scores) 105 | } 106 | } 107 | 108 | impl Default for Data { 109 | fn default() -> Self { 110 | Data { 111 | scores: Vec::new(), 112 | averages: Averages { 113 | wpm_avg: WpmAvg { 114 | avg: 0.0, 115 | count: 0, 116 | sum_all: 0, 117 | }, 118 | raw_avg: RawAvg { 119 | avg: 0.0, 120 | count: 0, 121 | sum_all: 0, 122 | }, 123 | accuracy_avg: AccuracyAvg { 124 | avg: 0.0, 125 | count: 0, 126 | sum_all: 0.0, 127 | }, 128 | }, 129 | } 130 | } 131 | } 132 | 133 | impl Score { 134 | pub fn new(wpm: u32, raw: u32, mut accuracy: f32) -> Score { 135 | if accuracy.is_nan() { 136 | accuracy = 0.0; 137 | } 138 | Score { 139 | timestamp: chrono::Local::now().naive_local(), 140 | wpm, 141 | raw, 142 | accuracy, 143 | } 144 | } 145 | 146 | pub fn get_date(&self) -> String { 147 | self.timestamp.format("%Y-%m-%d").to_string() 148 | } 149 | 150 | pub fn get_time(&self) -> String { 151 | self.timestamp.format("%H:%M:%S").to_string() 152 | } 153 | 154 | pub fn sort_scores(scores: &mut [Score]) { 155 | scores.sort_by(|a, b| b.timestamp.cmp(&a.timestamp)); 156 | } 157 | 158 | fn update_scores(score: &Score) -> Result> { 159 | let mut scores = Data::get_scores()?; 160 | scores.push(score.clone()); 161 | 162 | if scores.len() > 10 { 163 | Self::sort_scores(&mut scores); 164 | Self::cleanup_scores(&mut scores); 165 | } 166 | 167 | Ok(scores) 168 | } 169 | 170 | fn cleanup_scores(scores: &mut Vec) { 171 | scores.truncate(10); 172 | } 173 | } 174 | 175 | impl Averages { 176 | fn new(score: Score) -> Result { 177 | Self::calculate_averages(score) 178 | } 179 | fn calculate_averages(score: Score) -> Result { 180 | let averages = Data::get_averages()?; 181 | let mut wpm_sum = averages.wpm_avg.sum_all; 182 | let mut raw_sum = averages.raw_avg.sum_all; 183 | let mut accuracy_sum = averages.accuracy_avg.sum_all; 184 | 185 | let mut wpm_count = averages.wpm_avg.count; 186 | let mut raw_count = averages.raw_avg.count; 187 | let mut accuracy_count = averages.accuracy_avg.count; 188 | 189 | wpm_sum += score.wpm; 190 | raw_sum += score.raw; 191 | accuracy_sum += score.accuracy; 192 | 193 | wpm_count += 1; 194 | raw_count += 1; 195 | accuracy_count += 1; 196 | 197 | let wpm_avg = WpmAvg { 198 | avg: wpm_sum as f32 / wpm_count as f32, 199 | count: wpm_count, 200 | sum_all: wpm_sum, 201 | }; 202 | 203 | let raw_avg = RawAvg { 204 | avg: raw_sum as f32 / raw_count as f32, 205 | count: raw_count, 206 | sum_all: raw_sum, 207 | }; 208 | 209 | let accuracy_avg = AccuracyAvg { 210 | avg: accuracy_sum / accuracy_count as f32, 211 | count: accuracy_count, 212 | sum_all: accuracy_sum, 213 | }; 214 | 215 | Ok(Averages { 216 | wpm_avg, 217 | raw_avg, 218 | accuracy_avg, 219 | }) 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /src/scores/progress/display.rs: -------------------------------------------------------------------------------- 1 | use std::io::{stdout, Write}; 2 | use std::time::Duration; 3 | 4 | use crate::terminal; 5 | 6 | use super::*; 7 | use anyhow::{Context, Result}; 8 | use comfy_table::presets::UTF8_FULL; 9 | use comfy_table::*; 10 | use crossterm::cursor::MoveTo; 11 | use crossterm::event::{poll, read, Event, KeyEvent}; 12 | use crossterm::style::ResetColor; 13 | use crossterm::terminal::{disable_raw_mode, enable_raw_mode, size, Clear, ClearType}; 14 | use crossterm::{cursor, ExecutableCommand}; 15 | 16 | const TABLE_WIDTH: u16 = 48; 17 | 18 | pub fn draw() -> Result<()> { 19 | let mut stdout = stdout(); 20 | setup_terminal(&mut stdout)?; 21 | 22 | let averages = draw_averages(&mut stdout)?; 23 | draw_progress(&mut stdout, averages)?; 24 | 25 | enable_raw_mode()?; 26 | loop { 27 | if poll(Duration::from_millis(5)).context("Failed to poll for events")? { 28 | if let Ok(Event::Key(KeyEvent { 29 | code, modifiers, .. 30 | })) = read().context("Failed to read event") 31 | { 32 | if let Some(()) = terminal::close_typy(&code, &modifiers) { 33 | break; 34 | } 35 | } 36 | } 37 | } 38 | 39 | reset_terminal(&mut stdout)?; 40 | 41 | Ok(()) 42 | } 43 | 44 | fn draw_averages(stdout: &mut std::io::Stdout) -> Result { 45 | let averages = Data::get_averages()?; 46 | 47 | let mut table = Table::new(); 48 | table 49 | .load_preset(UTF8_FULL) 50 | .set_content_arrangement(ContentArrangement::Dynamic) 51 | .set_width(TABLE_WIDTH) 52 | .set_header(vec![ 53 | Cell::new("Avg: WPM") 54 | .add_attribute(Attribute::Bold) 55 | .set_alignment(CellAlignment::Center), 56 | Cell::new("Avg: RAW") 57 | .add_attribute(Attribute::Bold) 58 | .set_alignment(CellAlignment::Center), 59 | Cell::new("Avg: ACCURACY") 60 | .add_attribute(Attribute::Bold) 61 | .set_alignment(CellAlignment::Center), 62 | ]) 63 | .add_row(vec![ 64 | Cell::new(format!("{:.2}", averages.wpm_avg.avg)).set_alignment(CellAlignment::Center), 65 | Cell::new(format!("{:.2}", averages.raw_avg.avg)).set_alignment(CellAlignment::Center), 66 | Cell::new(format!("{:.2}%", averages.accuracy_avg.avg)) 67 | .set_alignment(CellAlignment::Center), 68 | ]); 69 | 70 | let (cols, _) = size()?; 71 | let x = cols / 2 - (39 / 2); 72 | let y = 8; 73 | 74 | stdout 75 | .execute(MoveTo(x, y)) 76 | .context("Failed to move cursor")?; 77 | 78 | let table_string = table.to_string(); 79 | let lines: Vec<&str> = table_string.lines().collect(); 80 | 81 | for (i, line) in lines.iter().enumerate() { 82 | stdout 83 | .execute(MoveTo(x, y + i as u16)) 84 | .context("Failed to move cursor")?; 85 | write!(stdout, "{}", line)?; 86 | } 87 | stdout.flush()?; 88 | 89 | Ok(averages) 90 | } 91 | 92 | fn draw_progress(stdout: &mut std::io::Stdout, averages: Averages) -> Result<()> { 93 | let mut scores = Data::get_scores()?; 94 | Score::sort_scores(&mut scores); 95 | 96 | let mut table = Table::new(); 97 | table 98 | .load_preset(UTF8_FULL) 99 | .set_content_arrangement(ContentArrangement::Dynamic) 100 | .set_width(TABLE_WIDTH) 101 | .set_header(vec![ 102 | Cell::new("DATE") 103 | .add_attribute(Attribute::Bold) 104 | .set_alignment(CellAlignment::Center), 105 | Cell::new("TIME") 106 | .add_attribute(Attribute::Bold) 107 | .set_alignment(CellAlignment::Center), 108 | Cell::new("WPM") 109 | .add_attribute(Attribute::Bold) 110 | .set_alignment(CellAlignment::Center), 111 | Cell::new("RAW") 112 | .add_attribute(Attribute::Bold) 113 | .set_alignment(CellAlignment::Center), 114 | Cell::new("ACCURACY") 115 | .add_attribute(Attribute::Bold) 116 | .set_alignment(CellAlignment::Center), 117 | ]); 118 | 119 | for score in &scores { 120 | let wpm_color = if score.wpm >= averages.wpm_avg.avg as u32 { 121 | Color::Green 122 | } else { 123 | Color::Red 124 | }; 125 | let raw_color = if score.raw >= averages.raw_avg.avg as u32 { 126 | Color::Green 127 | } else { 128 | Color::Red 129 | }; 130 | let accuracy_color = if score.accuracy >= averages.accuracy_avg.avg { 131 | Color::Green 132 | } else { 133 | Color::Red 134 | }; 135 | 136 | table.add_row(vec![ 137 | Cell::new(score.get_date()).set_alignment(CellAlignment::Center), 138 | Cell::new(score.get_time()).set_alignment(CellAlignment::Center), 139 | Cell::new(score.wpm.to_string()) 140 | .fg(wpm_color) 141 | .set_alignment(CellAlignment::Center), 142 | Cell::new(score.raw.to_string()) 143 | .fg(raw_color) 144 | .set_alignment(CellAlignment::Center), 145 | Cell::new(format!("{:.2}%", score.accuracy)) 146 | .fg(accuracy_color) 147 | .set_alignment(CellAlignment::Center), 148 | ]); 149 | } 150 | 151 | let (cols, rows) = size()?; 152 | let x = cols / 2 - (TABLE_WIDTH / 2); 153 | let y = rows / 2 - (scores.len() as u16 / 2); 154 | 155 | stdout 156 | .execute(MoveTo(x, y)) 157 | .context("Failed to move cursor")?; 158 | 159 | let table_string = table.to_string(); 160 | let lines: Vec<&str> = table_string.lines().collect(); 161 | 162 | for (i, line) in lines.iter().enumerate() { 163 | stdout 164 | .execute(MoveTo(x, y + i as u16)) 165 | .context("Failed to move cursor")?; 166 | write!(stdout, "{}", line)?; 167 | } 168 | stdout.flush()?; 169 | 170 | Ok(()) 171 | } 172 | 173 | fn setup_terminal(stdout: &mut std::io::Stdout) -> Result<()> { 174 | stdout.execute(Clear(ClearType::All))?; 175 | stdout.execute(cursor::Hide)?; 176 | 177 | Ok(()) 178 | } 179 | 180 | fn reset_terminal(stdout: &mut std::io::Stdout) -> Result<()> { 181 | disable_raw_mode()?; 182 | stdout.execute(Clear(ClearType::All))?; 183 | stdout.execute(MoveTo(0, 0))?; 184 | stdout.execute(ResetColor)?; 185 | stdout.execute(cursor::Show)?; 186 | stdout.flush()?; 187 | 188 | Ok(()) 189 | } 190 | -------------------------------------------------------------------------------- /src/scores/progress/mod.rs: -------------------------------------------------------------------------------- 1 | mod data; 2 | pub mod display; 3 | 4 | pub use data::*; 5 | -------------------------------------------------------------------------------- /src/scores/stats.rs: -------------------------------------------------------------------------------- 1 | const AVERAGE_WORD_LENGTH: i32 = 5; 2 | 3 | pub struct Stats { 4 | pub lps: Vec, 5 | pub letter_count: i32, 6 | pub incorrect_letters: i32, 7 | } 8 | 9 | impl Stats { 10 | pub fn new() -> Self { 11 | Stats { 12 | lps: Vec::new(), 13 | letter_count: 0, 14 | incorrect_letters: 0, 15 | } 16 | } 17 | 18 | pub fn add_letters(&mut self) { 19 | self.lps.push(self.letter_count); 20 | self.letter_count = 0; 21 | } 22 | 23 | fn total_letters(&self) -> i32 { 24 | self.lps.iter().sum() 25 | } 26 | 27 | fn total_seconds(&self) -> i32 { 28 | self.lps.len() as i32 29 | } 30 | 31 | fn minutes(&self) -> f64 { 32 | self.total_seconds() as f64 / 60.0 33 | } 34 | 35 | pub fn raw_wpm(&self) -> f64 { 36 | (self.total_letters() / AVERAGE_WORD_LENGTH) as f64 / self.minutes() 37 | } 38 | 39 | pub fn wpm(&self) -> f64 { 40 | const AVERAGE_WORD_LENGTH: i32 = 5; 41 | ((self.total_letters() - self.incorrect_letters) / AVERAGE_WORD_LENGTH) as f64 42 | / self.minutes() 43 | } 44 | 45 | pub fn accuracy(&self) -> f64 { 46 | 100.0 - (self.incorrect_letters as f64 / self.total_letters() as f64) * 100.0 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/terminal/game.rs: -------------------------------------------------------------------------------- 1 | use super::keyboard::{handle_input, InputAction}; 2 | use anyhow::{Context, Result}; 3 | use crossterm::cursor::{self, SetCursorStyle}; 4 | use crossterm::event::poll; 5 | use crossterm::{ 6 | cursor::MoveTo, 7 | event::{read, Event, KeyEvent}, 8 | style::{ResetColor, SetForegroundColor}, 9 | terminal::{disable_raw_mode, enable_raw_mode, Clear, ClearType}, 10 | ExecutableCommand, 11 | }; 12 | use std::io::stdout; 13 | use std::io::Write; 14 | use std::sync::atomic::{AtomicBool, Ordering}; 15 | use std::sync::{mpsc, Arc, Mutex}; 16 | use std::thread; 17 | use std::time::{Duration, Instant}; 18 | 19 | use crate::config::cursor_style::CursorKind; 20 | use crate::config::language; 21 | use crate::config::theme::ThemeColors; 22 | use crate::mode::Mode; 23 | use crate::scores::finish_overview; 24 | use crate::scores::progress::{Data, Score}; 25 | use crate::scores::Stats; 26 | use crate::word_provider; 27 | 28 | pub struct Player { 29 | pub position_x: i32, 30 | pub position_y: i32, 31 | } 32 | 33 | impl Player { 34 | fn new() -> Self { 35 | Player { 36 | position_x: 0, 37 | position_y: 0, 38 | } 39 | } 40 | } 41 | 42 | pub struct Game { 43 | pub list: Vec>, 44 | pub player: Player, 45 | pub jump_position: i32, 46 | pub selected_word_index: i32, 47 | quit: bool, 48 | } 49 | 50 | impl Game { 51 | fn new(list: Vec>) -> Self { 52 | Game { 53 | list, 54 | player: Player::new(), 55 | jump_position: 0, 56 | selected_word_index: 0, 57 | quit: false, 58 | } 59 | } 60 | 61 | pub fn get_word_string(&self, index: i32) -> String { 62 | self.list.get(index as usize).unwrap().join(" ") 63 | } 64 | } 65 | 66 | pub fn run(mode: Mode, theme: ThemeColors) -> Result<()> { 67 | let mut stdout = stdout(); 68 | 69 | let language = language::Language::new(); 70 | let mut game = Game::new( 71 | word_provider::get_words(&language.lang).context("Failed to get words from file")?, 72 | ); 73 | 74 | mode.transform(&mut game.list); 75 | 76 | let mut stats = Stats::new(); 77 | 78 | setup_terminal(&stdout).context("Failed to setup terminal")?; 79 | 80 | let (x, y) = super::calc_middle_for_text().context("Failed to calculate terminal size")?; 81 | 82 | for (i, words) in game.list.iter().enumerate() { 83 | print_words(x, y + i as u16, words, &stdout, &theme)?; 84 | stdout 85 | .execute(MoveTo(x, y)) 86 | .context("Failed to move cursor")?; 87 | } 88 | 89 | let timer_expired = Arc::new(AtomicBool::new(false)); 90 | let timer_expired_clone = Arc::clone(&timer_expired); 91 | let remaining_time = Arc::new(Mutex::new(mode.duration)); 92 | let remaining_time_clone = Arc::clone(&remaining_time); 93 | let mut remaining_prev: u64 = 0; 94 | 95 | let (tx, _) = mpsc::channel(); 96 | 97 | let timer_thread = thread::spawn(move || { 98 | if let Err(e) = start_timer(mode.duration, timer_expired_clone, remaining_time_clone) { 99 | tx.send(e).expect("Failed to send error from timer thread"); 100 | } 101 | }); 102 | 103 | loop { 104 | if game.player.position_y == game.list.len() as i32 { 105 | break; 106 | } 107 | 108 | stdout 109 | .execute(MoveTo( 110 | x + game.player.position_x as u16, 111 | y + game.player.position_y as u16, 112 | )) 113 | .context("Failed to move cursor")?; 114 | 115 | if timer_expired.load(Ordering::Relaxed) { 116 | break; 117 | } 118 | 119 | { 120 | let remaining = *remaining_time 121 | .lock() 122 | .map_err(|e| anyhow::anyhow!("Failed to lock remaining time: {}", e))?; 123 | stdout 124 | .execute(MoveTo(x, y - 2)) 125 | .context("Failed to move cursor")?; 126 | stdout 127 | .execute(SetForegroundColor(theme.accent)) 128 | .context("Failed to set foreground color")?; 129 | print!("{:02}", remaining); 130 | stdout.flush().context("Failed to flush stdout")?; 131 | stdout 132 | .execute(MoveTo( 133 | x + game.player.position_x as u16, 134 | y + game.player.position_y as u16, 135 | )) 136 | .context("Failed to move cursor")?; 137 | if remaining != remaining_prev { 138 | stats.add_letters(); 139 | } 140 | remaining_prev = remaining; 141 | } 142 | 143 | if poll(Duration::from_millis(5)).context("Failed to poll for events")? { 144 | if let Ok(Event::Key(KeyEvent { 145 | code, modifiers, .. 146 | })) = read().context("Failed to read event") 147 | { 148 | if let Some(()) = super::close_typy(&code, &modifiers) { 149 | timer_expired.store(true, Ordering::Relaxed); 150 | game.quit = true; 151 | break; 152 | } 153 | match handle_input(&mut game, &stdout, code, &mut stats, &theme, x, y)? { 154 | InputAction::Continue => continue, 155 | InputAction::Break => break, 156 | InputAction::None => {} 157 | } 158 | } 159 | } 160 | } 161 | 162 | if !game.quit { 163 | stdout.execute(cursor::Hide)?; 164 | let score = Score::new( 165 | stats.wpm() as u32, 166 | stats.raw_wpm() as u32, 167 | stats.accuracy() as f32, 168 | ); 169 | Data::save_data(score).context("Failed to save data")?; 170 | finish_overview::show_stats(&stdout, stats, &theme).context("Failed to show stats")?; 171 | } 172 | 173 | reset_terminal(&stdout).context("Failed to reset terminal")?; 174 | timer_expired.store(true, Ordering::Relaxed); 175 | timer_thread 176 | .join() 177 | .map_err(|e| anyhow::anyhow!("Failed to join timer thread: {:?}", e))?; 178 | Ok(()) 179 | } 180 | 181 | fn setup_terminal(mut stdout: &std::io::Stdout) -> Result<()> { 182 | let cursor_kind = CursorKind::new(); 183 | 184 | enable_raw_mode()?; 185 | stdout.execute(Clear(ClearType::All))?; 186 | stdout.execute(cursor_kind.style)?; 187 | 188 | Ok(()) 189 | } 190 | 191 | fn reset_terminal(mut stdout: &std::io::Stdout) -> Result<()> { 192 | disable_raw_mode()?; 193 | stdout.execute(cursor::Show)?; 194 | stdout.execute(ResetColor)?; 195 | stdout.execute(Clear(ClearType::All))?; 196 | stdout.execute(MoveTo(0, 0))?; 197 | stdout.execute(SetCursorStyle::DefaultUserShape)?; 198 | stdout.flush()?; 199 | 200 | Ok(()) 201 | } 202 | 203 | fn print_words( 204 | x: u16, 205 | y: u16, 206 | words: &[String], 207 | mut stdout: &std::io::Stdout, 208 | theme: &ThemeColors, 209 | ) -> Result<()> { 210 | stdout 211 | .execute(MoveTo(x, y)) 212 | .context("Failed to move cursor")?; 213 | stdout 214 | .execute(SetForegroundColor(theme.missing)) 215 | .context("Failed to set foreground color")?; 216 | words.iter().for_each(|word| { 217 | print!("{} ", word); 218 | }); 219 | 220 | Ok(()) 221 | } 222 | 223 | fn start_timer( 224 | duration: u64, 225 | timer_expired: Arc, 226 | remaining_time: Arc>, 227 | ) -> Result<()> { 228 | let start = Instant::now(); 229 | while start.elapsed().as_secs() < duration { 230 | if timer_expired.load(Ordering::Relaxed) { 231 | break; 232 | } 233 | let remaining = duration - start.elapsed().as_secs(); 234 | { 235 | let mut remaining_time = remaining_time 236 | .lock() 237 | .map_err(|e| anyhow::anyhow!("Failed to lock remaining time: {}", e))?; 238 | *remaining_time = remaining; 239 | } 240 | thread::sleep(Duration::from_secs(1)); 241 | } 242 | timer_expired.store(true, Ordering::Relaxed); 243 | 244 | Ok(()) 245 | } 246 | -------------------------------------------------------------------------------- /src/terminal/keyboard.rs: -------------------------------------------------------------------------------- 1 | use std::io::Write; 2 | 3 | use anyhow::{Context, Result}; 4 | use crossterm::event::KeyCode; 5 | use crossterm::style::{Attribute, SetForegroundColor}; 6 | use crossterm::ExecutableCommand; 7 | use crossterm::{cursor::MoveTo, style::SetAttribute}; 8 | 9 | use crate::{config::theme::ThemeColors, scores::Stats}; 10 | 11 | use super::Game; 12 | 13 | const MAX_WORD_LENGTH: usize = 100; 14 | 15 | pub enum InputAction { 16 | Continue, 17 | Break, 18 | None, 19 | } 20 | 21 | pub fn handle_input( 22 | game: &mut Game, 23 | mut stdout: &std::io::Stdout, 24 | code: KeyCode, 25 | stats: &mut Stats, 26 | theme: &ThemeColors, 27 | x: u16, 28 | y: u16, 29 | ) -> Result { 30 | if let KeyCode::Char(c) = code { 31 | if c == ' ' { 32 | match handle_space(game, stdout, x, y)? { 33 | InputAction::Continue => return Ok(InputAction::Continue), 34 | InputAction::Break => return Ok(InputAction::Break), 35 | InputAction::None => {} 36 | }; 37 | } 38 | // check the typed letter 39 | if game.player.position_x 40 | < game.get_word_string(game.player.position_y).chars().count() as i32 41 | { 42 | match handle_chars(game, stats, theme, stdout, c, x, y)? { 43 | InputAction::Continue => return Ok(InputAction::Continue), 44 | InputAction::Break => return Ok(InputAction::Break), 45 | InputAction::None => {} 46 | } 47 | } else if game.get_word_string(game.player.position_y).len() < MAX_WORD_LENGTH { 48 | let _ = add_incorrect_char(game, theme, stdout, c, x, y)?; 49 | game.player.position_x += 1; 50 | } 51 | 52 | stdout.flush().context("Failed to flush stdout")?; 53 | } 54 | Ok(InputAction::None) 55 | } 56 | 57 | fn handle_space(game: &mut Game, stdout: &std::io::Stdout, x: u16, y: u16) -> Result { 58 | if let InputAction::Continue = handle_space_at_start(game)? { 59 | return Ok(InputAction::Continue); 60 | } 61 | 62 | if let InputAction::Continue = handle_start_of_line(game)? { 63 | return Ok(InputAction::Continue); 64 | } 65 | 66 | if let InputAction::Continue = handle_end_of_line(game, stdout, x, y)? { 67 | return Ok(InputAction::Continue); 68 | } 69 | 70 | if game.jump_position + 1 == game.player.position_x && game.jump_position != 0 { 71 | return Ok(InputAction::Continue); 72 | } 73 | 74 | handle_jump_position(game, stdout, x, y)?; 75 | 76 | Ok(InputAction::None) 77 | } 78 | 79 | fn handle_start_of_line(game: &Game) -> Result { 80 | if game.player.position_x == 0 { 81 | return Ok(InputAction::Continue); 82 | } 83 | Ok(InputAction::None) 84 | } 85 | 86 | fn handle_end_of_line( 87 | game: &mut Game, 88 | mut stdout: &std::io::Stdout, 89 | x: u16, 90 | y: u16, 91 | ) -> Result { 92 | if game.selected_word_index 93 | == game 94 | .list 95 | .get(game.player.position_y as usize) 96 | .context("Failed to get word from list")? 97 | .len() as i32 98 | - 1 99 | { 100 | if game.player.position_y == game.list.len() as i32 { 101 | return Ok(InputAction::Break); 102 | } 103 | 104 | game.player.position_x = 0; 105 | game.player.position_y += 1; 106 | game.jump_position = 1; 107 | game.selected_word_index = 0; 108 | 109 | stdout 110 | .execute(MoveTo( 111 | x + game.player.position_x as u16, 112 | y + game.player.position_y as u16, 113 | )) 114 | .context("Failed to move cursor")?; 115 | return Ok(InputAction::Continue); 116 | } 117 | Ok(InputAction::None) 118 | } 119 | 120 | fn handle_space_at_start(game: &Game) -> Result { 121 | if game 122 | .get_word_string(game.player.position_y) 123 | .chars() 124 | .nth((game.player.position_x - 1) as usize) 125 | .context("Failed to get character from word")? 126 | == ' ' 127 | { 128 | return Ok(InputAction::Continue); 129 | } 130 | Ok(InputAction::None) 131 | } 132 | 133 | fn handle_jump_position( 134 | game: &mut Game, 135 | mut stdout: &std::io::Stdout, 136 | x: u16, 137 | y: u16, 138 | ) -> Result<()> { 139 | game.jump_position = game 140 | .list 141 | .get(game.player.position_y as usize) 142 | .context("Failed to get word from list")? 143 | .iter() 144 | .take(game.selected_word_index as usize + 1) 145 | .map(|word| word.chars().count() + 1) 146 | .sum::() as i32 147 | - 1; 148 | game.player.position_x = game.jump_position; 149 | stdout 150 | .execute(MoveTo( 151 | x + game.player.position_x as u16, 152 | y + game.player.position_y as u16, 153 | )) 154 | .context("Failed to move cursor")?; 155 | game.selected_word_index += 1; 156 | Ok(()) 157 | } 158 | 159 | fn handle_chars( 160 | game: &mut Game, 161 | stats: &mut Stats, 162 | theme: &ThemeColors, 163 | stdout: &std::io::Stdout, 164 | c: char, 165 | x: u16, 166 | y: u16, 167 | ) -> Result { 168 | let expected_char = game 169 | .get_word_string(game.player.position_y) 170 | .chars() 171 | .nth(game.player.position_x as usize) 172 | .context("Failed to get character from word")?; 173 | 174 | if c == expected_char { 175 | handle_correct_char(game, theme, stdout, c, x, y)?; 176 | } else if game 177 | .get_word_string(game.player.position_y) 178 | .chars() 179 | .nth(game.player.position_x as usize) 180 | .context("Failed to get character from word")? 181 | == ' ' 182 | { 183 | if let InputAction::Continue = add_incorrect_char(game, theme, stdout, c, x, y)? { 184 | return Ok(InputAction::Continue); 185 | } 186 | } else { 187 | handle_incorrect_char(game, theme, stdout, expected_char, x, y)?; 188 | } 189 | 190 | update_game_state(game, stats, c)?; 191 | 192 | Ok(InputAction::None) 193 | } 194 | 195 | fn handle_correct_char( 196 | game: &Game, 197 | theme: &ThemeColors, 198 | mut stdout: &std::io::Stdout, 199 | c: char, 200 | x: u16, 201 | y: u16, 202 | ) -> Result<()> { 203 | stdout 204 | .execute(SetForegroundColor(theme.fg)) 205 | .context("Failed to set foreground color")?; 206 | stdout 207 | .execute(MoveTo( 208 | x + game.player.position_x as u16, 209 | y + game.player.position_y as u16, 210 | )) 211 | .context("Failed to move cursor")?; 212 | print!("{}", c); 213 | Ok(()) 214 | } 215 | 216 | fn handle_incorrect_char( 217 | game: &Game, 218 | theme: &ThemeColors, 219 | mut stdout: &std::io::Stdout, 220 | c: char, 221 | x: u16, 222 | y: u16, 223 | ) -> Result<()> { 224 | stdout 225 | .execute(SetForegroundColor(theme.error)) 226 | .context("Failed to set foreground color")?; 227 | stdout 228 | .execute(MoveTo( 229 | x + game.player.position_x as u16, 230 | y + game.player.position_y as u16, 231 | )) 232 | .context("Failed to move cursor")?; 233 | print!("{}", c); 234 | Ok(()) 235 | } 236 | 237 | fn add_incorrect_char( 238 | game: &mut Game, 239 | theme: &ThemeColors, 240 | mut stdout: &std::io::Stdout, 241 | c: char, 242 | x: u16, 243 | y: u16, 244 | ) -> Result { 245 | let position_x = game.player.position_x; 246 | let words = game.get_word_string(game.player.position_y); 247 | 248 | if words.len() >= MAX_WORD_LENGTH { 249 | return Ok(InputAction::Continue); 250 | } 251 | 252 | let before = words.chars().take(position_x as usize).collect::(); 253 | let after = words.chars().skip(position_x as usize).collect::(); 254 | 255 | stdout.execute(MoveTo( 256 | game.player.position_x as u16 + x, 257 | game.player.position_y as u16 + y, 258 | ))?; 259 | 260 | stdout.execute(SetForegroundColor(theme.error))?; 261 | stdout.execute(SetAttribute(Attribute::Underlined))?; 262 | print!("{}", c); 263 | stdout.execute(SetAttribute(Attribute::Reset))?; 264 | stdout.execute(SetForegroundColor(theme.missing))?; 265 | print!("{}", after); 266 | 267 | let new_line = format!("{}{}{}", before, c, after); 268 | game.list[game.player.position_y as usize] = 269 | new_line.split_whitespace().map(String::from).collect(); 270 | Ok(InputAction::None) 271 | } 272 | 273 | fn update_game_state(game: &mut Game, stats: &mut Stats, c: char) -> Result<()> { 274 | if c == game 275 | .get_word_string(game.player.position_y) 276 | .chars() 277 | .nth(game.player.position_x as usize) 278 | .context("Failed to get character from word")? 279 | { 280 | stats.letter_count += 1; 281 | } else { 282 | stats.incorrect_letters += 1; 283 | stats.letter_count += 1; 284 | } 285 | 286 | if game 287 | .get_word_string(game.player.position_y) 288 | .chars() 289 | .nth(game.player.position_x as usize) 290 | .context("Failed to get character from word")? 291 | == ' ' 292 | && c != ' ' 293 | { 294 | game.selected_word_index += 1; 295 | } 296 | game.player.position_x += 1; 297 | 298 | Ok(()) 299 | } 300 | -------------------------------------------------------------------------------- /src/terminal/mod.rs: -------------------------------------------------------------------------------- 1 | mod game; 2 | mod keyboard; 3 | mod terminal_utils; 4 | 5 | pub use game::{run, Game}; 6 | pub use terminal_utils::{calc_middle_for_text, close_typy}; 7 | -------------------------------------------------------------------------------- /src/terminal/terminal_utils.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{Context, Result}; 2 | use crossterm::event::{KeyCode, KeyModifiers}; 3 | 4 | pub const LINE_LENGTH: i32 = 70; 5 | 6 | pub fn close_typy(code: &KeyCode, modifiers: &KeyModifiers) -> Option<()> { 7 | match code { 8 | KeyCode::Esc => Some(()), 9 | KeyCode::Char('c') if modifiers.contains(KeyModifiers::CONTROL) => Some(()), 10 | _ => None, 11 | } 12 | } 13 | 14 | pub fn calc_middle_for_text() -> Result<(u16, u16)> { 15 | let (cols, rows) = crossterm::terminal::size().context("Failed to get terminal size")?; 16 | let x = cols / 2 - (LINE_LENGTH / 2) as u16; 17 | let y = rows / 2 - 1; 18 | 19 | Ok((x, y)) 20 | } 21 | -------------------------------------------------------------------------------- /src/word_provider/finder.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{bail, Context, Result}; 2 | use dirs::home_dir; 3 | use reqwest::blocking::get; 4 | use std::{ 5 | fs::{create_dir_all, write, File}, 6 | io::{BufRead, BufReader}, 7 | path::PathBuf, 8 | sync::LazyLock, 9 | }; 10 | 11 | use rand::seq::IndexedRandom; 12 | 13 | static WORDS_DIR: LazyLock> = LazyLock::new(|| { 14 | if cfg!(test) { 15 | Some(PathBuf::from("./resources/")) 16 | } else { 17 | home_dir().map(|p| p.join(".local/share/typy")) 18 | } 19 | }); 20 | const WORDS_URL: &str = 21 | "https://raw.githubusercontent.com/Pazl27/typy-cli/refs/heads/master/resources/"; 22 | 23 | pub fn find(language: &str, lenght: i32) -> Result> { 24 | let Some(words_file) = WORDS_DIR 25 | .as_ref() 26 | .map(|p| p.join(format!("{language}.txt"))) 27 | else { 28 | bail!("Unable to find home directory"); 29 | }; 30 | 31 | // Download words file if not already present 32 | if !words_file.exists() { 33 | create_dir_all(words_file.parent().unwrap())?; 34 | let language_url = format!("{WORDS_URL}{language}.txt"); 35 | let resp = get(&language_url) 36 | .context("Failed to download words file from ".to_owned() + &language_url)?; 37 | write( 38 | &words_file, 39 | resp.text() 40 | .context("Failed to extract text from words file download")?, 41 | ) 42 | .with_context(|| format!("Failed to save words file to {words_file:#?}"))?; 43 | } 44 | 45 | let words = read_file(words_file.to_str().unwrap())?; 46 | let mut word = random_word(&words); 47 | 48 | let mut fitted_words = Vec::new(); 49 | while check_if_fits(&word, &mut fitted_words, lenght) { 50 | fitted_words.push(word.clone()); 51 | word = random_word(&words); 52 | } 53 | 54 | Ok(fitted_words) 55 | } 56 | 57 | fn read_file(path: &str) -> Result, std::io::Error> { 58 | let file = File::open(path)?; 59 | let reader = BufReader::new(file); 60 | let mut words = Vec::new(); 61 | for line in reader.lines() { 62 | words.push(line?); 63 | } 64 | Ok(words) 65 | } 66 | 67 | fn random_word(words: &[String]) -> String { 68 | let mut rng = rand::rng(); 69 | let word = words.choose(&mut rng).unwrap(); 70 | word.to_string() 71 | } 72 | 73 | fn check_if_fits(word: &str, fitted_words: &mut [String], lenght: i32) -> bool { 74 | let list_length: i32 = fitted_words 75 | .iter() 76 | .map(|s| s.chars().count() as i32) 77 | .sum::() 78 | + word.chars().count() as i32; 79 | 80 | if list_length > lenght { 81 | return false; 82 | } 83 | true 84 | } 85 | 86 | #[cfg(test)] 87 | mod finder_tests { 88 | 89 | use super::*; 90 | 91 | #[test] 92 | fn test_read_file() { 93 | let words = read_file("./resources/english.txt").unwrap(); 94 | assert_eq!(words.len(), 7776); 95 | } 96 | 97 | #[test] 98 | fn test_random_word() { 99 | let words = vec!["Hello".to_string(), "World".to_string()]; 100 | let word = random_word(&words); 101 | assert!(word == "Hello" || word == "World"); 102 | } 103 | 104 | #[test] 105 | fn test_check_if_fits() { 106 | let word = "Hello".to_string(); 107 | let mut fitted_words = Vec::new(); 108 | let lenght = 5; 109 | assert!(check_if_fits(&word, &mut fitted_words, lenght)); 110 | fitted_words.push("Hello".to_string()); 111 | assert!(!check_if_fits(&word, &mut fitted_words, lenght)); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/word_provider/mod.rs: -------------------------------------------------------------------------------- 1 | mod finder; 2 | 3 | use anyhow::Result; 4 | use finder::find; 5 | 6 | const LENGTH: i32 = 70; 7 | 8 | pub fn get_words(language: &str) -> Result>> { 9 | let mut words = Vec::new(); 10 | for _ in 0..3 { 11 | words.push(find(language, LENGTH)?); 12 | } 13 | Ok(words) 14 | } 15 | 16 | #[cfg(test)] 17 | mod word_provider_tests { 18 | use super::*; 19 | 20 | #[test] 21 | fn test_get_words() { 22 | let words = get_words("english"); 23 | 24 | for word in &words.unwrap() { 25 | let mut length = 0; 26 | for w in word { 27 | length += w.chars().count() as i32; 28 | } 29 | assert!(length <= LENGTH); 30 | } 31 | } 32 | } 33 | --------------------------------------------------------------------------------