summaryrefslogtreecommitdiff
path: root/src/plumbing
blob: 4e8cd70261919cf9835db7467b29cf794b74edd1 (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
# pardes's plumbing rules, in plumb(6)'s language: a plumbing file of
# your own names this one as `include basic`. A message (plumb/send) is
# matched against the rule sets in order; the first whose patterns all
# hold takes it, and its actions say where it goes: a port pardes reads
# itself (edit: a file or directory opened as Look opens one; web: the
# host's browser; a loaded kind by its name, `image`, `pdf`), another
# port a program reads, or a word or program started. One that none
# takes is Look's own: a file or directory opened, else the word
# searched for. A look sends what it looks at: type text, src pardes
# (term from a terminal's raw mode, a kind's name from its pane), wdir
# its pane's directory, data the name as Look reads it.

# urls go to the web browser (the host's: xdg-open, open on macOS)
type	is	text
data	matches	'https?://.*'
plumb	to	web

# a diff or patch looked at bare is stacked in a +Diff; one with no
# hunk in it opens as text
type	is	text
data	matches	'.*\.(diff|patch)'
arg	isfile	$data
plumb	start	Diff $file

# existing directories, and existing files at the place written after
# them, go to the editor; a file a kind shows (a picture, a PDF) to
# that kind
type	is	text
arg	isdir	$data
plumb	to	edit

type	is	text
arg	isfile	$data
plumb	to	edit

# a commit hash looked at in the editor, in a git work tree: git show,
# stacked in a +Diff (outside one, Diff declines and the word is
# searched for)
type	is	text
src	is	pardes
data	matches	'[0-9a-f]{7,40}'
data	matches	'[0-9a-f]*[0-9][0-9a-f]*'
data	matches	'[0-9a-f]*[a-f][0-9a-f]*'
plumb	start	Diff $0

# a diff paged (git show, git log -p) is shown stacked in a +Diff in
# its +Pager's place
type	is	text/x-diff
attr	delete	action
attr	add	action=showdiff
plumb	to	edit