Mini CLI calculator with REPL
- Go 96.5%
- Shell 3.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| cmd/gt | ||
| completions | ||
| docs | ||
| integrationtests | ||
| internal | ||
| .gitignore | ||
| .golangci.yml.bak | ||
| .goreleaser.yml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| logo.svg | ||
| Magefile.go | ||
| README.md | ||
gt
A command-line calculator with percentage calculations and RPN (Reverse Polish Notation) stack arithmetic, written in Go.
This is a toy project to experiment with local LLMs (Qwen, Gemma, Nemotron, GPT OSS) as pair programmers.
Installation
go install codeberg.org/snonux/gt/cmd/gt@latest
Or using mage:
mage install
Quick Start
gt '20% of 150' # → 30
gt '3 4 +' # RPN: 3 + 4 → 7
gt 'pi 2 *' # 2π → 6.283185307
gt '100Mbps 1hr *' # rate × time → 3.6e+11 bits
gt # interactive REPL
Shell Completions
Fish completions are available in completions/. To install:
cp completions/gt.fish ~/.config/fish/completions/
Or system-wide:
sudo cp completions/gt.fish /usr/local/share/fish/vendor_completions.d/
Feature Guide
All features are documented in docs/:
| Topic | Doc |
|---|---|
| CLI modes, piping, REPL | cli-usage |
| Percentage calculations | percentage-calculations |
| RPN basics | basic-arithmetic |
Fast integer power (**) |
fast-power |
| Logarithm operators | log-operators |
| Hyper (n-ary) operators | hyper-operators |
| Comparisons and booleans | comparisons |
| Variables and assignment | variables |
Symbols (:x syntax) |
symbols |
| Built-in constants | constants |
| Stack manipulation | stack-operations |
| Metrics and units | metrics |
| Unit conversion | unit-conversion |
| Metric commands | metric-commands |
| Custom metrics | custom-metrics |
| REPL mode | repl-mode |
| Rational number mode | rational-mode |
| Fish shell completions | completions |
Building and Testing
mage build # Build the binary
mage test # Run all tests
License
See LICENSE for details.