feat(lang): std.cli exit-code + --json contract helpers [F3.3]

Foundation milestone close — the minimal exit-code / --json contract
`dist` relies on, in pure sx (no compiler change).

- EX_OK (0) / EX_USAGE (64, sysexits.h) / EX_UNAVAILABLE (70) named
  constants in std.cli.
- exit_ok() / exit_usage() terminators routing through the canonical
  process.exit(code: u8) — removes the hand-rolled cli_bail_exit `_exit`
  binding; the unsupported-platform path now uses proc.exit(EX_UNAVAILABLE).
- --json read is parsed.json (already parsed by F3.2); documented as the
  detection point with a stdout-pure / stderr-human convention.
- examples/0718-modules-cli-exit-json.sx exercises the contract: json true
  with --json / false without, EX_USAGE == 64, and a usage path that exits
  64 via exit_usage() (expected .exit = 64).
- readme.md gains a std.cli command-line-interface subsection.
This commit is contained in:
agra
2026-06-05 01:01:25 +03:00
parent 9db26e9780
commit 0fc7a72cbc
6 changed files with 143 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
ex-ok-is-0: ok
ex-usage-is-64: ok
json-set-true: ok
json-set-false: ok
{"out":"dist"}
usage-error-raised: ok