diff --git a/src/GHCMod.hs b/src/GHCMod.hs index 18eb4ac..e5855a4 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -110,7 +110,7 @@ legacyInteractiveLoop symdbreq world = do res <- flip gcatches interactiveHandlers $ do pargs <- maybe (throw $ InvalidCommandLine $ Left cmdArg) return $ parseArgsInteractive cmdArg - case fst pargs of + case pargs of CmdFind symbol -> lookupSymbol symbol =<< checkDb symdbreq =<< getDb symdbreq diff --git a/src/GHCMod/Options.hs b/src/GHCMod/Options.hs index 4a1d355..63bc933 100644 --- a/src/GHCMod/Options.hs +++ b/src/GHCMod/Options.hs @@ -37,7 +37,7 @@ parseArgs = $$ fullDesc <=> header "ghc-mod: Happy Haskell Programming" -parseArgsInteractive :: String -> Maybe (GhcModCommands, [String]) +parseArgsInteractive :: String -> Maybe GhcModCommands parseArgsInteractive args = getParseResult $ execParserPure (prefs idm) opts $ parseCmdLine args where diff --git a/src/GHCMod/Options/Commands.hs b/src/GHCMod/Options/Commands.hs index 8ef7784..1a774a6 100644 --- a/src/GHCMod/Options/Commands.hs +++ b/src/GHCMod/Options/Commands.hs @@ -179,12 +179,10 @@ commands = , text "(See also: https://github.com/kazu-yamamoto/ghc-mod/issues/311)" ] -interactiveCommandsSpec :: Parser (GhcModCommands, [String]) +interactiveCommandsSpec :: Parser GhcModCommands interactiveCommandsSpec = - (,) <$> subparser' icmds <*> leftover - where - icmds = - commands + subparser' + $ commands <> command "map-file" $$ info (helper <*> mapArgSpec) $$ progDesc "tells ghc-modi to read `file.hs` source from stdin" @@ -201,7 +199,6 @@ interactiveCommandsSpec = $$ progDesc "Exit interactive mode" <> command "" $$ info (pure CmdQuit) idm - leftover = many (strArg "") strArg :: String -> Parser String strArg = argument str . metavar