# plan9 plumbing rules # # currently in use in acme(1) on Linux via plan9port. # # see /usr/lib/plan9/plumb, plumb(7), and regexp(7) # to update: cat $home/lib/plumbing | 9p write plumb/rules # urls go to web browser type is text data matches '(https?|file)://[a-zA-Z0-9_@\-]+([.:][a-zA-Z0-9_@\-]+)*/?[a-zA-Z0-9_?,%#~&/\-+=]+([:.][a-zA-Z0-9_?,%#~&/\-+=]+)*' plumb to web plumb start chromium $0 # image files go to feh type is text data matches '[a-zA-Z0-9_\-./]+' data matches '([a-zA-Z0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|png|PNG)' arg isfile $0 plumb to image plumb start feh $file # pdf files go to chromium type is text data matches '[a-zA-Z0-9_\-./]+' data matches '([a-zA-Z0-9_\-./]+)\.(pdf|PDF)' arg isfile $0 plumb start chromium $file # man pages use wiseman to support both system and plan9 roff formats type is text data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)' plumb start rc -c 'wiseman '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')''' # sha1's to git type is text data matches '[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]+' plumb start rc -c 'git -C '$wdir' show '$0' >[2=1] | plumb -i -d edit -a ''action=showdata filename=/'$wdir'/'$0'''' # #PR numbers to openpr (for work) type is text data matches '#([0-9]+)' plumb start rc -c 'cd '$wdir' && openpr '$1' editor = acme include basic