Skip to content

Instantly share code, notes, and snippets.

@bgamari
Created February 10, 2016 22:25
Show Gist options
  • Save bgamari/7fa84e939156e924abe6 to your computer and use it in GitHub Desktop.
Save bgamari/7fa84e939156e924abe6 to your computer and use it in GitHub Desktop.
import Options.Applicative
import Control.Monad
parser :: Parser (IO ())
parser = subparser $
command "add" (info (helper <*> addMode) mempty)
<> command "test" (info (pure $ putStrLn "testing") mempty)
where
addMode :: Parser (IO ())
addMode = subparser $
command "add" (info (pure $ putStrLn "adding message") mempty)
<> command "remove" (info (pure $ putStrLn "removing message") mempty)
main :: IO ()
main = join $ execParser $ info (helper <*> parser) mempty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment