urbit/lib/show-dir.hoon
2017-11-29 12:14:58 -08:00

23 lines
492 B
Plaintext

:: Display directory contents
::
:::: /hoon/show-dir/lib
::
/? 310
|= {vane/?($g $c) pax/path des/(map @t $~)}
^- tank
:+ %rose [" " `~]
%+ turn (sort ~(tap by des) aor)
|= {kid/@ta $~}
=+ paf=`path`/[kid]
=- :+ %rose ["/" ~ ?:(dir "/" ~)]
(turn paf |=(a/knot leaf+(trip a)))
|- ^- {dir/? paf/path}
=+ arf=.^(arch (cat 3 vane %y) (weld pax paf))
?^ fil.arf
[| paf]
?~ dir.arf
[& paf] :: !!
?. ?=({^ $~ $~} dir.arf)
[& paf]
$(paf (welp paf /[p.n.dir.arf]))