kaffeecli/README.md
2025-08-29 19:33:30 +02:00

92 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# klog
`klog` is a small command-line tool to log coffee brewing events to the Kaffeelogger-API via HTTP POST requests.
I have half-vibe-coded it with the help of ChatGPT.
It is built with Go and uses a simple configuration file to store your API settings and token.
---
## Features
- **Commands**
- `klog config token <token>` store the access token
- `klog config url <url>` set API endpoint
- `klog config insecure <true|false>` ignore self-signed SSL certs
- `klog config show` show current configuration
- `klog c` (aliases: `klog k`, `klog coffee`, `klog kaffee`) log a coffee event
- `klog brew <waterIn> [--notify=<true|false>] [--plan=<true|false>] [--planTime=<minutes>]` log a brew with options
- **Formatted output**
Responses from the server (usually JSON) are displayed as a table for easier reading.
---
## Installation
### Build from source
Make sure you have [Go installed](https://go.dev/dl/).
```bash
git clone https://dev.hflabs.de/henner/kaffeecli.git
cd klog
go build -o bin/klog main.go
```
### Prebuilt binaries
On tagged releases, prebuilt binaries for Linux and Windows are available under the [Releases](releases) section.
---
## Usage
### Configure the tool
```bash
# Set API token
klog config token my-secret-token
# Set Kaffeelogger URL
klog config url https://example.com/
# Show current configuration
klog config show
```
### Log events
```bash
# Quick coffee log
klog c
# Brew with parameters
klog brew 1250 # plans a brew with 1250mL and notifies in 8 min.
klog brew 250 --notify=true --plan=true --planTime=5 # plans a brew with 250mL and notifies in 5 min.
```
---
## Development
Run locally:
```bash
go run main.go
```
Compile for Linux:
```bash
GOOS=linux GOARCH=amd64 go build -o bin/klog main.go
```
Compile for Windows:
```bash
GOOS=windows GOARCH=amd64 go build -o bin/klog.exe main.go
```
---
## License
MIT License. See [LICENSE](LICENSE) for details.