@@ -72,12 +72,13 @@ data Options = Options
7272 { optionsDirectory :: Maybe FilePath
7373 , optionsOutputPath :: FilePath
7474 , optionsPort :: PortID
75+ , optionsNoWatch :: Bool
7576 , optionsDebug :: Bool
7677 }
7778
7879main :: IO ()
7980main = do
80− Options dir outputPath port debug <- execParser opts
81+ Options dir outputPath port noWatch debug <- execParser opts
8182 maybe (pure ()) setCurrentDirectory dir
8283 serverState <- newTVarIO emptyPscIdeState
8384 cwd <- getCurrentDirectory
@@ -88,31 +89,23 @@ main = do
8889 (do putStrLn ("Your output directory didn't exist. I'll create it at: " <> fullOutputPath)
8990 createDirectory fullOutputPath
9091 putStrLn "This usually means you didn't compile your project yet."
91− putStrLn "psc-ide needs you to compile your project (for example by running pulp build)"
92− )
92+ putStrLn "psc-ide needs you to compile your project (for example by running pulp build)")
9393
94− _ <- forkFinally (watcher serverState fullOutputPath) print
95− let conf =
96− Configuration
97− {
98− confDebug = debug
99− , confOutputPath = outputPath
100− }
101− let env =
102− PscIdeEnvironment
103− {
104− envStateVar = serverState
105− , envConfiguration = conf
106− }
94+ unless noWatch $
95+ void (forkFinally (watcher serverState fullOutputPath) print)
96+
97+ let conf = Configuration {confDebug = debug, confOutputPath = outputPath}
98+ env = PscIdeEnvironment {envStateVar = serverState, envConfiguration = conf}
10799 startServer port env
108100 where
109101 parser =
110− Options <$>
111− optional (strOption (long "directory" <> short 'd')) <*>
112− strOption (long "output-directory" <> value "output/") <*>
113− (PortNumber . fromIntegral <$>
114− option auto (long "port" <> short 'p' <> value (4242 :: Integer))) <*>
115− switch (long "debug")
102+ Options
103+ <$> optional (strOption (long "directory" <> short 'd'))
104+ <*> strOption (long "output-directory" <> value "output/")
105+ <*> (PortNumber . fromIntegral <$>
106+ option auto (long "port" <> short 'p' <> value (4242 :: Integer)))
107+ <*> switch (long "no-watch")
108+ <*> switch (long "debug")
116109 opts = info (version <*> helper <*> parser) mempty
117110 version = abortOption
118111 (InfoMsg (showVersion Paths.version))