Phase 2, first part: values and value commands

- Values are Json of (text json); a record is JsonFields.
- Value commands: files, procs, open, where, select, get, sort-by,
  first, last, count, reverse, uniq, lines, from-json, to-json,
  from-csv, to-csv, each with a short name.
- Value commands next to each other run as one unit: a (std run)
  filter in a job, or in the shell when a line has no program.
- Records are shown as a table; values go to programs as lines.
- A name is a shell command, a short name, a program on PATH, then a
  long name.
- 2>&1, with >FILE 2>&1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-12-01 07:05:09 +01:00
parent 3518b7711d
commit 027acc84e6
12 changed files with 1142 additions and 37 deletions

View file

@ -48,6 +48,8 @@
"printf 'echo status $?\\r'" "sleep 0.5"
"printf 'ech'" "sleep 0.3" "printf '\\032'" "sleep 0.5"
"printf 'o alive\\r'" "sleep 0.5"
"printf 'printf x | u\\r'" "sleep 1"
"printf 'stty tostop; printf y | u; stty -tostop\\r'" "sleep 1"
"printf 'exit\\r'" "sleep 1"]
"; "))
(def command (str "(" keys ") | XDG_STATE_HOME=" state " script -qec 'dotnet src/main.exe' /dev/null"))
@ -61,6 +63,8 @@
(expect-true "Ctrl-C ends a job, and the prompt starts a new line" (string-contains? out "^C\n"))
(expect-true "with status 130" (string-contains? out "status 130"))
(expect-true "Ctrl-Z at the prompt does not stop the shell" (string-contains? out "\nalive\n"))
(expect-true "a value command at the end of a job" (string-contains? out "printf x | u\nx\n"))
(expect-true "and with tostop set" (string-contains? out "stty -tostop\ny\n"))
(expect-true "the history is saved"
(match (file-read-text (path-combine state "bjosh/history"))
((Ok text) (string-contains? text "kill %1"))