{-# LANGUAGE OverloadedStrings #-} -- | Docster CLI - Convert Markdown with Mermaid diagrams to PDF/HTML module Main (main) where import Docster.Types (DocsterError(..)) import Docster.Compiler (compileToPDF, compileToHTML) import System.Environment (getArgs) import Control.Exception (throwIO) -- | Parse command line arguments and return appropriate action parseArgs :: [String] -> Either DocsterError (IO ()) parseArgs ["-pdf", path] = Right (compileToPDF path) parseArgs ["-html", path] = Right (compileToHTML path) parseArgs _ = Left $ InvalidUsage "Usage: docster -pdf|-html " -- | Main entry point - parse arguments and execute appropriate action main :: IO () main = do args <- getArgs case parseArgs args of Left err -> throwIO err Right action -> action