snix/users/sterni/acme/plumb/tvl
sterni 47cda5e89f feat(sterni/acme): add initial plumbing rules
Rules for the Plan 9 plumber (see https://9p.io/sys/doc/plumb.pdf)
allowing quick navigation through depot (and related services) in acme.

- man, urls: some rules that I like taken from /plumb/basic and split
  across individual files.
- tvl: incomplete support for TVL short links and targets:
  - //…
  - cl/…
  - b/…

As mentioned, these are incomplete and I want to implement the remaining
short links and things like git support. I want to continue
experimenting with the plumber, but what I've got so far is already
pretty cool. Eventually, I'll want to implement something equivalent for
Emacs (maybe via Hyperbole) which is probably going to be of general
interest to depot users.

Change-Id: I678f000369db4c7ce30b2aedbc2dbccf3ddef0a9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13026
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2025-01-21 20:18:54 +00:00

71 lines
1.7 KiB
Text

# TODO(sterni): document TVL short links,
# for now see //tools/cheddar, //web/atward, //tools/magrathea
# and //ops/modules/monorepo-gerrit.
# TODO(sterni): r/([0-9]+)
# TVL short links that go to the browser, e.g. cl/8413, b/187
type is text
data matches 'cl/([0-9]+)'
data set https://cl.tvl.fyi/c/depot/+/$1
plumb to web
plumb start web $data
type is text
data matches 'b/([0-9]+)'
data set https://b.tvl.fyi/issues/$1
plumb to web
plumb start web $data
# TVL target short links
# TODO(sterni): implement subtargets
# TODO(sterni): can we add an acme address to target paths somehow?
# TODO(sterni): look at //tools/magrathea's parsing.
depotpathchar = '[^:.,!"'' ]'
depotpath = '//('$depotpathchar'+)'
# TVL short links to files in depot, open in local editor, e.g.
#
# - //users/sterni/acme/plumb/tvl,
# - //default.nix,
# - //nix/readTree/README.md,
# - //tools/magrathea/mg.scm
#
# We impose the same restrictions for the initial path,
# but are liberal in the file name
type is text
data matches '//('$depotchar'+/)?([^ ]*'$depotpathchar')'
arg isfile $depot/$1$2
data set $file
plumb to edit
plumb client $editor
# TVL short links to directories in depot, mapped to default.nix, e.g. //nix/readTree
type is text
data matches $depotpath
arg isfile $depot/$1/default.nix
data set $file
plumb to edit
plumb client $editor
# TVL short links to targets that aren't expressed by default.nix, e.g. //third_party/lisp/alexandria
type is text
data matches $depotpath
arg isfile $depot/$1.nix
data set $file
plumb to edit
plumb client $editor
# TVL short links to directories in depot (without default.nix), e.g. //ops/machines
type is text
data matches $depotpath
arg isdir $depot/$1
data set $dir
plumb to edit
plumb client $editor