docster/app/Main.hs
Willem van den Ende 1c8cfdb075 Split Main.hs into logical modules for better maintainability
- Extract types into Docster.Types module (50 lines)
- Move Mermaid processing to Docster.Mermaid module (93 lines)
- Create Docster.Transform for document walking (21 lines)
- Isolate LaTeX templates in Docster.LaTeX module (65 lines)
- Extract compilation logic to Docster.Compiler module (90 lines)
- Reduce Main.hs to minimal CLI entry point (23 lines from 233)
- Add library stanza to cabal file with proper module organization
- Follow Haskell conventions with Docster.ModuleName hierarchy

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 22:31:55 +02:00

23 lines
788 B
Haskell

{-# 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 <file.md>"
-- | 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