cloudreve-cli
A powerful command-line interface for Cloudreve, providing easy access to all major Cloudreve API features from your terminal.
Features
Core Features
- 📁 File Operations: Upload, download, list, move, copy, rename, delete files
- 🔍 File Search: Search files by name, type, size, or extension with recursive support
- 📦 Batch Operations: Upload/download multiple files or entire directories at once
- 🔗 Share Management: Create, list, update, and delete share links
- 👤 User Management: View profile, storage quota, and manage settings
Advanced Features
- 🔄 File Sync: Synchronize local and remote files with dry-run preview
- 📄 File Preview: Preview text and JSON files directly in the terminal
- 📊 File Comparison: Compare local and remote files for differences
- 📈 Progress Bars: Visual progress indicators for uploads and downloads
User Experience
- ⚙️ Configuration File: Set default values in
~/.config/cloudreve-cli/config.toml - 🐚 Shell Completion: Generate completion scripts for bash, zsh, fish, and PowerShell
- 🎨 Clean Output: Minimal log output by default with
--log-prefixoption for debugging - 📏 Human-Readable Sizes: Automatic size formatting (B/KB/MB/GB/TB)
Installation
Install from Crates.io
Or install a specific version:
Build from Source
The binary will be available at target/release/cloudreve-cli.
Quick Start
1. Authentication
First, authenticate with your Cloudreve instance:
You'll be prompted for your email and password. The token is cached for future use.
2. Basic File Operations
# List files in root directory
# Upload a file
# Download a file
# Get file information
3. Batch Operations
# Batch upload multiple files
# Batch upload with recursive directory support
# Batch download multiple files
4. File Search
# Search by name
# Search PDF files larger than 1MB
# Search only folders
5. File Synchronization
# Sync local files to remote (preview only)
# Sync remote files to local
6. File Preview
# Preview text file
# Preview JSON with formatting
7. File Comparison
# Compare local and remote files
Configuration File
Create a configuration file at ~/.config/cloudreve-cli/config.toml:
# ~/.config/cloudreve-cli/config.toml
= "https://your-cloudreve-instance.com"
= "user@example.com"
= "1"
= "/"
= "./downloads"
= "info"
With this configuration, you can omit the --url parameter:
Shell Completion
Generate completion scripts for your shell:
Zsh
Add to your ~/.zshrc:
fpath=(/.zsh/completion )
&&
Bash
Fish
Command Reference
Global Options
| Option | Description |
|---|---|
--url |
Cloudreve instance URL |
--email |
Login email |
--token |
Authentication token |
--log-level |
Log level (trace, debug, info, warn, error) |
--log-prefix |
Show full log prefix with timestamp and level |
File Commands
| Command | Description |
|---|---|
file list |
List files in a directory |
file info |
Get file information |
file upload |
Upload a file |
file download |
Download a file |
file delete |
Delete files |
file rename |
Rename a file |
file move |
Move files |
file copy |
Copy files |
file mkdir |
Create a directory |
file batch-upload |
Upload multiple files/directories |
file batch-download |
Download multiple files |
file search |
Search for files |
file sync |
Synchronize files |
file preview |
Preview file content |
file diff |
Compare local and remote files |
User Commands
| Command | Description |
|---|---|
user info |
Get user information |
user quota |
View storage quota |
user policies |
List storage policies |
Share Commands
| Command | Description |
|---|---|
share list |
List my share links |
share create |
Create a share link |
share update |
Update a share link |
share delete |
Delete a share link |
Settings Commands
| Command | Description |
|---|---|
settings get |
Get settings |
settings set |
Set configuration value |
Examples
Upload with Progress Bar
# [00:00:15] [======================>] 50/100 chunks (0:00:15)
Batch Upload Directory
# Starting batch upload of 1 items
# ✓ Uploaded: ./project/src/main.rs
# ✓ Uploaded: ./project/src/utils.rs
# Batch upload summary:
# Uploaded: 15 files
# Failed: 0 files
# Total size: 1.25 MB
Search and Download
# Find all PDF files
# Download the found files
Troubleshooting
Clean Output vs Debug Output
By default, the CLI shows clean output without log prefixes. For debugging, use --log-prefix:
# Clean output (default)
# Listing files in path: /
# With full log prefix
# [2025-01-14T12:34:56Z INFO] Listing files in path: /
Token Caching
Tokens are cached in ~/.cache/cloudreve-cli/tokens.json. To re-authenticate:
Connection Issues
If you encounter connection issues:
- Verify the URL is correct (include
https://) - Check your network connection
- Use
--log-level debugfor detailed logs
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions, please file an issue.
Acknowledgments
- Built with Clap for CLI parsing
- Uses cloudreve-api library
- Part of the Cloudreve ecosystem