Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
Better optparse error for unknown commands
Browse files Browse the repository at this point in the history
  • Loading branch information
HuwCampbell authored and DanielG committed Oct 26, 2018
1 parent 8e4cef7 commit 96c2207
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ghc-mod.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Library
, hlint < 2.1 && >= 2.0.8
, monad-control < 1.1 && >= 1
, monad-journal < 0.8 && >= 0.4
, optparse-applicative < 0.14 && >= 0.13.0.0
, optparse-applicative < 0.15 && >= 0.14
, pipes < 4.4 && >= 4.1
, safe < 0.4 && >= 0.3.9
, semigroups < 0.19 && >= 0.10.0
Expand Down Expand Up @@ -184,7 +184,7 @@ Executable ghc-mod
, base < 4.11 && >= 4.6.0.1
, fclabels < 2.1 && >= 2.0
, monad-control < 1.1 && >= 1
, optparse-applicative < 0.14 && >= 0.13.0.0
, optparse-applicative < 0.15 && >= 0.14
, semigroups < 0.19 && >= 0.10.0
, split < 0.3 && >= 0.2.2

Expand Down
8 changes: 4 additions & 4 deletions src/GhcMod/Exe/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ helpVersion =
r :: ReadM (a -> a)
r = do
v <- readerAsk
case v of
"help" -> readerAbort ShowHelpText
"version" -> readerAbort $ InfoMsg ghcModVersion
_ -> return id
readerAbort $ case v of
"help" -> ShowHelpText
"version" -> InfoMsg ghcModVersion
_ -> UnexpectedError v (SomeParser argAndCmdSpec)

argAndCmdSpec :: Parser (Options, GhcModCommands)
argAndCmdSpec = (,) <$> globalArgSpec <*> commandsSpec

0 comments on commit 96c2207

Please sign in to comment.