]> gitweb.factorcode.org Git - factor.git/blob - extra/file-monitor/file-monitor.factor
factor: trim using lists
[factor.git] / extra / file-monitor / file-monitor.factor
1 ! Copyright (C) 2015 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
3
4 USING: accessors command-line formatting io io.monitors
5 kernel namespaces sequences ;
6
7 IN: file-monitor
8
9 : file-monitor-loop ( monitor -- )
10     dup next-change [ changed>> ] [ path>> ] bi
11     "%u %s\n" printf flush file-monitor-loop ;
12
13 : file-monitor-main ( -- )
14     command-line get ?first "." or
15     dup "Monitoring %s\n" printf flush
16     [ t [ file-monitor-loop ] with-monitor ] with-monitors ;
17
18 MAIN: file-monitor-main