aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jeffries <ianspiral@gmail.com>2019-03-22 19:04:01 -0400
committerAlexey Kiryushin <alexey.a.kiryushin@gmail.com>2019-03-23 02:04:01 +0300
commitb24d1456d03e86407c66ca623f79072ff54de362 (patch)
tree189fd587993391a3d3c563706ee420386a7f1191
parentdb54d0594b84966ec3568c90c4219abb60c2e41f (diff)
Default --package to '.' (#27)
-rw-r--r--app/Indexer.hs4
-rw-r--r--app/Server.hs3
2 files changed, 5 insertions, 2 deletions
diff --git a/app/Indexer.hs b/app/Indexer.hs
index 9560fad..7fc560e 100644
--- a/app/Indexer.hs
+++ b/app/Indexer.hs
@@ -39,7 +39,9 @@ import Options.Applicative
, optional
, progDesc
, short
+ , showDefault
, strOption
+ , value
)
import Paths_haskell_code_explorer as HSE (version)
import System.Directory (createDirectoryIfMissing)
@@ -160,7 +162,7 @@ configParser :: Parser IndexerConfig
configParser =
IndexerConfig <$>
strOption
- (long "package" <> short 'p' <> metavar "PATH" <>
+ (long "package" <> short 'p' <> metavar "PATH" <> value "." <> showDefault <>
help "Path to a Cabal package") <*>
optional
(strOption
diff --git a/app/Server.hs b/app/Server.hs
index 353f808..2304f27 100644
--- a/app/Server.hs
+++ b/app/Server.hs
@@ -206,7 +206,8 @@ configParser =
some
(strOption
(long "package" <> short 'p' <> metavar "PATH" <>
- help "Path to a Cabal package"))) <*>
+ help "Path to a Cabal package (Default: '.')"))
+ <|> pure (Directories ["."])) <*>
(pure 8080 <|>
option
auto