Files

57 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2026-07-10 20:39:42 +02:00
# ask
A CLI tool that answers command-line questions using an OpenAI-compatible LLM API.
## Requirements
- **Go** 1.26+ (to build)
- Runtime tools: `tldr`, `man` / `col -b`, `glow`, `less`
## Installation
```bash
git clone <repo> && cd ask
go build -o ask .
```
Or place the binary somewhere on your `PATH`.
## Usage
```
ask [options] <question>
```
| Flag | Mode | Description |
|------|------|-------------|
| | default | Generates a runnable shell command (uses TLDR + man page context) |
| `-q` | question | Answers general command-line questions (rendered with glow) |
| `-H` | history | Answers questions about your shell history (last 200 lines) |
| `-p` | paginate | Pipes output through `less -R` |
| `-h` | help | Prints help text |
### Examples
```bash
ask how to find large files
ask -q how does rsync work
ask -H what command did I use for docker yesterday
ask -p how to compress a directory
```
## Configuration
Environment variables:
| Variable | Default | Description |
|---|---|---|
| `OPENAI_BASE_URL` | `http://10.0.2.145:8090/v1` | API endpoint |
| `OPENAI_API_KEY` | — | API key (optional) |
| `OPENAI_MODEL` | `gpt-4o-mini` | Model name |
## Tests
```bash
./test_ask.sh
```