clh-client-0.1.0 is not a library.
clh-client
CLI client for clh-server — fuzzy-search your shell command history across machines.
Uses skim as the fuzzy finder to interactively filter records stored in clh-server, replacing the default Ctrl+R with a server-backed, multi-host history search.
Features
- Fuzzy search — powered by skim (fzf-compatible TUI)
- Auto dedup — same command appears only once (most recently used wins)
- Auto pagination — fetches all records transparently (supports
X-Total-Countfrom server) - zsh integration — auto-record every command and bind
Ctrl+Rto search - Basic auth — compatible with Nginx-protected clh-server instances
Requirements
- Rust 1.80+ (for
cargo install) - A running clh-server instance
Installation
Or build locally:
# binary is at target/release/clh
Setup
1. Create config
Config is stored at ~/.config/clh/config.toml:
[]
= "https://clh.example.com"
= "youruser"
= "yourpassword"
[]
# hostname = "my-machine" # filter to one host (optional)
= 1000
= true
2. Add zsh integration
Add the following to your ~/.zshrc:
This sets up:
- Auto-recording: every command you run is silently POSTed to clh-server in the background
- Ctrl+R binding: opens skim fuzzy search; the selected command is pasted into your prompt (not executed immediately)
Usage
| Command | Description |
|---|---|
clh |
Fuzzy search history (same as clh search) |
clh search |
Fuzzy search history |
clh add --hostname H --pwd P --command C |
Record a command (called by zsh hook automatically) |
clh setup |
Print zsh integration script |
clh config show |
Show current config path and contents |
clh config init --url URL [--user U --password P] |
Create initial config |
Keyboard shortcuts in skim
| Key | Action |
|---|---|
Enter |
Accept — pastes command into prompt |
Esc / Ctrl+C |
Cancel |
Ctrl+P / ↑ |
Move up |
Ctrl+N / ↓ |
Move down |
Server-side pagination
clh-client automatically handles pagination:
- If the server returns an
X-Total-Countresponse header, records are fetched page by page (configurable viapage_size). - If the header is absent (older server), a single request with
limit=<page_size>is made.
To enable full pagination support, add limit/offset query parameters and X-Total-Count header to clh-server. See clh-server-gaps.md for implementation notes.
License
MIT