1
Fork 0

Merge pull request #17 from gbordyugov/read-stdin

Read stdin for SimpleSqlParserTool
This commit is contained in:
Jake Wheat 2018-11-28 09:53:16 +07:00 committed by GitHub
commit 372dcf91cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,7 @@ indent: parse then pretty print sql
> getInput :: [String] -> IO (FilePath,String) > getInput :: [String] -> IO (FilePath,String)
> getInput as = > getInput as =
> case as of > case as of
> ["-"] -> error "read stdin" > ["-"] -> ("-",) <$> getContents
> ("-c":as') -> return ("-", unwords as') > ("-c":as') -> return ("-", unwords as')
> [filename] -> (filename,) <$> readFile filename > [filename] -> (filename,) <$> readFile filename
> _ -> showHelp (Just "arguments not recognised") >> error "" > _ -> showHelp (Just "arguments not recognised") >> error ""