on wip/get-located-imports help sign in
ghcide/exe/Arguments.hs
35 lines 1.3 kB history raw
1-- Copyright (c) 2019 The DAML Authors. All rights reserved.
2-- SPDX-License-Identifier: Apache-2.0
4module Arguments(Arguments(..), getArguments) where
6import Options.Applicative
9data Arguments = Arguments
10 {argLSP :: Bool
11 ,argsCwd :: Maybe FilePath
12 ,argFiles :: [FilePath]
13 ,argsVersion :: Bool
14 ,argsShakeProfiling :: Maybe FilePath
15 ,argsTesting :: Bool
16 ,argsThreads :: Int
17 }
19getArguments :: IO Arguments
20getArguments = execParser opts
21 where
22 opts = info (arguments <**> helper)
23 ( fullDesc
24 <> progDesc "Used as a test bed to check your IDE will work"
25 <> header "ghcide - the core of a Haskell IDE")
27arguments :: Parser Arguments
28arguments = Arguments
29 <$> switch (long "lsp" <> help "Start talking to an LSP server")
30 <*> optional (strOption $ long "cwd" <> metavar "DIR" <> help "Change to this directory")
31 <*> many (argument str (metavar "FILES/DIRS..."))
32 <*> switch (long "version" <> help "Show ghcide and GHC versions")
33 <*> optional (strOption $ long "shake-profiling" <> metavar "DIR" <> help "Dump profiling reports to this directory")
34 <*> switch (long "test" <> help "Enable additional lsp messages used by the testsuite")
35 <*> option auto (short 'j' <> help "Number of threads (0: automatic)" <> metavar "NUM" <> value 0 <> showDefault)