2015-12-08 04:46:18 +03:00
|
|
|
:: File writer module
|
|
|
|
::
|
|
|
|
:::: /hoon/write/lib
|
|
|
|
::
|
2016-02-18 02:36:43 +03:00
|
|
|
/? 310
|
2015-12-08 04:46:18 +03:00
|
|
|
|%
|
2016-02-01 09:16:26 +03:00
|
|
|
++ part {$write $0 pith} :: no state
|
|
|
|
++ pith $~
|
2015-12-08 04:46:18 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
::::
|
|
|
|
::
|
|
|
|
|%
|
2016-02-01 09:16:26 +03:00
|
|
|
++ data $%({$json json} {$mime mime})
|
|
|
|
++ card $% {$exec wire @p $~ {beak silk}}
|
|
|
|
{$info wire @p toro}
|
2015-12-08 04:46:18 +03:00
|
|
|
==
|
|
|
|
--
|
|
|
|
::
|
|
|
|
::::
|
|
|
|
::
|
2016-02-12 02:29:52 +03:00
|
|
|
|= {bowl part}
|
2015-12-08 04:46:18 +03:00
|
|
|
=* par +<+
|
2016-02-01 09:16:26 +03:00
|
|
|
|_ moz/(list {bone card})
|
2015-12-08 04:46:18 +03:00
|
|
|
++ abet [(flop moz) `part`par]
|
2016-02-01 09:16:26 +03:00
|
|
|
++ emit |=(a/card %_(+> moz :_(moz [ost a])))
|
2015-12-08 04:46:18 +03:00
|
|
|
++ beak-now byk(r [%da now])
|
2015-12-11 01:04:59 +03:00
|
|
|
++ poke-wipe
|
2016-02-12 02:29:52 +03:00
|
|
|
|= sup/spur ^+ abet :: XX determine extension, beak
|
2015-12-11 01:04:59 +03:00
|
|
|
=+ ext=%md
|
|
|
|
?~ (file (tope beak-now [ext sup]))
|
2016-02-12 02:29:52 +03:00
|
|
|
~|(not-found+[ext `path`(flop sup)] !!)
|
|
|
|
=- abet:(emit %info write+~ our -)
|
2015-12-11 01:04:59 +03:00
|
|
|
(fray (tope beak-now [ext sup]))
|
|
|
|
::
|
2015-12-10 01:12:59 +03:00
|
|
|
++ poke-tree
|
2016-02-10 22:03:28 +03:00
|
|
|
|= {sup/spur mim/mime} ^+ abet :: XX determine extension, beak
|
2015-12-11 01:04:59 +03:00
|
|
|
(poke--data [`%md (flop sup)] %mime mim)
|
2015-12-08 04:46:18 +03:00
|
|
|
::
|
|
|
|
++ poke-paste
|
2016-02-01 09:16:26 +03:00
|
|
|
|= {typ/?($hoon $md $txt) txt/@t} ^+ abet
|
2016-02-12 02:29:52 +03:00
|
|
|
(poke--data [`typ /web/paste/(scot %da now)] %mime / (taco txt))
|
2015-12-08 04:46:18 +03:00
|
|
|
::
|
2016-02-04 04:46:14 +03:00
|
|
|
++ poke-comment
|
2016-02-10 22:03:28 +03:00
|
|
|
|= {pax/path txt/@t} ^+ abet
|
2016-02-09 02:23:36 +03:00
|
|
|
=. pax [%web (welp pax /comments/(scot %da now))]
|
2016-02-04 04:46:14 +03:00
|
|
|
=. txt (rap 3 (scot %p src) ': ' txt ~)
|
2016-02-09 02:23:36 +03:00
|
|
|
(poke--data [`%md pax] %mime / (taco txt))
|
2016-02-04 04:46:14 +03:00
|
|
|
::
|
2015-12-08 04:46:18 +03:00
|
|
|
++ poke--data
|
2016-02-01 09:16:26 +03:00
|
|
|
|= {{ext/(unit @t) pax/path} dat/data} ^+ abet
|
2015-12-08 04:46:18 +03:00
|
|
|
?~ ext $(ext [~ -.dat])
|
2016-02-01 09:16:26 +03:00
|
|
|
=+ cay=?-(-.dat $json [-.dat !>(+.dat)], $mime [-.dat !>(+.dat)])
|
|
|
|
?: =(u.ext -.dat)
|
2016-02-12 02:29:52 +03:00
|
|
|
(made pax ~ &+cay)
|
2015-12-08 04:46:18 +03:00
|
|
|
=< abet
|
2016-02-01 09:16:26 +03:00
|
|
|
%^ emit %exec write+pax :: XX defer %nice
|
2016-02-12 02:29:52 +03:00
|
|
|
[our ~ beak-now %cast u.ext $+cay]
|
2015-12-08 04:46:18 +03:00
|
|
|
::
|
|
|
|
++ made
|
2016-02-01 09:16:26 +03:00
|
|
|
|= {pax/wire @ res/gage} ^+ abet
|
2016-02-04 04:46:14 +03:00
|
|
|
:: ?. =(our src)
|
|
|
|
:: ~|(foreign-write/[our=our src=src] !!)
|
2016-02-12 02:29:52 +03:00
|
|
|
?+ -.res ~|(gage+-.res !!)
|
2016-02-01 09:16:26 +03:00
|
|
|
$| (mean p.res)
|
|
|
|
$& =- abet:(emit %info write+~ our -)
|
2015-12-08 04:46:18 +03:00
|
|
|
(foal :(welp (tope beak-now ~) pax /[-.p.res]) p.res)
|
|
|
|
==
|
|
|
|
--
|
2016-02-12 02:29:52 +03:00
|
|
|
|