| Crates.io | cargo-fresh |
| lib.rs | cargo-fresh |
| version | 0.9.8 |
| created_at | 2025-10-15 11:42:22.428514+00 |
| updated_at | 2025-10-18 13:30:02.157835+00 |
| description | A Rust tool for checking and updating globally installed Cargo packages with interactive mode and smart prerelease detection |
| homepage | https://github.com/jenkinpan/cargo-fresh |
| repository | https://github.com/jenkinpan/cargo-fresh |
| max_upload_size | |
| id | 1884229 |
| size | 164,500 |
A Rust tool for checking and updating globally installed Cargo packages with interactive mode and smart prerelease detection. After installation, you can use it via the cargo fresh command. The tool automatically detects your system language and displays the interface in Chinese or English accordingly.
cargo fresh)cargo binstall for faster package updates with automatic fallbackcargo install cargo-fresh
or
# Faster installation using pre-compiled binaries
cargo binstall cargo-fresh
Note: cargo binstall provides faster installation by downloading pre-compiled binaries instead of compiling from source. If you don't have cargo binstall installed, cargo-fresh will automatically install it for you when needed.
# Clone the repository
git clone https://github.com/jenkinpan/cargo-fresh.git
cd cargo-fresh
# Build and install
cargo install --path .
cargo install --git https://github.com/jenkinpan/cargo-fresh.git
The tool automatically detects your system language and displays the interface accordingly:
You can also manually override the language by setting environment variables:
# Force English interface
LANG=en_US.UTF-8 cargo fresh
# Force Chinese interface
LANG=zh_CN.UTF-8 cargo fresh
After installation, you can use it in two ways:
# Method 1: As a cargo subcommand (recommended)
cargo fresh
# Method 2: Direct invocation
cargo-fresh
-v, --verbose: Show detailed information-u, --updates-only: Show only packages with updates--no-interactive: Non-interactive mode (default is interactive mode)--include-prerelease: Include prerelease versions (alpha, beta, rc, etc.)--batch: Batch mode - automatically update all packages without confirmation--filter <PATTERN>: Filter packages by name pattern (supports glob patterns)-h, --help: Show help information-V, --version: Show version information# Check all packages and show detailed information
cargo fresh --verbose
# Show only packages with updates
cargo fresh --updates-only
# Combine options
cargo fresh --verbose --updates-only
# Default interactive mode (recommended)
cargo fresh
# Show only packages with updates (interactive mode)
cargo fresh --updates-only
# Non-interactive mode
cargo fresh --no-interactive
# Include prerelease version checks (interactive mode)
cargo fresh --include-prerelease
# Non-interactive mode + prerelease versions
cargo fresh --no-interactive --include-prerelease
# Batch mode - automatically update all packages without confirmation
cargo fresh --batch
# Filter packages by name pattern (supports glob patterns)
cargo fresh --filter "cargo*" # Only check packages starting with "cargo"
cargo fresh --filter "*mdbook*" # Only check packages containing "mdbook"
cargo fresh --filter "nu*" # Only check packages starting with "nu"
# Combine new options with existing ones
cargo fresh --batch --filter "cargo*" # Batch update only cargo packages
cargo fresh --verbose --filter "*mdbook*" # Verbose check for mdbook packages
cargo fresh --batch --updates-only # Batch update only packages with updates
# Generate shell completion scripts
cargo fresh completion zsh # Generate zsh completion
cargo fresh completion bash # Generate bash completion
cargo fresh completion fish # Generate fish completion
# Generate cargo fresh subcommand completion
cargo fresh completion zsh --cargo-fresh # Generate cargo fresh zsh completion
cargo fresh completion bash --cargo-fresh # Generate cargo fresh bash completion
# Generate and install zsh completion
cargo-fresh completion zsh > ~/.zsh/completions/_cargo-fresh
# Or for cargo fresh subcommand
cargo-fresh completion zsh --cargo-fresh > ~/.zsh/completions/_cargo
# Add to your ~/.zshrc
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -U compinit && compinit' >> ~/.zshrc
# Generate and install bash completion
cargo-fresh completion bash > ~/.local/share/bash-completion/completions/cargo-fresh
# Or for cargo fresh subcommand
cargo-fresh completion bash --cargo-fresh > ~/.local/share/bash-completion/completions/cargo
# Source in your ~/.bashrc
echo 'source ~/.local/share/bash-completion/completions/cargo-fresh' >> ~/.bashrc
# Generate and install fish completion
cargo-fresh completion fish > ~/.config/fish/completions/cargo-fresh.fish
# Or for cargo fresh subcommand
cargo-fresh completion fish --cargo-fresh > ~/.config/fish/completions/cargo.fish
# Generate and install nushell completion
cargo-fresh completion nushell > ~/.config/nushell/completions/cargo-fresh.nu
# Or for cargo fresh subcommand
cargo-fresh completion nushell --cargo-fresh > ~/.config/nushell/completions/cargo.nu
Checking for updates to globally installed Cargo packages...
Found 5 installed packages
The following packages have updates available:
Stable version updates:
β’ cargo-outdated (0.16.0 β 0.17.0)
β’ devtool (0.2.4 β 0.2.5)
Prerelease version updates:
β’ mdbook (0.4.52 β 0.5.0-alpha.1) β οΈ Prerelease version
Do you want to update these packages? [Y/n]: y
Include prerelease version updates? [y/N]: n
Select packages to update (use space to select, enter to confirm)
> [x] cargo-outdated
> [x] devtool
Starting to update selected packages...
Updating cargo-outdated...
β
cargo-outdated updated: 0.16.0 β 0.17.0
Updating devtool...
β
devtool updated: 0.2.4 β 0.2.5
Update completed!
Success: 2 packages
Checking for updates to globally installed Cargo packages...
Found 5 installed packages
mdbook has updates available
Current version: 0.4.52
Latest version: 0.5.0-alpha.1
To update packages, use: cargo install --force <package_name>
Or remove --no-interactive flag for interactive updates
cargo-fresh supports automatic completion for multiple shells, making command-line usage more convenient.
# 1. Generate completion script
cargo fresh completion zsh > ~/.zsh_completions/cargo-fresh.zsh
# 2. Add to zsh configuration
echo 'fpath=($HOME/.zsh_completions $fpath)' >> ~/.zshrc
echo 'autoload -U compinit && compinit' >> ~/.zshrc
# 3. Reload configuration
source ~/.zshrc
For cargo fresh subcommand completion:
# Generate cargo fresh subcommand completion
cargo fresh completion zsh --cargo-fresh > cargo-fresh-completion.zsh
cargo fresh completion bash --cargo-fresh > cargo-fresh-completion.bash
# Install cargo fresh completion
source cargo-fresh-completion.zsh # For zsh
source cargo-fresh-completion.bash # For bash
# Bash completion
cargo fresh completion bash > ~/.bash_completions/cargo-fresh.bash
echo 'source ~/.bash_completions/cargo-fresh.bash' >> ~/.bashrc
# Fish completion
cargo fresh completion fish > ~/.config/fish/completions/cargo-fresh.fish
# PowerShell completion
cargo fresh completion powershell > cargo-fresh.ps1
After installation, you can use auto-completion in two ways:
cargo fresh <TAB>
# Shows all available options:
# --completion --help --include-prerelease --no-interactive
# --updates-only --verbose --version
cargo <TAB> # Shows 'fresh' as a subcommand
cargo fresh <TAB> # Shows all fresh options and parameters
If shell completion is not working, try the following:
Verify completion installation:
# Check if completion files exist
ls ~/.zsh/completions/_cargo-fresh # For zsh
ls ~/.local/share/bash-completion/completions/cargo-fresh # For bash
Reload shell configuration:
# For zsh
source ~/.zshrc
# For bash
source ~/.bashrc
# For fish
# Restart fish shell
Regenerate completion files:
# Generate fresh completion files
cargo-fresh completion zsh > ~/.zsh/completions/_cargo-fresh
cargo-fresh completion bash > ~/.local/share/bash-completion/completions/cargo-fresh
If you notice missing options in completion:
Update cargo-fresh:
cargo install --force cargo-fresh
Regenerate completion files:
cargo-fresh completion zsh > ~/.zsh/completions/_cargo-fresh
Verify completion includes new options:
grep -E "(batch|filter)" ~/.zsh/completions/_cargo-fresh
For cargo fresh subcommand completion:
Generate cargo fresh completion:
cargo-fresh completion zsh --cargo-fresh > ~/.zsh/completions/_cargo
Verify cargo completion:
cargo <TAB> # Should show 'fresh' as a subcommand
cargo fresh <TAB> # Should show all fresh options
Contributions are welcome! Please follow these steps:
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the Apache 2.0 License. See the LICENSE file for complete license terms.
The Apache 2.0 License is a permissive open source license that allows you to:
Main requirements:
Copyright (c) 2025 Jenkin Pan
This project is open source under the Apache 2.0 License. See the LICENSE file for details.