{-# OPTIONS_GHC -Wno-missing-signatures #-} module Main where import CommonOptions import DecomposeInput import DecomposeOutput import Options.Applicative import System.Directory main = do -- parse command and options let opts = info optionsParser (fullDesc <> header "Tool(s) to decompose a finite state machine into separate components.") Options{..} <- execParser opts -- setup some logging facilities createDirectoryIfMissing True "log" createDirectoryIfMissing True "results" -- dispatch to actual functionality, based on the command provided case optCommand of DecomposeOutput options -> mainDecomposeOutput options commonOptions DecomposeInput options -> mainDecomposeInput options data Options = Options { optCommand :: Command , commonOptions :: CommonOptions } deriving Show optionsParser = Options <$> commandParser <*> commonOptionsParser <**> helper data Command = DecomposeOutput DecomposeOutputOptions | DecomposeInput DecomposeInputOptions deriving Show commandParser = subparser ( command "decompose-output" (info (DecomposeOutput <$> decomposeOutputOptionsParser) (progDesc "decompose based on output")) <> command "decompose-input" (info (DecomposeInput <$> decomposeInputOptionsParser) (progDesc "decompose based on independent inputs")) )