@@ -272,13 +272,24 @@ exitWithError err =
272 BadArgs argErrors ->
272 BadArgs argErrors ->
273 case argErrors of
273 case argErrors of
275− error "TODO no possible args"
275+ return
276+ [ reflow $ "I was not expecting any arguments for this command."
277+ , reflow $ "Try removing them?"
277 [(_args, argError)] ->
280 [(_args, argError)] ->
278 argErrorToDocs argError
281 argErrorToDocs argError
281− error "TODO show possible arg configurations"
284+ argErrorToDocs $ head $ List.sortOn toArgErrorRank (map snd argErrors)
287+toArgErrorRank :: ArgError -> Int -- lower is better
284toGreen :: String -> P.Doc
295toGreen :: String -> P.Doc
@@ -318,10 +329,10 @@ argErrorToDocs argError =
319 [ "I am having trouble with this argument:"
330 [ "I am having trouble with this argument:"
320 , P.indent 4 $ toRed string
331 , P.indent 4 $ toRed string
321− , P.fillSep
332+ , P.fillSep $
322 ["It","is","supposed","to","be","a"
333 ["It","is","supposed","to","be","a"
323− ,toYellow (toToken tipe),"value,","like","this:"
334+ ,toYellow (toToken tipe),"value,","like"
324− ]
335+ ] ++ if length examples == 1 then ["this:"] else ["one","of","these:"]
325 , P.indent 4 $ P.green $ P.vcat $ map P.text examples
336 , P.indent 4 $ P.green $ P.vcat $ map P.text examples