Write the package of user commands on the first interactive start

When $XDG_CONFIG_HOME/bjosh/commands is not there, an interactive bjosh
writes it with the example, then builds and loads it. An empty directory
turns this off. --new-commands stays, for a start that is not interactive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-12-01 10:57:19 +01:00
parent aa5bae96e0
commit bf961b12f9
4 changed files with 38 additions and 10 deletions

View file

@ -433,8 +433,11 @@ User commands, compiled, loaded into the shell at start-up. Needs
type checker could not tell the records apart in a lambda.
- A package that does not build is stale at each start, so each start
builds it again and shows the error, until it is fixed.
- The first interactive start writes the package with its example, when
its directory is not there; an empty directory turns this off.
~--new-commands~ stays, for a start that is not interactive.
- Measured: 132 ms for ~bjosh -c true~ with the example package loaded.
- Tests: ~tests/extension.bjo~, 23 checks. The other tests: syntax 72,
- Tests: ~tests/extension.bjo~, 25 checks. The other tests: syntax 72,
expand 26, values 59, editor 24, run 60, interactive 16.
** Phase 5: later