1
Fork 0

read stdin

This commit is contained in:
Grigory Bordyugov 2018-11-27 17:54:53 +01:00
parent 00433a26e8
commit fd8356aa1b

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 ""