Skip to content

Commit e288132

Browse files
committed
Add a command in ghcide exe
1 parent d33c32b commit e288132

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ghcide/exe/Arguments.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Options.Applicative
88

99
type Arguments = Arguments' IdeCmd
1010

11-
data IdeCmd = Typecheck [FilePath] | DbCmd Options Command | LSP
11+
data IdeCmd = Typecheck [FilePath] | DbCmd Options Command | DbIndex [FilePath] | LSP
1212

1313
data Arguments' a = Arguments
1414
{argLSP :: Bool
@@ -47,10 +47,12 @@ arguments = Arguments
4747
<*> switch (long "verbose" <> help "Include internal events in logging output")
4848
<*> ( hsubparser (command "typecheck" (info (Typecheck <$> fileCmd) fileInfo)
4949
<> command "hiedb" (info (DbCmd <$> optParser "" True <*> cmdParser <**> helper) hieInfo)
50-
<> command "lsp" (info (pure LSP <**> helper) lspInfo) )
50+
<> command "index" (info (DbIndex <$> fileCmd) indexInfo)
51+
<> command "lsp" (info (pure LSP <**> helper) lspInfo))
5152
<|> Typecheck <$> fileCmd )
5253
where
5354
fileCmd = many (argument str (metavar "FILES/DIRS..."))
5455
lspInfo = fullDesc <> progDesc "Start talking to an LSP client"
5556
fileInfo = fullDesc <> progDesc "Used as a test bed to check your IDE will work"
5657
hieInfo = fullDesc <> progDesc "Query .hie files"
58+
indexInfo = fullDesc <> progDesc "Load the given files and index all the known targets"

ghcide/exe/Main.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ main = do
8686
{Main.argCommand = case argFilesOrCmd of
8787
Typecheck x | not argLSP -> Main.Check x
8888
DbCmd x y -> Main.Db "." x y
89+
DbIndex dir -> Main.Index dir
8990
_ -> Main.Lsp
9091

9192
,Main.argsLogger = pure logger

0 commit comments

Comments
 (0)