summaryrefslogtreecommitdiff
path: root/src/fs-help.txt
blob: 4eecad41b1b2e19f7a7b7faa214038fbf62b02d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Pardes control filesystem
=========================
README      this guide
index       one line per pane: serial, kind (text|term|pdf|image), dirty flag, name
status      pid, version and pane count
look        write a line: a right click on it at the active pane; read: the serials it touched
exec        write a line: a middle click, an editor command word or a shell line; read the same
log         recent events, one a line: new/del/rename/save <serial> <name>, and
            msg <serial|-> <text>, what the editor said; write follow to wait (tail -f won't)
screen      rendered screen as JSON, frozen from open to close
listeners   the session's dial addresses
pane/new    open it to make a pane; the read answers that pane's serial
pane/<n>/   name body tag ctl addr dot limit data xdata sel dirty mark scroll
            errors event look exec, and pty/ for terminals; rmdir closes it
os/         the host filesystem
src/        the editor's own sources, only in a -Dembed-sources=true build

Below, $m is the mount point (PARDES_MOUNT in a Tty9p shell; 9ns and 9p work too):

  cat $m/index                                 which panes exist
  n=$(cat $m/pane/new)                        make a pane, take its serial
  echo /etc/hosts:3 > $m/look; cat $m/look     open a file, see the pane it went to
  printf 'text\n' > $m/pane/$n/body            append to a pane (>| truncates first)
  cat $m/pane/$n/name; echo notes.txt > $m/pane/$n/name        read, then rename
  echo Save > $m/pane/$n/exec                  save it; rmdir $m/pane/$n closes it
  echo 'Msg hello' > $m/exec                   show text in the editor
  echo '#0,#5' > $m/pane/$n/addr; printf NEW >> $m/pane/$n/data  replace bytes 0..5
  cp $m/pane/$n/addr $m/pane/$n/dot; cat $m/pane/$n/sel   select the range, read it
  cat $m/pane/$n/dirty; echo 0 > $m/pane/$n/dirty         is it modified? say it is not
  exec 3<>$m/log; echo follow >&3; cat <&3     what happened lately, then wait for more
  cat $m/pane/$n/event                         hold it open to own that pane's clicks
  echo exec > $m/pane/$n/pty/ctl               restart a shell; also winsize C R, sig INT
  exec 3<>$m/pane/$n/pty/run; echo make >&3; cat <&3   exit N then its output; or busy, or error
  printf 'ls\r' > $m/pane/$n/pty/data           type into a terminal; pty/status: cols rows busy

Pitfalls, one each:
  Each open of pane/new makes another pane (ls, stat, find never do); a reread names the same.
  rmdir closes a pane even when it is dirty; index and pane/<n>/dirty show the flag.
  addr, dot and limit read the same pair of offsets they take, so cp between them works.
  dirty, mark and scroll read "0" or "1" and take "0" or "1"; truncating limit lifts it.
  Writing body appends; open it with truncation to replace; writes are whole UTF-8 sequences.
  Truncating tag clears the part you may edit; truncating dot or addr empties it.
  A terminal's body is a history snapshot frozen per open; pty/data is the live stream.
  A failing command is reported in the editor and in log, not as a write error; a bad line fails the write.
  pane/<n>/ctl: acme's status line; takes get (reload), lock/unlock on a held fd (exec 3>ctl; echo lock >&3).