THCloud CLI Tool is a command-line interface for managing cloud storage and Filecoin nodes. It provides a unified interface for interacting with various cloud storage providers and Filecoin networks.
Features
-
Cloud Storage Management
- Support for multiple cloud storage providers:
- Aliyun OSS
- AWS S3
- Tencent COS
- Huawei OBS
- MinIO
- File upload and download
- Bucket management
- Object listing and manipulation
-
Filecoin Node Management
- Query miner information
- Sector management
- Power statistics
- Node status monitoring
Installation
Prerequisites
Building from Source
# Clone the repository
git clone https://github.com/THCloudAI/thctl.git
cd thctl
# Build the binary
go build -o thctl ./cmd/thctl
# Optional: Move to system path
sudo mv thctl /usr/local/bin/
Configuration
The THCloud CLI tool uses environment variables for configuration. You can set these variables in three ways:
-
Using a .thctl.env file:
# Copy the example configuration
cp .thctl.env.example .thctl.env
# Edit the configuration with your values
vim .thctl.env
-
Setting environment variables directly:
export LOTUS_API_URL=http://127.0.0.1:1234/rpc/v0
export LOTUS_API_TOKEN=your_token_here
-
Using command-line flags (these override environment variables):
thctl fil --miner f0xxxx --api-url http://127.0.0.1:1234/rpc/v0
For detailed configuration options, see .thctl.env.example.
Usage Examples
Filecoin Commands
-
Query Miner Information:
thctl fil --miner f0xxxx
This will display detailed information about the specified miner, including:
- Basic miner information (owner, worker, control addresses)
- Current power statistics
- Sector size and configuration
-
List Sectors:
thctl fil sectors list --miner f0xxxx
-
Check Sector Status:
thctl fil sectors status --miner f0xxxx --sector-id 1
Cloud Storage Commands
-
Upload a File:
thctl oss cp ./local/file.txt oss://bucket/remote/path/
-
Download a File:
thctl oss cp oss://bucket/remote/file.txt ./local/path/
-
List Objects:
thctl oss ls oss://bucket/prefix/
The tool supports multiple output formats:
# JSON output (default)
thctl fil --miner f0xxxx -o json
# YAML output
thctl fil --miner f0xxxx -o yaml
# Table output
thctl fil --miner f0xxxx -o table
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add some amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Security
The .thctl.env file may contain sensitive information and should never be committed to version control. The file is already included in .gitignore to prevent accidental commits.
Support
For support, please open an issue in the GitHub repository or contact the THCloud.AI team.