Copyright | (c) Eric Mertens, 2016 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | Safe |
Language | Haskell2010 |
This module provides a description for the arguments expected by command commands as well as a way to parse those arguments.
- data ArgumentSpec :: * -> * where
- ReqTokenArg :: String -> ArgumentSpec rest -> ArgumentSpec (String, rest)
- OptTokenArg :: String -> ArgumentSpec rest -> ArgumentSpec (Maybe (String, rest))
- RemainingArg :: String -> ArgumentSpec String
- NoArg :: ArgumentSpec ()
- parseArguments :: ArgumentSpec a -> String -> Maybe a
Documentation
data ArgumentSpec :: * -> * where Source #
Description of a command's arguments indexed by the result of parsing
those arguments. Arguments are annotated with a String
describing the
argument.
ReqTokenArg :: String -> ArgumentSpec rest -> ArgumentSpec (String, rest) | A required space-delimited token |
OptTokenArg :: String -> ArgumentSpec rest -> ArgumentSpec (Maybe (String, rest)) | An optional space-delimited token |
RemainingArg :: String -> ArgumentSpec String | Take all the remaining text in free-form |
NoArg :: ArgumentSpec () | No arguments |
Show (ArgumentSpec s) Source # | |
:: ArgumentSpec a | specification |
-> String | input string |
-> Maybe a | parse results |
Parse the given input string using an argument specification. The arguments should start with a space but might have more.