fswatcher 0.3.0 → 0.4.0
raw patch · 2 files changed
+38/−35 lines, 2 filesdep +filepathdep −system-filepathdep ~basedep ~directorydep ~fsnotify
Dependencies added: filepath
Dependencies removed: system-filepath
Dependency ranges changed: base, directory, fsnotify, optparse-applicative, regex-pcre-builtin
Files
- fswatcher.cabal +36/−32
- src/fswatcher.hs +2/−3
fswatcher.cabal view
@@ -1,36 +1,40 @@-name: fswatcher-category: Tools-build-type: Simple-version: 0.3.0-synopsis: Watch a file/directory and run a command when it's modified-description: A simple program that watches a file or a directory and- runs a given command whenever the file or a file within the- directory is changed.-license: BSD3-License-file: LICENSE-author: Erlend Hamberg-maintainer: erlend@hamberg.no-stability: experimental-tested-with: GHC==8.10.3-homepage: http://www.github.com/ehamberg/fswatcher/-cabal-version: >= 1.10+cabal-version: 3.0+name: fswatcher+version: 0.4.0+license: BSD-3-Clause+license-file: LICENSE+maintainer: erlend@hamberg.no+author: Erlend Hamberg+tested-with: ghc ==9.4.7+homepage: https://git.sr.ht/~ehamberg/fswatcher+synopsis: Watch a file/directory and run a command when it's modified+description:+ A simple program that watches a file or a directory and+ runs a given command whenever the file or a file within the+ directory is changed. +category: Tools+build-type: Simple++source-repository head+ type: git+ location: https://git.sr.ht/~ehamberg/fswatcher+ executable fswatcher- build-depends: base >= 4 && < 5- , unix >= 2.5- , process >= 1.1- , fsnotify >= 0.3 && < 0.4- , system-filepath >= 0.4- , directory >= 1.2- , optparse-applicative >= 0.11- , regex-pcre-builtin >= 0.94- ghc-options: -Wall- hs-source-dirs: src main-is: fswatcher.hs- default-language: Haskell2010- other-modules: Opts- , Pipeline+ hs-source-dirs: src+ other-modules:+ Opts+ Pipeline -source-repository head- type: git- location: git://github.com/ehamberg/fswatcher.git+ default-language: Haskell2010+ ghc-options: -Wall+ build-depends:+ base >=4.11 && <5,+ unix >=2.5,+ process >=1.1,+ fsnotify >=0.4 && <0.5,+ filepath >=1.4 && <1.5,+ directory >=1.3 && <1.4,+ optparse-applicative >=0.17,+ regex-pcre-builtin >=0.95
src/fswatcher.hs view
@@ -5,8 +5,7 @@ import System.IO (hPutStrLn, stderr) import System.Posix.Files (getFileStatus, isDirectory) import System.Directory (canonicalizePath, getCurrentDirectory)-import Filesystem.Path ((</>), directory)-import Filesystem.Path.CurrentOS (decodeString, encodeString)+import System.FilePath (takeDirectory, (</>)) import Data.Foldable (for_) import Data.String (fromString) import Data.Traversable (for)@@ -41,7 +40,7 @@ let path = expandedPath fileDetails let watchFun = case filetype fileDetails of Directory -> watchTree m path (matchFiles opt)- File -> watchDir m (encodeString $ directory $ decodeString path) isThisFile+ File -> watchDir m (takeDirectory path) isThisFile in watchFun (\_ -> void $ tryPutMVar trigger ()) where isThisFile :: Event -> Bool