diff --git a/TAP/Options.idr b/TAP/Options.idr index fd9b5bd..7eac5aa 100644 --- a/TAP/Options.idr +++ b/TAP/Options.idr @@ -84,7 +84,8 @@ private setFilter : String -> Mod setFilter str opts = pure $ {pattern := Just str} opts -mutual +parameters (header : String) + mutual ||| option descriptions export opts : List (OptDescr Mod) @@ -119,7 +120,7 @@ mutual ||| usage message export usage : List String - usage = assert_total $ "quox test suite" :: lines (usageInfo "" opts) + usage = assert_total $ header :: lines (usageInfo "" opts) ||| interpret the result of `getOpt` @@ -137,19 +138,20 @@ getArgs1 = [] => failureWith ["expected getArgs to start with exe name"] -||| read & interpret the command line arguments +||| read & interpret the command line arguments. +||| the first argument is the header to print on the usage message. ||| ||| [todo] allow unrecognised things and pass them back out export -getTestOpts' : List String -> IO Options -getTestOpts' args = - case getOpt Permute opts args of +getTestOpts' : String -> List String -> IO Options +getTestOpts' header args = + case getOpt Permute (opts header) args of MkResult opts [] [] [] => makeOpts opts - res => failureWith $ res.errors ++ usage + res => failureWith $ res.errors ++ usage header ||| interpret some command line arguments passed in ||| ||| [todo] allow unrecognised things and pass them back out export -getTestOpts : IO Options -getTestOpts = getTestOpts' !getArgs1 +getTestOpts : String -> IO Options +getTestOpts header = getTestOpts' header !getArgs1