From 5b2bb7e681e099b641d9a55249508cba54cf6a38 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sun, 11 Oct 2026 20:56:17 +0200 Subject: [PATCH] Answer architecture round 2: every error a custom CLI prints names it, the help marks where the name goes, the version line checks the main module first, and the README embed compiles for data without a table --- README.md | 6 +++--- cli/cli.go | 48 ++++++++++++++++++++++++++++++------------------ cli/cli_test.go | 4 ++++ todo.md | 2 +- 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index fc7d711..93e9817 100644 --- a/README.md +++ b/README.md @@ -441,14 +441,14 @@ import ( "github.com/larvit/fejkdata/data" ) -//go:embed *.json *.tsv +//go:embed *.json var mydata embed.FS func main() { os.Exit(cli.Main(append(data.Modules(), mydata)...)) } ``` -It takes `fejkdata`'s flags and exit codes, and names itself by the file it runs from in -its help and errors. `--no-shipped-data` leaves out the modules passed to `Main`, and +Add `*.tsv` to the embed where your data holds a table. The CLI takes `fejkdata`'s flags +and exit codes, and names itself by the file it runs from in its help and errors. `--no-shipped-data` leaves out the modules passed to `Main`, and `--version` prints your module's version beside the fejkdata version it is built with. `fejkdata`'s own `main` is `os.Exit(cli.Main(data.Modules()...))`. diff --git a/cli/cli.go b/cli/cli.go index ddc287d..55dd7e2 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -22,16 +22,16 @@ import ( "github.com/larvit/fejkdata" ) -const usage = `Usage: