tweak
This commit is contained in:
parent
f4aacd5c86
commit
cda6c4dff5
1 changed files with 8 additions and 4 deletions
|
@ -39,12 +39,17 @@ seek :: [CommandSeek]
|
||||||
seek = [withNothing start]
|
seek = [withNothing start]
|
||||||
|
|
||||||
start :: CommandStart
|
start :: CommandStart
|
||||||
#if defined linux_HOST_OS
|
|
||||||
start = notBareRepo $ do
|
start = notBareRepo $ do
|
||||||
showStart "watch" "."
|
showStart "watch" "."
|
||||||
|
watch
|
||||||
|
stop
|
||||||
|
|
||||||
|
watch :: Annex ()
|
||||||
|
#if defined linux_HOST_OS
|
||||||
|
watch = do
|
||||||
showAction "scanning"
|
showAction "scanning"
|
||||||
inRepo $ Git.Command.run "add" [Param "--update"]
|
inRepo $ Git.Command.run "add" [Param "--update"]
|
||||||
next $ next $ withStateMVar $ \st -> liftIO $ withINotify $ \i -> do
|
withStateMVar $ \st -> liftIO $ withINotify $ \i -> do
|
||||||
changechan <- atomically newTChan
|
changechan <- atomically newTChan
|
||||||
_ <- forkIO $ commitThread st changechan
|
_ <- forkIO $ commitThread st changechan
|
||||||
let hook a = Just $ runHook st changechan a
|
let hook a = Just $ runHook st changechan a
|
||||||
|
@ -58,9 +63,8 @@ start = notBareRepo $ do
|
||||||
watchDir i "." (ignored . takeFileName) hooks
|
watchDir i "." (ignored . takeFileName) hooks
|
||||||
putStrLn "(started)"
|
putStrLn "(started)"
|
||||||
waitForTermination
|
waitForTermination
|
||||||
return True
|
|
||||||
#else
|
#else
|
||||||
start = error "watch mode is so far only available on Linux"
|
watch = error "watch mode is so far only available on Linux"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ignored :: FilePath -> Bool
|
ignored :: FilePath -> Bool
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue