An option is a data type that inhabits the IsOption type class.
Methods
defaultValue :: vThe value to use if the option was not supplied explicitly
parseValue :: String -> Maybe vTry to parse an option value from a string. Consider using safeReadBool for boolean options and safeRead for numeric options.
optionName :: Tagged v StringThe option name. It is used to form the command line option name, for instance. Therefore, it had better not contain spaces or other fancy characters. It is recommended to use dashes instead of spaces.
optionHelp :: Tagged v StringThe option description or help string. This can be an arbitrary string.
showDefaultValue :: v -> Maybe StringHow a defaultValue should be displayed in the help string. Nothing (the default implementation) will result in nothing being displayed, while
Just defwill result indefbeing advertised as the default in the help string.optionCLParser :: Parser vA command-line option parser.
It has a default implementation in terms of the other methods. You may want to override it in some cases (e.g. add a short flag) and flagCLParser, mkFlagCLParser and mkOptionCLParser might come in handy.
Even if you override this, you still should implement all the methods above, to allow alternative interfaces.
Do not supply a default value (e.g., with the value function) here for this parser! This is because if no value was provided on the command line we may lookup the option e.g. in the environment. But if the parser always succeeds, we have no way to tell whether the user really provided the option on the command line.
Similarly, do not use showDefaultWith here, as it will be ignored. Use the showDefaultValue method of IsOption instead.
Instances11IsOption, …
IsOption ExecutionModeDefined in tasty-1.5.3 · Test.Tasty.CoreDetermines mode of execution of a TestGroup. Note that this option is not exposed as a command line argument.
IsOption AnsiTricksDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterIsOption HideSuccessesDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterIsOption MinDurationToReportDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterIsOption QuietDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterIsOption UseColorDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterControl color output
IsOption ListTestsDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ListTestsIsOption HideProgressDefined in tasty-1.5.3 · Test.Tasty.Options.CoreIsOption NumThreadsDefined in tasty-1.5.3 · Test.Tasty.Options.CoreIsOption TimeoutDefined in tasty-1.5.3 · Test.Tasty.Options.CoreIsOption TestPatternDefined in tasty-1.5.3 · Test.Tasty.PatternsSince tasty-1.5, this option can be specified multiple times on the command line. Only the tests matching all given patterns will be selected.