mv and rm.

This commit is contained in:
C. Guy Yarvin 2014-03-05 13:42:47 -08:00
parent 139449b86c
commit 69f6b2bb91
3 changed files with 45 additions and 0 deletions

View File

@ -1212,6 +1212,26 @@
?> ?=([* * * *] pax)
[i.t.pax [%& ~ [*cart [[t.t.t.pax (feel pax val)] ~]]]]
::
++ fray :: high-level delete
|= pax=path
^- toro
?> ?=([* * * *] pax)
[i.t.pax [%& ~ [*cart [[t.t.t.pax [%del .^(%cx pax)]] ~]]]]
::
++ furl :: unify changes
|= [one=toro two=toro] !:
^- toro
~| %furl
?> ?& =(p.one p.two) :: same path
&(?=(& -.q.one) ?=(& -.q.two)) :: both deltas
&(?=(~ p.q.one) ?=(~ p.q.two)) :: not merges
==
:- p.one
:+ %&
~
:- *cart
(weld `(list tako)`q.q.q.one `(list tako)`q.q.q.two)
::
++ glam
|= zar=@p ^- tape
%+ snag zar

10
main/bin/mv.hoon Normal file
View File

@ -0,0 +1,10 @@
!: :: /=main=/bin/mv/hoon
!? 164
::::
|= *
|= [input=path output=path ~]
^- bowl
::::
:_ ~ :_ ~
^- gift
[%ok (furl (foal output .^(%cx input)) (fray input))]

15
main/bin/rm.hoon Normal file
View File

@ -0,0 +1,15 @@
!: :: /=main=/bin/rm/hoon
!? 164
::::
|= *
|= files=(list path)
^- bowl
::::
:_ ~
=+ cag=(turn files fray)
?~ cag ~
:_ ~
:- %ok
|- ^- toro
?~ t.cag i.cag
(furl i.t.cag $(t.cag t.t.cag))