pkg-checker 0.3.1

A Rust tool for checking and updating globally installed Cargo packages with interactive mode and smart prerelease detection
pkg-checker-0.3.1 is not a library.

pkg-checker

Crates.io License: MIT

一个用 Rust 编写的工具,用于检查和管理全局安装的 Cargo 包更新。支持交互式更新、智能预发布版本检测和彩色输出。

功能特性

  • 🔍 自动检测已安装的全局 Cargo 包
  • 📦 检查每个包的最新版本
  • 🎨 彩色输出,清晰显示更新状态
  • ⚡ 异步处理,快速检查多个包
  • 🛠️ 命令行参数支持,灵活使用
  • 🔄 默认交互式更新模式,一键更新包
  • 🧠 智能预发布版本检测和询问

安装

从 crates.io 安装(推荐)

cargo install pkg-checker

从源码安装

# 克隆项目
git clone https://github.com/your-username/pkg-checker.git
cd pkg-checker

# 构建并安装
cargo install --path .

从 GitHub 安装

cargo install --git https://github.com/your-username/pkg-checker.git

使用方法

基本使用

pkg-checker

命令行选项

  • -v, --verbose: 显示详细信息
  • -u, --updates-only: 只显示有更新的包
  • --no-interactive: 非交互模式(默认是交互模式)
  • --include-prerelease: 包含预发布版本(alpha、beta、rc 等)
  • -h, --help: 显示帮助信息
  • -V, --version: 显示版本信息

示例

# 检查所有包并显示详细信息
pkg-checker --verbose

# 只显示有更新的包
pkg-checker --updates-only

# 组合使用
pkg-checker --verbose --updates-only

# 默认交互模式(推荐)
pkg-checker

# 只显示有更新的包(交互模式)
pkg-checker --updates-only

# 非交互模式
pkg-checker --no-interactive

# 包含预发布版本检查(交互模式)
pkg-checker --include-prerelease

# 非交互模式 + 预发布版本
pkg-checker --no-interactive --include-prerelease

输出示例

交互模式(默认)

检查全局安装的 Cargo 包更新...
找到 5 个已安装的包

检测到以下包有更新:
稳定版本更新:
  • cargo-outdated (0.16.0 → 0.17.0)
  • devtool (0.2.4 → 0.2.5)

预发布版本更新:
  • mdbook (0.4.52 → 0.5.0-alpha.1) ⚠️ 预发布版本

是否要更新这些包? [Y/n]: y
是否包含预发布版本更新? [y/N]: n

选择要更新的包(使用空格选择,回车确认)
> [x] cargo-outdated
> [x] devtool

开始更新选中的包...
正在更新 cargo-outdated...
✅ cargo-outdated 已更新: 0.16.0 → 0.17.0
正在更新 devtool...
✅ devtool 已更新: 0.2.4 → 0.2.5

更新完成!
成功: 2 个包

非交互模式

检查全局安装的 Cargo 包更新...
找到 5 个已安装的包
mdbook 有更新可用
  当前版本: 0.4.52
  最新版本: 0.5.0-alpha.1

要更新包,请使用: cargo install --force <package_name>
或者移除 --no-interactive 参数进行交互式更新

技术特性

  • 异步处理: 使用 Tokio 异步运行时,快速并发检查多个包
  • 智能版本检测: 自动区分稳定版本和预发布版本
  • 交互式界面: 用户友好的命令行交互体验
  • 彩色输出: 美观的终端输出,清晰的状态显示
  • 错误处理: 完善的错误处理和重试机制
  • 类型安全: Rust 类型系统保证代码安全性

贡献

欢迎贡献代码!请遵循以下步骤:

  1. Fork 项目
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add some amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 创建 Pull Request

许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。

相关链接