1 ! Copyright (C) 2015 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: accessors command-line formatting io io.monitors
5 kernel namespaces sequences ;
9 : file-monitor-loop ( monitor -- )
10 dup next-change [ changed>> ] [ path>> ] bi
11 "%u %s\n" printf flush file-monitor-loop ;
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 ;
18 MAIN: file-monitor-main