about summary refs log tree commit diff
path: root/users/sterni/acme/plumb/tvl
blob: 994b4129a83352a72bb64c6a66b4637884407ff2 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# TODO(sterni): document TVL short links,
# for now see //tools/cheddar, //web/atward, //tools/magrathea
# and //ops/modules/monorepo-gerrit.

# 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 revision short links e.g. r/9000, r/3

type	is	text
data	matches	'r/([0-9]+)'
data	set	refs/r/$1
plumb	start	rc -c 'cd '$wdir'; cd `{git rev-parse --show-toplevel} && git show --pretty=fuller '$data' | plumb -i -d edit -a ''action=showdata filename=+git/'$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.
# TODO(sterni): only be strict at the boundary
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