2 unstable releases
Uses new Rust 2024
new 0.3.2 | Mar 17, 2025 |
---|---|
0.2.0 | Mar 16, 2025 |
#1 in #thanks
197 downloads per month
69KB
1.5K
SLoC
Cargo Thanku
A command-line tool for generating acknowledgments for your Rust project dependencies.
Key Features
- Generates acknowledgments in multiple formats (Markdown table/list, JSON, TOML, YAML)
- Fetches dependency information from crates.io and GitHub
- Supports concurrent processing with configurable limits
- Implements retry mechanism for failed requests
- Offers command-line completion for Bash, Zsh, Fish, PowerShell, and Elvish
- Provides internationalization support (zh/en/ja/ko/es/fr/de/it)
Installation
Ensure you have the Rust toolchain installed on your system, then execute:
# Install cargo-thanku
cargo install cargo-thanku
# Generate shell completions (optional)
cargo thanku completions bash > ~/.local/share/bash-completion/completions/cargo-thanku
Usage
Basic Usage
# Generate acknowledgments for your project
cargo thanku
# Specify output format
cargo thanku -f markdown-table # or markdown-list, json, toml, yaml
# Set GitHub token for more information and automatic starring
cargo thanku -t YOUR_GITHUB_TOKEN
# Change language
cargo thanku -l en # supports zh/en/ja/ko/es/fr/de/it
Advanced Options
# Configure concurrent requests
cargo thanku -j 10 # Set maximum concurrent requests to 10
# Adjust retry attempts
cargo thanku -r 5 # Set maximum retry attempts to 5
# Customize output file
cargo thanku -o custom_thanks.md
# Enable verbose logging
cargo thanku -v
# Filter out libraries imported with relative paths
cargo thanku --no-relative-libs
Command-Line Completion
Generate command-line completion scripts for various shells:
# Bash
cargo thanku completions bash > ~/.local/share/bash-completion/completions/cargo-thanku
# Zsh
cargo thanku completions zsh > ~/.zsh/_cargo-thanku
# Fish
cargo thanku completions fish > ~/.config/fish/completions/cargo-thanku.fish
# PowerShell
mkdir -p $PROFILE\..\Completions
cargo thanku completions powershell > $PROFILE\..\Completions\cargo-thanku.ps1
# Elvish
cargo thanku completions elvish > ~/.elvish/lib/cargo-thanku.elv
Command-Line Arguments
Argument | Description | Default Value |
---|---|---|
-i, --input |
Input Cargo.toml file path | Cargo.toml |
-o, --output |
Output file path | thanks.md |
-f, --format |
Output format | markdown-table |
-t, --token |
GitHub API token | - |
-l, --language |
Language (zh/en/ja/ko/es/fr/de/it) | zh |
-v, --verbose |
Enable verbose logging | false |
-j, --concurrent |
Maximum concurrent requests | 5 |
-r, --retries |
Maximum retry attempts | 3 |
--no-relative-libs |
Filter out libraries imported with relative paths | false |
Output Formats
Markdown Table
| Name | Description | Source | Stats | Status |
|------|-------------|--------|-------|--------|
|🔍 | Normal | | | |
|[serde](https://crates.io/crates/serde) | Serialization framework | [GitHub](https://github.com/serde-rs/serde) | 🌟 3.5k | ✅ |
Markdown List
# Dependencies
- [serde](https://crates.io/crates/serde) [Serialization framework](https://github.com/serde-rs/serde) (🌟 3.5k) ✅
JSON/TOML/YAML
Also supports structured output formats for programmatic use.
Important Notes
-
Setting a GitHub token (
-t
orGITHUB_TOKEN
env) enables:- Fetching additional repository information
- Automatic fetching stars of dependency repositories
- Higher API rate limits
-
Failed dependency processing:
- Won't interrupt the overall process
- Will be marked with ❌ in the output
- Shows error messages for debugging
-
Language codes:
- Supports flexible formats (e.g., "en", "en_US", "en_US.UTF-8")
- Falls back to primary language code
- Suggests similar codes for typos
Acknowledgments
This project itself is built with many excellent Rust crates. Here are some key dependencies:
[!TIP] Generated by
cargo-thanku
tool
name | description | source | stats | status |
---|---|---|---|---|
🔍 | Normal | |||
anyhow | Flexible concrete Error type built on std::error::Error | GitHub | ❓ | ✅ |
cargo_metadata | structured access to the output of cargo metadata |
GitHub | ❓ | ✅ |
clap | A simple to use, efficient, and full-featured Command Line Argument Parser | GitHub | ❓ | ✅ |
clap_complete | Generate shell completion scripts for your clap::Command | GitHub | ❓ | ✅ |
futures | An implementation of futures and streams featuring zero allocations, composability, and iterator-like interfaces. | GitHub | ❓ | ✅ |
reqwest | higher level HTTP client library | GitHub | ❓ | ✅ |
rust-i18n | Rust I18n is use Rust codegen for load YAML file storage translations on compile time, and give you a t! macro for simply get translation texts. | GitHub | ❓ | ✅ |
serde | A generic serialization/deserialization framework | GitHub | ❓ | ✅ |
serde_json | A JSON serialization file format | GitHub | ❓ | ✅ |
serde_yaml | YAML data format for Serde | GitHub | ❓ | ✅ |
strsim | Implementations of string similarity metrics. Includes Hamming, Levenshtein, OSA, Damerau-Levenshtein, Jaro, Jaro-Winkler, and Sørensen-Dice. | GitHub | ❓ | ✅ |
thiserror | derive(Error) | GitHub | ❓ | ✅ |
tokio | An event-driven, non-blocking I/O platform for writing asynchronous I/O backed applications. | GitHub | ❓ | ✅ |
toml | A native Rust encoder and decoder of TOML-formatted files and streams. Provides implementations of the standard Serialize/Deserialize traits for TOML data to facilitate deserializing and serializing Rust structures. | GitHub | ❓ | ✅ |
tracing | Application-level tracing for Rust. | GitHub | ❓ | ✅ |
tracing-subscriber | Utilities for implementing and composing tracing subscribers. |
GitHub | ❓ | ✅ |
url | URL library for Rust, based on the WHATWG URL Standard | GitHub | ❓ | ✅ |
🔧 | Development | |||
assert_fs | Filesystem fixtures and assertions for testing. | GitHub | ❓ | ✅ |
pretty_assertions | Overwrite assert_eq! and assert_ne! with drop-in replacements, adding colorful diffs. |
GitHub | ❓ | ✅ |
tokio-test | Testing utilities for Tokio- and futures-based code | GitHub | ❓ | ✅ |
For a complete list of dependencies and their acknowledgments, run:
cargo thanku
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
~18–31MB
~454K SLoC