Skip to content

Instantly share code, notes, and snippets.

@berdario berdario/Main.hs
Created Sep 5, 2014

Embed
What would you like to do?
import Paths_hdoit (version)
import Data.Version (showVersion)
import Options.Applicative
data Arguments = Arguments
{ version :: Bool,
argCommand :: Command
} deriving Show
data Command = Add (Maybe String) | Base deriving Show
comparser = (Arguments <$> (switch $ long "version") <*>)
addOpt = comparser $ Add <$> (optional $ strOption $ long "foo")
argparser = (comparser $ pure Base) <|>
subparser
( command "add" (info addOpt fullDesc))
-- main = putStrLn $ showVersion version
main = execParser (info argparser fullDesc) >>= print
-- main = print $ Options {optCommand = Base}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.