aboutsummaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs63
1 files changed, 50 insertions, 13 deletions
diff --git a/Main.hs b/Main.hs
index 4f0d399..b9afcc4 100644
--- a/Main.hs
+++ b/Main.hs
@@ -6,21 +6,58 @@ module Main where
import Data.Version (showVersion)
import Paths_git_auto_acp (version)
+import Control.Applicative ((<|>), some)
import Control.Concurrent
-import Control.Monad
-import Data.Foldable
-import Data.Maybe
-import qualified Data.Set as S
+ ( forkIO
+ , newChan
+ , newEmptyMVar
+ , putMVar
+ , readChan
+ , takeMVar
+ , threadDelay
+ , writeChan
+ )
+import Control.Monad (unless, void)
+import Data.Foldable (asum, for_)
+import Data.Maybe (fromMaybe)
+import qualified Data.Set as S (Set, empty, insert, null)
import Options.Applicative
+ ( Parser
+ , auto
+ , customExecParser
+ , flag'
+ , footer
+ , fullDesc
+ , header
+ , help
+ , helper
+ , info
+ , long
+ , metavar
+ , option
+ , prefs
+ , short
+ , showDefault
+ , showHelpOnEmpty
+ , simpleVersioner
+ , strOption
+ , value
+ )
import System.Clock
-import System.Environment
-import System.Exit
-import System.FSNotify
-import System.FSNotify.Devel
-import System.FilePath
-import System.IO
-import System.Posix.Signals
-import System.Process
+ ( Clock(Monotonic)
+ , TimeSpec
+ , diffTimeSpec
+ , getTime
+ , toNanoSecs
+ )
+import System.Environment (lookupEnv)
+import System.Exit (ExitCode(ExitSuccess))
+import System.FSNotify (watchTree, withManager)
+import System.FSNotify.Devel (allEvents)
+import System.FilePath (splitDirectories)
+import System.IO (hPutStrLn, stderr)
+import System.Posix.Signals (Handler(Catch), installHandler, sigINT)
+import System.Process (rawSystem)
data Watch = Watch
{ watchPath :: FilePath
@@ -125,7 +162,7 @@ main = do
o <-
customExecParser (prefs $ showHelpOnEmpty)
$ info
- (opts <**> helper <**> simpleVersioner (showVersion version))
+ (simpleVersioner (showVersion version) <*> helper <*> opts)
(fullDesc
<> header "git-auto-acp -- automatically add-commit-push files"
<> (footer