git-annex/Command/Watch.hs

36 lines
766 B
Haskell
Raw Permalink 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 AGPL version 3 or higher.
-}
module Command.Watch where
import Command
import Assistant
import Utility.HumanTime
cmd :: Command
cmd = notBareRepo $
command "watch" SectionCommon
"daemon to watch for changes and autocommit"
paramNothing (seek <$$> const (parseDaemonOptions True))
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
Nothing
-- does not return
2012-06-10 21:40:35 +00:00
stop