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
11module Main (main) where
13import Control.Monad.IO.Class (MonadIO)
14import Data.Function ((&))
15import Data.List.NonEmpty (NonEmpty)
16import Data.Word (Word8)
17import System.Environment (getArgs)
18import Streamly.Prelude (SerialT)
19import Streamly.Internal.Data.Array.Storable.Foreign (Array)
21import qualified Streamly.Unicode.Stream as Unicode
22import qualified Streamly.Internal.Data.Array.Storable.Foreign as Array
23import qualified Data.List.NonEmpty as NonEmpty
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
29#elif defined(CABAL_OS_WINDOWS)
30import qualified Streamly.Internal.FileSystem.Event.Windows as Event
32#error "FS Events not supported on this platform
35-------------------------------------------------------------------------------
37-------------------------------------------------------------------------------
39toUtf8 :: MonadIO m => String -> m (Array Word8)
40toUtf8 = Array.fromStream . Unicode.encodeUtf8' . Stream.fromList
42-------------------------------------------------------------------------------
44-------------------------------------------------------------------------------
46watchPaths :: NonEmpty (Array Word8) -> SerialT IO Event.Event
47#if defined(CABAL_OS_LINUX)
48watchPaths = Event.watchPaths
50watchPaths = Event.watchTrees
56 paths <- mapM toUtf8 args
58 watchPaths (NonEmpty.fromList paths)
59 & 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