| Crates.io | btcli |
| lib.rs | btcli |
| version | 0.5.6 |
| created_at | 2026-01-21 11:01:41.037071+00 |
| updated_at | 2026-01-22 10:57:54.526446+00 |
| description | An online command-line translation tool for Chinese and other languages with TUI interface. |
| homepage | https://swe-iss.rth1.xyz/softwares/btcli |
| repository | https://gitee.com/ironbayberry/btcli |
| max_upload_size | |
| id | 2058878 |
| size | 197,341 |
An online command-line translation tool for Chinese and other languages with TUI interface.
(^-^)
btcli is a command-line translation tool that provides a TUI (Text User Interface) for easy access to Baidu Translate API. It supports multiple languages and provides a convenient way to translate text directly from the command line.
To build and install btcli, you'll need Rust and Cargo installed on your system.
Clone the repository and build:
git clone https://github.com/RevengingSA/btcli.git
cd btcli
cargo build --release
The binary will be available in target/release/btcli.
First, configure your Baidu Translate API credentials:
# Edit config.toml with your API credentials
# Or run the program once to generate an example config
./btcli
The application supports both TUI (Text User Interface) mode and pure command-line mode:
# Interactive TUI mode
./btcli
# Command line mode - basic translation
./btcli "text to translate"
# Command line mode - with options
./btcli -t zh "Hello world" # Translate to Chinese
./btcli -s en -t zh "Hello world" # Specify source and target languages
./btcli --help # Show help information
./btcli --version # Show version information
The command-line interface supports the following options:
-s, --source LANG: Specify the source language (e.g., en, zh)-t, --target LANG: Specify the target language (e.g., en, zh)-h, --help: Display help information-v, --version: Display version informationExamples:
# Basic translation (uses configured default languages)
btcli "Hello world"
# Translate to specific language
btcli -t zh "Hello world"
# Specify both source and target languages
btcli -s en -t fr "Hello world"
# Get help
btcli --help
The unified build script supports various options:
# Build with default formats (zst,zip) for all common platforms
./scripts/build.sh
# Clean build artifacts
./scripts/build.sh clean
# Build with specific compression formats
./scripts/build.sh build --format zst
./scripts/build.sh build --format zip,gz
# Check dependencies
./scripts/build.sh check
# Build for specific target platforms
./scripts/build.sh --target x86_64-unknown-linux-gnu
./scripts/build.sh --target x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu
./scripts/build.sh --target x86_64-unknown-linux-gnu --format zst
# Build with all files in a single directory (no debug/release separation)
./scripts/build.sh --allin
For release builds, you can compress the binary with UPX to reduce file size:
# Build the release binary
cargo build --release
# Compress the binary with UPX
cargo run --release --bin post_build
This will reduce the binary size significantly (typically by 60-70%).
When using the build script in MSYS2 environment:
pacman -S package-namemingw-w64-x86_64-rust, mingw-w64-x86_64-upx, zip, tarThe build script supports cross-compilation for multiple platforms:
x86_64-unknown-linux-gnuaarch64-unknown-linux-gnuriscv64gc-unknown-linux-gnuaarch64-pc-windows-msvcaarch64-linux-androidarmv7-linux-androideabix86_64-linux-androidi686-linux-androidInstall targets with: rustup target add <target>
The build script also works in Termux environment on Android:
pkg install rust cargo tar zip upx rustup zstdaarch64-linux-android, armv7-linux-androideabi, x86_64-linux-android, i686-linux-androidThe build script generates files with the naming convention:
btcli-{version}-{os}-{arch}.(tar.zst|zip|tar.gz|tar.xz)
Each archive contains:
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2026 S.A. (@snoware)
S.A. (@snoware)