shrub/pkg/arvo/gen/hood/fuse.hoon

61 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-04-20 06:46:46 +03:00
:: Kiln: Fuse local desk from (optionally-)foreign sources
::
:::: /hoon/fuse/hood/gen
::
2021-05-24 01:43:41 +03:00
/+ *hood-kiln
2021-04-20 06:46:46 +03:00
/* help-text %txt /gen/hood/fuse/help/txt
=, clay
::
::::
::
2021-05-24 01:43:41 +03:00
=>
|%
+$ fuse-arg
$: des=desk
2021-06-26 18:13:19 +03:00
:: specified as [germ path] instead of [path germ] so
:: users can write mate//=base= instead of [/=base= %mate]
2021-06-26 18:13:19 +03:00
::
res=[?([%cancel ~] [bas=path con=(list [germ path])])]
2021-05-24 01:43:41 +03:00
==
2021-06-06 20:39:14 +03:00
::
++ parse-fuse-source
|= bec=beak
^- fuse-source
:: This is a slight overload of the label, but
:: it provides a nicer interface for the user so
:: we'll go with it.
2021-06-26 18:13:19 +03:00
::
2021-06-06 20:39:14 +03:00
?: ?=([%tas *] r.bec)
?: =(p.r.bec %track)
[p.bec q.bec %trak]
bec
bec
::
++ de-beak
|= pax=path
^- beak
=/ bem=beam (need (de-beam pax))
?> =(s.bem /)
-.bem
::
++ path-to-fuse-source
|= pax=path
^- fuse-source
(parse-fuse-source (de-beak pax))
2021-05-24 01:43:41 +03:00
--
2021-04-20 06:46:46 +03:00
:- %say
2021-05-24 01:43:41 +03:00
|= [* [arg=[?(~ fuse-arg)]] [overwrite=$~(| flag) ~]]
2021-05-02 06:04:19 +03:00
:- %kiln-fuse
?~ arg
((slog (turn `wain`help-text |=(=@t leaf+(trip t)))) ~)
2021-05-24 01:43:41 +03:00
:- des.arg
?: ?=([%cancel ~] res.arg)
~
2021-06-06 20:39:14 +03:00
:+ overwrite
(path-to-fuse-source bas.res.arg)
%+ turn
con.res.arg
2021-06-26 18:13:19 +03:00
|= [g=germ pax=path]
2021-06-06 20:39:14 +03:00
^- [fuse-source germ]
[(path-to-fuse-source pax) g]