initial commit
This commit is contained in:
22
app/Main.hs
Normal file
22
app/Main.hs
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user