diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/Main.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/Main.hs b/app/Main.hs index 24e7a32..cc2c11d 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -16,10 +16,11 @@ import Graphics.Fountainhead.Parser ) import Graphics.Fountainhead.TrueType (FontDirectory(..), TableDirectory(..)) import System.Environment (getArgs) +import System.Exit (exitWith) +import GHC.IO.Exception (ExitCode(..)) -fontMain :: IO () -fontMain = do - fontFile <- head <$> getArgs +fontMain :: FilePath -> IO () +fontMain fontFile = do ttfContents <- ByteString.readFile fontFile let initialState = Megaparsec.State @@ -43,4 +44,9 @@ fontMain = do Right x -> print x main :: IO () -main = fontMain +main = do + programArguments <- getArgs + case programArguments of + [fontFile] -> fontMain fontFile + _ -> putStrLn "The program expects exactly one argument, the font file path." + >> exitWith (ExitFailure 2) |
