tgcli-0.2.1 is not a library.
tgcli
Telegram CLI tool in pure Rust using grammers (MTProto). No TDLib, no C/C++ dependencies. cargo build and done.
Quick Install
Homebrew (macOS/Linux)
Shell Script
|
Build from Source
Features
- Auth: Phone → code → 2FA authentication
- Sync: Bootstrap + live updates, stored in libSQL (turso) with FTS5
- Chats: List and show chats from local DB
- Messages: List, search (FTS5), context view, show
- Send: Text messages (direct or via Unix socket IPC)
- Contacts: Search and show from local DB
- Read: Mark messages as read
- Output: Human-readable tables or
--json
Quick Start
# Build (no system dependencies needed!)
# Or with just
# Authenticate
# Sync messages
# List chats
# Search messages
# Send a message
Architecture
src/
main.rs CLI entry point (clap)
cmd/ Command handlers
auth.rs Phone → code → 2FA
sync.rs Bootstrap + live sync daemon
chats.rs List/show chats
messages.rs List/search/context/show messages
send.rs Send text messages
contacts.rs Search/show contacts
read.rs Mark as read
version.rs Version info
store/ turso (libSQL) + FTS5 storage
tg/ grammers client wrapper
app/ App struct + business logic
sync.rs Sync logic
send.rs Send logic
socket.rs Unix socket IPC
out/ Output formatting
Storage
- Session:
~/.tgcli/session.db(grammers SqliteSession) - Data:
~/.tgcli/tgcli.db(chats, contacts, messages + FTS5) - Socket:
~/.tgcli/tgcli.sock(IPC for concurrent send during sync)
Why Rust?
The Go version (tgcli-go) uses TDLib (C++), requiring complex cross-compilation and system dependencies. tgcli is pure Rust — zero C/C++ deps, single cargo build, tiny binary.
Uses turso for database storage — a pure Rust libSQL implementation with no native compilation required.
See Also
- tgcli-go - Go/TDLib version (more features, requires TDLib)
License
MIT