]> git.hungrycats.org Git - bees/commit
config: add --show-builtin-config and --show-config
authorZygo Blaxell <bees@furryterror.org>
Mon, 31 Aug 2026 00:42:14 +0000 (20:42 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sat, 5 Sep 2026 04:03:59 +0000 (00:03 -0400)
commit3b0f209fcfd7c8d57a6c63a9b20449affa9fda5d
tree275a70f61e3bbd6bfa9326b031ee8d041d8809b0
parentec7841e4b32565d612031a941d1e65906014b812
config: add --show-builtin-config and --show-config

There was no way to ask a bees build what configuration it would actually
use.  The built-in schema is only readable by reading the source of the
version files, and the merged view -- builtin under global under local
under argv, with ${VAR} expanded and one schema chained onto another --
exists only inside a running daemon.  An operator debugging a config
problem had to infer the answer from behaviour.

Add two options that print it.  --show-builtin-config VERSION resolves a
schema version and writes what it resolves to; --show-config ROOT_PATH
loads configuration for a real filesystem and writes the merged result.
Both write to stdout and exit without starting deduplication.

The builtin form reads nothing at all: no filesystem, no config file, no
environment.  That is what makes it usable offline, and it is why
--config and --option are now recorded during option parsing and applied
afterwards rather than acted on as getopt_long reaches them.  Option
order belongs to the caller, so applied inline, --config f.conf
--show-builtin-config 2 would have read f.conf before the early exit ran,
and the command would be lying about what it loaded.

The output is INI, and carries the highest-priority non-blank comment for
each key along with the value, so what it prints is also documentation
for what it prints.  A builtin version is dumped through the same builder
as the merged view, because with inheritance in play the text a version
registered is no longer the same thing as what that version resolves to.

Assisted-by: Claude-Code:claude-opus-5
docs/options.md
src/bees-config.cc
src/bees-config.h
src/bees-usage.cc
src/bees.cc