Commit 2c6939a5 authored by Ben Millwood's avatar Ben Millwood Committed by ian@well-typed.com
Browse files

Make ghc-pkg print less on error.

parent 779f10fd
...@@ -98,7 +98,7 @@ main = do ...@@ -98,7 +98,7 @@ main = do
Left err -> die err Left err -> die err
(_,_,errors) -> do (_,_,errors) -> do
prog <- getProgramName prog <- getProgramName
die (concat errors ++ usageInfo (usageHeader prog) flags) die (concat errors ++ shortUsage prog)
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Command-line syntax -- Command-line syntax
...@@ -185,6 +185,9 @@ deprecFlags = [ ...@@ -185,6 +185,9 @@ deprecFlags = [
ourCopyright :: String ourCopyright :: String
ourCopyright = "GHC package manager version " ++ Version.version ++ "\n" ourCopyright = "GHC package manager version " ++ Version.version ++ "\n"
shortUsage :: String -> String
shortUsage prog = "For usage information see '" ++ prog ++ " --help'."
usageHeader :: String -> String usageHeader :: String -> String
usageHeader prog = substProg prog $ usageHeader prog = substProg prog $
"Usage:\n" ++ "Usage:\n" ++
...@@ -408,11 +411,9 @@ runit verbosity cli nonopts = do ...@@ -408,11 +411,9 @@ runit verbosity cli nonopts = do
recache verbosity cli recache verbosity cli
[] -> do [] -> do
die ("missing command\n" ++ die ("missing command\n" ++ shortUsage prog)
usageInfo (usageHeader prog) flags)
(_cmd:_) -> do (_cmd:_) -> do
die ("command-line syntax error\n" ++ die ("command-line syntax error\n" ++ shortUsage prog)
usageInfo (usageHeader prog) flags)
parseCheck :: ReadP a a -> String -> String -> IO a parseCheck :: ReadP a a -> String -> String -> IO a
parseCheck parser str what = parseCheck parser str what =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment