summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2012-08-09 16:10:56 +0200
committerPaolo Capriotti <p.capriotti@gmail.com>2012-08-13 16:59:30 +0100
commit82373c76fb895d6f713b19f0c58b17f2d6ef35c4 (patch)
tree6d88da28ca736a2f21df712cd161b49bc8794f51 /ghc
parent8240843d211ce8f4747a31943eb2e6463ba0b63a (diff)
downloadhaskell-82373c76fb895d6f713b19f0c58b17f2d6ef35c4.tar.gz
Give suggestions for unrecognised command line arguments
Diffstat (limited to 'ghc')
-rw-r--r--ghc/Main.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 1e9d0a2a96..5eda655333 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -791,5 +791,10 @@ abiHash strs = do
-- Util
unknownFlagsErr :: [String] -> a
-unknownFlagsErr fs = ghcError (UsageError ("unrecognised flags: " ++ unwords fs))
-
+unknownFlagsErr fs = ghcError $ UsageError $ concatMap oneError fs
+ where
+ oneError f =
+ "unrecognised flag: " ++ f ++ "\n" ++
+ (case fuzzyMatch f (nub allFlags) of
+ [] -> ""
+ suggs -> "did you mean one of:\n" ++ unlines (map (" " ++) suggs))