@@ -259,8 +259,8 @@ exitWithUnknown unknown knowns =
259-- ERROR TO DOC
259-- ERROR TO DOC
262−exitWithError :: Maybe String -> Error -> IO a
262+exitWithError :: Error -> IO a
263−exitWithError maybeCommand err =
263+exitWithError err =
264 exitFailure =<<
264 exitFailure =<<
265 case err of
265 case err of
266 BadFlag flagError ->
266 BadFlag flagError ->
@@ -271,8 +271,8 @@ exitWithError maybeCommand err =
272 error "TODO no possible args"
272 error "TODO no possible args"
274− [(args, argError)] ->
274+ [(_args, argError)] ->
275− argErrorToDocs maybeCommand args argError
275+ argErrorToDocs argError
278 error "TODO show possible arg configurations"
278 error "TODO show possible arg configurations"
@@ -297,54 +297,43 @@ toRed str =
297-- ARG ERROR TO DOC
297-- ARG ERROR TO DOC
300−argErrorHelp :: Maybe String -> CompleteArgs a -> [P.Doc] -> IO [P.Doc]
301−argErrorHelp maybeCommand args details =
302− do command <- toCommand maybeCommand
304− [ "I was expecting arguments like this:"
305− , P.indent 4 $ P.dullcyan $ argsToDoc command args
310−argErrorToDocs :: Maybe String -> CompleteArgs a -> ArgError -> IO [P.Doc]
300+argErrorToDocs :: ArgError -> IO [P.Doc]
311−argErrorToDocs maybeCommand args argError =
301+argErrorToDocs argError =
312− argErrorHelp maybeCommand args =<<
313− case argError of
302+ case argError of
314− ArgMissing (Expectation tipe makeExamples) ->
303+ ArgMissing (Expectation tipe makeExamples) ->
315− do examples <- makeExamples
304+ do examples <- makeExamples
317− [ P.fillSep
306+ [ P.fillSep
318− ["Everything","you","have","is","fine,","but","in","addition,","I","was"
307+ ["The","arguments","you","have","are","fine,","but","in","addition,","I","was"
319− ,"expecting","a",toYellow (toToken tipe),"value.","For","example:"
308+ ,"expecting","a",toYellow (toToken tipe),"value.","For","example:"
321− , P.indent 4 $ P.green $ P.vcat $ map P.text examples
310+ , P.indent 4 $ P.green $ P.vcat $ map P.text examples
324− ArgBad string (Expectation tipe makeExamples) ->
313+ ArgBad string (Expectation tipe makeExamples) ->
325− do examples <- makeExamples
314+ do examples <- makeExamples
327− [ "I am having trouble with this argument though:"
316+ [ "I am having trouble with this argument:"
328− , P.indent 4 $ toRed string
317+ , P.indent 4 $ toRed string
329− , P.fillSep
318+ , P.fillSep
330− ["It","is","supposed","to","be","a"
319+ ["It","is","supposed","to","be","a"
331− ,toYellow (toToken tipe),"value,","like","this:"
320+ ,toYellow (toToken tipe),"value,","like","this:"
333− , P.indent 4 $ P.green $ P.vcat $ map P.text examples
322+ , P.indent 4 $ P.green $ P.vcat $ map P.text examples
336− ArgExtras extras ->
325+ ArgExtras extras ->
338− (these, them) =
327+ (these, them) =
339− case extras of
328+ case extras of
340− [_] -> ("this extra argument", "it")
329+ [_] -> ("this argument", "it")
341− _ -> ("these extra arguments", "them")
330+ _ -> ("these arguments", "them")
344− [ reflow $ "That worked, but I did not know what to do with " ++ these ++ ":"
333+ [ reflow $ "I was not expecting " ++ these ++ ":"
345− , P.indent 4 $ P.red $ P.vcat $ map P.text extras
334+ , P.indent 4 $ P.red $ P.vcat $ map P.text extras
346− , reflow $ "Try removing " ++ them ++ "?"
335+ , reflow $ "Try removing " ++ them ++ "?"