plumbing (1360B) [raw]
1 # plan9 plumbing rules 2 # 3 # currently in use in acme(1) on Linux via plan9port. 4 # 5 # see /usr/lib/plan9/plumb, plumb(7), and regexp(7) 6 # to update: cat $home/lib/plumbing | 9p write plumb/rules 7 8 # urls go to web browser 9 type is text 10 data matches '(https?|file)://[a-zA-Z0-9_@\-]+([.:][a-zA-Z0-9_@\-]+)*/?[a-zA-Z0-9_?,%#~&/\-+=]+([:.][a-zA-Z0-9_?,%#~&/\-+=]+)*' 11 plumb to web 12 plumb start chromium $0 13 14 # image files go to feh 15 type is text 16 data matches '[a-zA-Z0-9_\-./]+' 17 data matches '([a-zA-Z0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|png|PNG)' 18 arg isfile $0 19 plumb to image 20 plumb start feh $file 21 22 # pdf files go to chromium 23 type is text 24 data matches '[a-zA-Z0-9_\-./]+' 25 data matches '([a-zA-Z0-9_\-./]+)\.(pdf|PDF)' 26 arg isfile $0 27 plumb start chromium $file 28 29 # man pages use wiseman to support both system and plan9 roff formats 30 type is text 31 data matches '([a-zA-Z¡-0-9_\-./]+)\(([1-8])\)' 32 plumb start rc -c 'wiseman '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')''' 33 34 # sha1's to git 35 type is text 36 data matches '[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]+' 37 plumb start rc -c 'git -C '$wdir' show '$0' >[2=1] | plumb -i -d edit -a ''action=showdata filename=/'$wdir'/'$0'''' 38 39 # #PR numbers to openpr (for work) 40 type is text 41 data matches '#([0-9]+)' 42 plumb start rc -c 'cd '$wdir' && openpr '$1' 43 44 editor = acme 45 include basic