2-- Module : Streamly.Test.FileSystem.Event
3-- Copyright : (c) 2020 Composewell Technologies
6-- Maintainer : streamly@composewell.com
7-- Stability : experimental
10-- Just report all events under the paths provided as arguments
12module Main (main) where
14import Control.Monad.IO.Class (MonadIO)
15import Data.Function ((&))
16import Data.List.NonEmpty (NonEmpty)
17import Data.Word (Word8)
18import Streamly.Internal.Data.Array.Storable.Foreign (Array)
19import System.Environment (getArgs)
20import Streamly.Prelude (SerialT)
22import qualified Data.List.NonEmpty as NonEmpty
23import qualified Streamly.Unicode.Stream as Unicode
24import qualified Streamly.Internal.Data.Stream.IsStream as Stream
25#if defined(CABAL_OS_DARWIN)
26import qualified Streamly.Internal.FileSystem.Event.Darwin as Event
27#elif defined(CABAL_OS_LINUX)
28import qualified Streamly.Internal.FileSystem.Event.Linux as Event
30#error "FS Events not supported on this platform
32import qualified Streamly.Internal.Data.Array.Storable.Foreign as Array
34-------------------------------------------------------------------------------
36-------------------------------------------------------------------------------
38toUtf8 :: MonadIO m => String -> m (Array Word8)
39toUtf8 = Array.fromStream . Unicode.encodeUtf8' . Stream.fromList
41-------------------------------------------------------------------------------
43-------------------------------------------------------------------------------
45watchPaths :: NonEmpty (Array Word8) -> SerialT IO Event.Event
47#if defined(CABAL_OS_DARWIN)
48watchPaths = Event.watchTrees
49#elif defined(CABAL_OS_LINUX)
50watchPaths = Event.watchPaths
52#error "Unsupported platform
58 paths <- mapM toUtf8 args
60 watchPaths (NonEmpty.fromList paths)
61 & Stream.mapM_ (putStrLn . Event.showEvent)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list