-- | Parse command line options.
parseArgs :: String -> [String] -> (Options, Maybe FilePath)
parseArgs hdr argv =
    case getOpt Permute options argv of
        (os, as, []) -> (foldr id defaultOptions os, listToMaybe as)
        (_, _, es)   -> error $ concat es ++ usageInfo hdr options

-- | Read from a file or from STDIN if no file is specified.
parseArgs :: String -> [String] -> (Options, Maybe FilePath)
parseArgs hdr argv =
    case getOpt Permute options argv of
        (os, as, []) -> (foldr id defaultOptions os, listToMaybe as)
        (_, _, es)   -> error $ concat es ++ usageInfo hdr options

-- | Read from a file or from STDIN if no file is specified.
parseArgs hdr argv =
    case getOpt Permute options argv of
        (os, as, []) -> (foldr id defaultOptions os, listToMaybe as)
        (_, _, es)   -> error $ concat es ++ usageInfo hdr options

-- | Read from a file or from STDIN if no file is specified.