shrub/mar/lens/command.hoon

64 lines
1.3 KiB
Plaintext
Raw Normal View History

2016-02-27 04:13:00 +03:00
/- lens
2017-02-14 03:02:25 +03:00
/+ old-zuse
2016-11-17 04:42:58 +03:00
::
2017-02-14 03:02:25 +03:00
=, old-zuse
2016-02-27 04:13:00 +03:00
|_ com/command:lens
++ grab
|%
++ noun command:lens
++ json
|= jon/^json
^- command:lens
2016-05-04 02:26:52 +03:00
~| jon=jon
2016-02-27 04:13:00 +03:00
%- need
%. jon
=> [. jo]
=< %- ot :~
2016-03-09 04:19:28 +03:00
source+source
sink+sink
2016-02-27 04:13:00 +03:00
==
|%
++ source
^- $-(^json (unit source:lens))
2016-03-09 04:19:28 +03:00
|= jon/^json
2016-03-12 03:37:11 +03:00
=+ tuple=%.(jon (ar source))
?^ tuple
`[%tuple u.tuple]
2016-03-09 04:19:28 +03:00
%. jon
2016-02-27 04:13:00 +03:00
%- of :~
data+so:jo
dojo+so:jo
2016-03-08 01:06:17 +03:00
clay+so:jo
2016-02-27 04:13:00 +03:00
url+(su auri:urlp)
api+(su ;~(plug sym ;~(pfix col prn)))
2016-03-08 01:06:17 +03:00
:- %get-api
%- su
;~ plug
sym
;~(pfix col (more fas (cook crip (star ;~(less fas prn)))))
==
2016-02-27 04:13:00 +03:00
listen-api+(su ;~(plug sym ;~(pfix col sym)))
2016-03-09 04:19:28 +03:00
as+(ot mark+(su sym) next+source ~)
hoon+(ot code+so:jo next+source ~)
2016-02-27 04:13:00 +03:00
==
++ sink
^- $-(^json (unit sink:lens))
%- of :~
stdout+|=(^json (some ~))
output-file+so:jo
output-clay+(su (easy /sentinel/path))
url+(su auri:urlp)
to-api+(su ;~(plug sym ;~(pfix col prn)))
2016-03-09 04:19:28 +03:00
:- %send-api
%- su
;~ plug
sym
;~(pfix col (more fas (cook crip (star ;~(less fas prn)))))
==
2016-02-27 04:13:00 +03:00
command+so:jo
app+(su sym)
==
--
--
--