module System.Console.MultiArg.SampleParser where
import qualified System.Console.MultiArg.Combinator as C
import System.Console.MultiArg.GetArgs (getArgs)
import qualified System.Console.MultiArg.SimpleParser as P
data Flag =
Bytes String
| Follow (Maybe String)
| Retry
| Lines String
| Stats String
| Pid String
| Quiet
| Sleep String
| Verbose
| Help
| Version
| Filename String
deriving Show
specs :: [C.OptSpec Flag]
specs =
[ C.OptSpec ["bytes"] ['c'] (C.OneArg Bytes)
, C.OptSpec ["follow"] ['f'] (C.OptionalArg Follow)
, C.OptSpec ["follow-retry"] ['F'] (C.NoArg Retry)
, C.OptSpec ["lines"] ['n'] (C.OneArg Lines)
, C.OptSpec ["max-unchanged-stats"] [] (C.OneArg Stats)
, C.OptSpec ["pid"] [] (C.OneArg Pid)
, C.OptSpec ["quiet"] ['q'] (C.NoArg Quiet)
, C.OptSpec ["sleep-interval"] ['s'] (C.OneArg Sleep)
, C.OptSpec ["verbose"] ['v'] (C.NoArg Verbose)
, C.OptSpec ["help"] [] (C.NoArg Help)
, C.OptSpec ["version"] [] (C.NoArg Version)
]
sampleMain :: P.Intersperse -> IO ()
sampleMain i = do
as <- getArgs
let r = P.simple i specs Filename as
print r