5 import Text.Edifact.Common (parseFull)
6 import Text.Edifact.D96A (messageIFCSUM, messageDESADV)
7 import Text.Edifact.Inspect (inspect)
8 import Text.Edifact.Types (Value)
10 import Control.Monad ((>=>))
11 import qualified Data.Text.IO as TIO (putStrLn, readFile)
12 import System.Environment (getArgs)
15 main = getArgs >>= dispatch
17 dispatch :: [String] -> IO ()
18 dispatch ("ifcsum" : filename : _) = readIFCSUM filename
19 dispatch ("desadv" : filename : _) = readDESADV filename
22 readIFCSUM :: FilePath -> IO ()
24 let display = either print (TIO.putStrLn . inspect)
25 in TIO.readFile >=> display . parseFull messageIFCSUM
27 readDESADV :: FilePath -> IO ()
29 let display = either print (TIO.putStrLn . inspect)
30 in TIO.readFile >=> display . parseFull messageDESADV
34 putStrLn "ifcsum <file> : inspect IFCSUM file for revision D96A"
35 putStrLn "desadv <file> : inspect DESADV file for revision D96A"
36 putStrLn "-h|--help : this message"