move "XX moveme to lib/" // generator-bits to lib

This commit is contained in:
Anton Dyudin 2017-11-29 12:14:58 -08:00
parent 212f58368f
commit 10754dc172
5 changed files with 30 additions and 33 deletions

View File

@ -3,8 +3,7 @@
:::: /hoon/cat/gen :::: /hoon/cat/gen
:: ::
/? 310 /? 310
// /%%/ls/subdir /+ pretty-file, show-dir
// /%/pretty
:: ::
:::: ::::
:: ::
@ -29,6 +28,6 @@
* *
=- [palm+[": " ``~]^-]~ =- [palm+[": " ``~]^-]~
:~ rose+[" " `~]^~[leaf+"*" (smyt pax)] :~ rose+[" " `~]^~[leaf+"*" (smyt pax)]
`tank`(subdir vane pax dir.ark) `tank`(show-dir vane pax dir.ark)
== ==
== ==

View File

@ -3,7 +3,7 @@
:::: /hoon/ls/gen :::: /hoon/ls/gen
:: ::
/? 310 /? 310
// /%/subdir /+ show-dir
:: ::
:::: ::::
:: ::
@ -11,4 +11,4 @@
:- %say :- %say
|= {^ {arg/path $~} vane/?($g $c)} |= {^ {arg/path $~} vane/?($g $c)}
=+ lon=.^(arch (cat 3 vane %y) arg) =+ lon=.^(arch (cat 3 vane %y) arg)
tang+[?~(dir.lon leaf+"~" (subdir vane arg dir.lon))]~ tang+[?~(dir.lon leaf+"~" (show-dir vane arg dir.lon))]~

View File

@ -1,25 +0,0 @@
:: Filesystem iterator XX move to lib/
::
:::: /hoon/subdir/ls/gen
::
/? 310
|%
++ subdir
|= {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]))
--

View File

@ -1,9 +1,10 @@
:: Pretty-printing util, should be in lib/ :: Untyped best-guess printer
:: ::
:::: /hoon/pretty/cat/gen :::: /hoon/pretty-file/lib
:: ::
/? 310 /? 310
:: ::
=< pretty-file
|% |%
++ pretty-noun ++ pretty-noun
|= pri/* ^- tank |= pri/* ^- tank
@ -21,8 +22,8 @@
:: ::
++ vale-cord |=(a/cord `?`(levy (trip a) |=(b/@ |((gte b 32) =(10 b))))) ++ vale-cord |=(a/cord `?`(levy (trip a) |=(b/@ |((gte b 32) =(10 b)))))
:: ::
++ wain-to-tang |=(a/wain (turn a |=(b/cord leaf+(trip b))))
++ pretty-file ++ pretty-file
=+ wain-to-tang=|=(a/wain (turn a |=(b/cord leaf+(trip b))))
|= fyl/* ^- tang |= fyl/* ^- tang
=+ `(unit wain)`?@(fyl `(to-wain:format fyl) ((soft wain) fyl)) =+ `(unit wain)`?@(fyl `(to-wain:format fyl) ((soft wain) fyl))
?^ - (wain-to-tang u) ?^ - (wain-to-tang u)

22
lib/show-dir.hoon Normal file
View File

@ -0,0 +1,22 @@
:: 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]))