23 lines
536 B
Haskell
23 lines
536 B
Haskell
module Main (main) where
|
|
import OneCommand.Prelude (generateOneCommand)
|
|
import System.Environment (getArgs)
|
|
import OneCommand.Mcm.Parser (processDir)
|
|
import GHC.IO.Handle.Text (hPutStrLn)
|
|
import GHC.IO.Handle.FD (stderr)
|
|
import Control.Monad.Except (runExceptT)
|
|
|
|
main :: IO ()
|
|
main = do
|
|
args <- getArgs
|
|
|
|
let dir = case args of
|
|
[d] -> d
|
|
_ -> "."
|
|
|
|
result <- runExceptT $ processDir dir
|
|
case result of
|
|
Right c -> do
|
|
let ocmd = generateOneCommand c
|
|
putStrLn ocmd
|
|
Left err -> hPutStrLn stderr err
|