shrub/gen/help.hoon

65 lines
1.5 KiB
Plaintext
Raw Normal View History

2016-10-24 21:52:54 +03:00
:: Describe available comands: +help, +help %tree, +help %hood
2016-10-22 03:46:20 +03:00
::
:::: /hoon/help/gen
::
/? 310
!:
::::
::
|%
++ 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
$~ "/" :: XX !! maybe?
{$hood ^} "|{(path-heps t.b)}"
^ "+{(path-heps b)}" :: XX deal with :talk|foo
==
=/ c (lore a)
?~ 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) ~
%+ bind (file (welp pax /[nam]/hoon))
|= a/* ^- {cord path}
[;;(@t a) (welp (slag len pax) /[nam])]
2016-10-22 03:46:20 +03:00
--
::
:- %say
2016-10-22 03:56:24 +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) .)))
|=({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)