Fix #391, Error on command -g
when used before command despite --help output saying this is valid
This commit is contained in:
parent
466a64183b
commit
6e92f28f43
@ -3,7 +3,6 @@
|
|||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import Config (cProjectVersion)
|
import Config (cProjectVersion)
|
||||||
import Control.Arrow
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Exception (Exception, Handler(..), catches, throw)
|
import Control.Exception (Exception, Handler(..), catches, throw)
|
||||||
import Data.Typeable (Typeable)
|
import Data.Typeable (Typeable)
|
||||||
@ -295,13 +294,13 @@ main = handler $ do
|
|||||||
hSetEncoding stdout utf8
|
hSetEncoding stdout utf8
|
||||||
args <- getArgs
|
args <- getArgs
|
||||||
|
|
||||||
let (ghcArgs, modArgs) = second stripSeperator $ span (/="--") args
|
-- let (ghcArgs, modArgs) = second stripSeperator $ span (/="--") args
|
||||||
_realGhcArgs = filter (/="--ghc-mod") ghcArgs
|
-- _realGhcArgs = filter (/="--ghc-mod") ghcArgs
|
||||||
|
|
||||||
(globalOptions,_cmdArgs) = parseGlobalArgs modArgs
|
-- (globalOptions,_cmdArgs) = parseGlobalArgs modArgs
|
||||||
|
|
||||||
stripSeperator ("--":rest) = rest
|
-- stripSeperator ("--":rest) = rest
|
||||||
stripSeperator l = l
|
-- stripSeperator l = l
|
||||||
|
|
||||||
case args of
|
case args of
|
||||||
_
|
_
|
||||||
@ -323,7 +322,8 @@ main = handler $ do
|
|||||||
|
|
||||||
|
|
||||||
| otherwise -> do
|
| otherwise -> do
|
||||||
(res, _) <- runGhcModT globalOptions $ commands args
|
let (globalOptions,cmdArgs) = parseGlobalArgs args
|
||||||
|
(res, _) <- runGhcModT globalOptions $ commands cmdArgs
|
||||||
case res of
|
case res of
|
||||||
Right s -> putStr s
|
Right s -> putStr s
|
||||||
Left e -> exitError $ render (gmeDoc e)
|
Left e -> exitError $ render (gmeDoc e)
|
||||||
|
Loading…
Reference in New Issue
Block a user