git-annex/Command/Watch.hs

29 lines
717 B
Haskell
Raw Normal View History

2012-06-13 16:36:33 +00:00
{- git-annex watch command
2012-06-11 19:41:26 +00:00
-
- Copyright 2012 Joey Hess <id@joeyh.name>
2012-06-11 19:41:26 +00:00
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.Watch where
import Command
import Assistant
import Utility.HumanTime
cmd :: Command
cmd = notBareRepo $
command "watch" SectionCommon
"watch for changes and autocommit"
paramNothing (seek <$$> const parseDaemonOptions)
seek :: DaemonOptions -> CommandSeek
seek o = commandAction $ start False o Nothing
start :: Bool -> DaemonOptions -> Maybe Duration -> CommandStart
start assistant o startdelay = do
if stopDaemonOption o
2012-06-13 16:36:33 +00:00
then stopDaemon
else startDaemon assistant (foregroundDaemonOption o) startdelay Nothing Nothing Nothing -- does not return
2012-06-10 21:40:35 +00:00
stop