buuka/app/Main.hs

24 lines
571 B
Haskell
Raw Normal View History

2020-12-30 18:35:47 +02:00
module Main where
2020-12-30 23:29:56 +02:00
import Options.Applicative
import Control.Monad.Buuka
(BuukaM, runBuukaM)
import Data.Environment
import qualified Operations
commands :: Parser (BuukaM ())
commands = subparser
( command "insert" (info (insertOpts Operations.insert) (progDesc "Insert a new bookmark")))
where
insertOpts f =
f <$> strOption (long "url" <> short 'u' <> metavar "URL")
<*> optional (strOption (long "title"))
2020-12-30 18:35:47 +02:00
main :: IO ()
main = do
2020-12-30 23:29:56 +02:00
let env = Environment "."
execParser (info (commands <**> helper) fullDesc) >>= runBuukaM env