buuka/app/Main.hs

27 lines
675 B
Haskell

module Main where
import Options.Applicative
import Control.Monad.Buuka
(BuukaM, runBuukaM)
import Data.Environment
import UnliftIO.Directory
(XdgDirectory(XdgData), getXdgDirectory)
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"))
main :: IO ()
main = do
env <- Environment <$> getXdgDirectory XdgData "buuka"
execParser (info (commands <**> helper) fullDesc) >>= runBuukaM env