Created
September 5, 2014 11:04
-
-
Save berdario/a3a6297395cfec8da4db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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