urbit/main/bin/cd.hoon
2013-09-28 13:21:18 -07:00

28 lines
594 B
Plaintext

!:
:: /=main=/bin/cd/hoon
::
=> .(-< `who=@p`-<)
|= [est=time *]
|= arg=$|(~ [p=path ~])
:_ ~
^- (list gift)
?~ arg
:~ [%cc ~]
[%cs ~]
==
?. ?=(^ p.arg) ~
?. =(i.p.arg (scot %p who)) ~|(%bad-ship !!)
?. ?=(^ t.p.arg) ~
=+ gav=(slay i.t.p.arg)
?. ?=([~ %$ %tas *] gav) ~|(%bad-desk !!)
:- [%ck q.p.u.gav]
?. ?=(^ t.t.p.arg) ~
=+ gov=(slay i.t.t.p.arg)
:- :- %cc
?+ gov ~|(%bad-case !!)
[~ %$ %da *] ?:(=(est q.p.u.gov) ~ [~ %da q.p.u.gov])
[~ %$ %ud *] [~ %ud q.p.u.gov]
[~ %$ %tas *] [~ %tas q.p.u.gov]
==
[[%cs t.t.t.p.arg] ~]