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

@ -66,8 +66,12 @@
(expect "> >> <" (c (str "echo x >" file "; echo y >>" file "; cat <" file)) "x\ny")
(expect "2>" (c (str "ls /no/such/dir 2>" file "; echo $?; grep -c . " file)) "2\n1")
(expect "> alone makes an empty file" (c (str ">" file "; wc -c <" file)) "0")
(expect "2>&1 is not supported yet" (c "ls 2>&1")
"err: bjosh: 2>&1 and >&2 are not supported yet\ncode: 2")
(expect "2>&1 into a pipe" (c "ls /no/such/dir 2>&1 | grep -c such") "1")
(expect ">FILE 2>&1" (c (str "ls /no/such/dir >" file " 2>&1; grep -c such " file)) "1")
(expect "2>&1 before >" (c (str "ls 2>&1 >" file))
"err: bjosh: 2>&1 before > or >> is not supported yet: write >FILE 2>&1\ncode: 2")
(expect ">&2 is not supported yet" (c "echo x >&2")
"err: bjosh: >&2 is not supported yet\ncode: 2")
;; Shell commands.
(expect "cd and pwd" (c "cd /tmp; pwd") "/tmp")