Update Available
A Rust library to check for updates of crates on crates.io or GitHub repositories. Get notified when newer versions of your dependencies are available with beautiful, formatted output.
Features
- ✅ Check for updates on crates.io
- ✅ Check for updates on GitHub repositories
- ✅ Beautiful, formatted output with icons
- ✅ Easy-to-use API with comprehensive error handling
- ✅ Support for semantic versioning
- ✅ Blocking HTTP requests (with optional async support planned)
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
or use cargo add:
Quick Start
Check for crates.io updates
use check_crates_io;
match check_crates_io
Check for GitHub repository updates
use check_github;
match check_github
Check for Gitea repository updates
use check_gitea;
match check_gitea
Convenience function for direct printing
use ;
// Check crates.io and print result
print_check;
// Check GitHub and print result
print_check;
// Check Gitea and print result
print_check;
## Example Output
When an update is available, you'll see beautifully formatted output like this:
```text
🚀 A new version is available!
🔖 Latest version: 1.0.210
📝 Changelog:
• Fixed critical security vulnerability
• Improved performance by 15%
• Added new serialization features
🌐 More info: https://crates.io/crates/example
When you're already using the latest version:
✅ You're already using the latest version! (1.0.210)
API Reference
Functions
check_crates_io(name, current_version)- Check for updates on crates.iocheck_github(name, user, current_version)- Check for updates on GitHubprint_check(name, current_version, source)- Convenience function that prints results directly
Types
UpdateInfo- Contains update information including version details and changelogSource- Enum for specifying update source (CratesIo or Github)
Properties of UpdateInfo
is_update_available: bool- Whether an update is availablelatest_version: Version- The latest available versionchangelog: Option<String>- Optional changelog informationurl: String- URL for more information
Examples
You can run the included examples:
# Check crates.io for updates
# Run with specific features
Features
This crate uses feature flags to control functionality:
blocking(default) - Enables blocking HTTP requests usingureq
[]
# Default features (includes blocking)
= "0.1.0"
# Only blocking features
= { = "0.1.0", = ["blocking"] }
# No default features
= { = "0.1.0", = false }
Error Handling
The library uses anyhow::Error for comprehensive error handling. Common error scenarios include:
- Network connectivity issues
- Invalid version strings
- API rate limiting
- Repository not found
- Malformed API responses
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Roadmap
- Async support with
tokioandreqwest - Custom output formatting
- Support for other sources (e.g. GitLab)
- Support for Gitea repositories