shrub/pkg/arvo/gen/help.hoon

65 lines
1.6 KiB
Plaintext
Raw Normal View History

2016-10-24 21:52:54 +03:00
:: Describe available comands: +help, +help %tree, +help %hood
2017-02-21 00:41:53 +03:00
::
2016-10-22 03:46:20 +03:00
:::: /hoon/help/gen
::
/? 310
2016-11-17 04:42:58 +03:00
::
2016-10-22 03:46:20 +03:00
::::
::
|%
++ path-heps
|= a/path ^- tape
?~ a ""
|- ^- tape
%+ welp (trip i.a)
?~ t.a ""
['-' $(a t.a)]
::
++ rend
|= {a/@thoon b/path} ^- tank
=; c/(pair tape tape)
=/ tab (sub 10 (mod (lent "{p.c} ") 10))
[%palm [" {(reap tab ' ')}" ``~] leaf+p.c leaf+q.c ~]
:- ?- b
2018-03-19 07:18:20 +03:00
~ "/" :: XX !! maybe?
2016-10-22 03:46:20 +03:00
{$hood ^} "|{(path-heps t.b)}"
^ "+{(path-heps b)}" :: XX deal with :graph-store|foo
2016-10-22 03:46:20 +03:00
==
2017-02-21 00:41:53 +03:00
=/ c (to-wain:format a)
2016-10-22 03:46:20 +03:00
?~ c "~"
?. =(':: ' (end 3 4 i.c))
"<undocumented>"
(trip i.c)
2016-10-22 03:59:51 +03:00
::
++ read-at
|= {len/@u pax/path}
|= {nam/@t ark/arch} ^- (unit {@t path})
?. (~(has by dir.ark) %hoon) ~
2017-02-21 00:41:53 +03:00
%+ bind (file:space:userlib (welp pax /[nam]/hoon))
2016-10-22 03:59:51 +03:00
|= a/* ^- {cord path}
2017-02-21 00:41:53 +03:00
[;;(@t a) (welp (slag len pax) /[nam])]
2016-10-22 03:46:20 +03:00
--
::
:- %say
2018-03-19 07:18:20 +03:00
|= {{now/time @ our/ship ^} typ/$@(~ {p/term ~}) ~}
2016-10-22 03:46:20 +03:00
=/ pax/path /(scot %p our)/home/(scot %da now)/gen :: XX hardcoded
=+ len=(lent pax)
2016-10-22 03:56:24 +03:00
=. pax ?~(typ pax (welp pax /[p.typ]))
2016-10-22 03:59:51 +03:00
:- %tang %- flop ^- tang
2016-10-22 03:46:20 +03:00
=+ ark=.^(arch cy+pax)
2016-10-22 03:59:51 +03:00
%+ welp
?~ typ ~
=/ red ((read-at len (scag len pax)) p.typ ark) :: XX ugly
(drop (bind red rend))
2016-10-22 03:46:20 +03:00
|- ^- tang
=+ =< arl=~(tap by (~(urn by dir.ark) .))
2018-03-19 07:18:20 +03:00
|=({a/@t ~} .^(arch cy+(welp pax /[a])))
2016-10-22 03:59:51 +03:00
%+ welp
=/ dir/(list {@ path})
(murn arl (read-at len pax))
`tang`(turn (sort dir aor) rend)
%- zing ^- (list tang)
%+ turn (sort arl aor)
2016-10-22 03:46:20 +03:00
|= {a/@t b/arch}
2016-10-22 03:59:51 +03:00
^$(pax (welp pax /[a]), ark b)