Merge branch 'master' of git://factorcode.org/git/factor
[factor/jcg.git] / extra / log-viewer / log-viewer.factor
blob263454f7692e132ad57205976240068a3685299a
1 USING: kernel io io.files io.pathnames io.monitors io.encodings.utf8 ;\r
2 IN: log-viewer\r
3 \r
4 : read-lines ( stream -- )\r
5     dup stream-readln dup\r
6     [ print read-lines ] [ 2drop flush ] if ;\r
7 \r
8 : tail-file-loop ( stream monitor -- )\r
9     dup next-change 2drop over read-lines tail-file-loop ;\r
11 : tail-file ( file -- )\r
12     dup utf8 <file-reader> dup read-lines\r
13     swap parent-directory f <monitor>\r
14     tail-file-loop ;\r