š¦ ratcrate-cli: Ratatui Ecosystem Crate Discoverer
š ļø Overview
ratcrate-cli is a fast, terminal-native command-line tool built in Rust for discovering, searching, and getting information about crates within the Ratatui ecosystem. It uses a smart caching strategy to provide near-instant results directly in your terminal. The project follows a standard Rust CLI structure, ensuring clear separation of responsibilities:
- main.rs:
- Application Logic and CLIHandles argument parsing using clap.
- Manages the top-level execution flow, prioritizing immediate exit commands (-t, -c).
- Implements the core filtering and display logic.
- Manages interaction with the external fzf command.
- cache.rs:
- Data PersistenceManages the data source, which is a JSON file hosted remotely.
- Calculates the cache age (set to 1 day maximum).
- Handles fetching data via reqwest and saving/loading data from the OS-specific cache directory using dirs.
- types.rs:
- Data ModelingDefines the data contract for the remote JSON.
- Uses serde to deserialize the data into structured CratePackage and CratesData structs.
[!TIP]
For more information, read "The book"
⨠Features
- Offline First: Caches data locally and only downloads when stale (older than 1 day) or forced.
- Fuzzy Search: Filter crates by name or description using a command-line query.
- Interactive Mode: Seamless integration with
fzffor interactive selection and viewing of crate details. - Statistical Breakdown: Quick summary of total, core, and community packages (
-t). - Flexible Output: Supports both a clean, colored list view and an optional structured table view (
--table).
š Installation
Prerequisites
- Rust Toolchain: You need the latest stable Rust version installed via rustup.
- fzf (Optional): Required for the interactive mode (
-f).
Install from Crates.io
Once the package is published, you can install it globally:
Using Homebrew
Homebrew cn be installed via
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Build from Source
Clone the repository and build the project using Cargo:
)
Ń« Usage
Run ratcrate-cli --help for a full list of options.
| Option | Description |
|---|---|
-h, --help |
Display help information. |
-q, --query <QUERY> |
Search term to filter packages |
-c, --cache-info |
Show cache info |
-l, --limit <LIMIT> |
Limit number of results to show [default: 10] |
-r, --refresh |
Force re-download of remote JSON to cache |
-f, --fzf |
Enable interactive mode with fzf. |
-t, --total |
Display total number of crates. |
-V, --version |
Display the version number. |
-h, --help |
Display help information. |
--table |
Table view (requires compiling with --features table) |
Total View
Table View
)
| | | | | |
| | | | | |
| | | | | |
| | | | | |
Query
)
&)
Roadmap
- "Try" mode
- Debian and Arch Support
š¤ Contributing
Contributions are welcome! If you have suggestions or find a bug, please open an issue or submit a pull request.
š License
This project is licensed under the MIT License. See the LICENSE file for details.