testClient started
This commit is contained in:
parent
4bfe5baee3
commit
2029e7ae87
4 changed files with 35 additions and 2 deletions
32
app/Main.hs
32
app/Main.hs
|
@ -1,5 +1,35 @@
|
|||
module Main where
|
||||
|
||||
import Data.Aeson.TickLeiste
|
||||
import Data.TickLeiste
|
||||
import Network.WebSockets
|
||||
import System.Environment
|
||||
import System.Exit (die)
|
||||
import Text.Read
|
||||
import Data.Maybe (maybe)
|
||||
|
||||
main :: IO ()
|
||||
main = return ()
|
||||
main = do
|
||||
args <- getArgs
|
||||
if length args /= 3
|
||||
-- here should be more checks, but as this client is only ment for quick
|
||||
-- tests and not part of the finished project I don't care
|
||||
then die "arguments must be 'host' 'port' 'path'"
|
||||
else do
|
||||
runClient (args !! 0) (read $ args !! 1) (args !! 2) testClient
|
||||
|
||||
-- this thing is realy cheap: we read strings!!
|
||||
-- What we should do: read ByteString and go from there
|
||||
-- and do checks if our input is clean, we do none of that.
|
||||
testClient :: ClientApp ()
|
||||
testClient conn = do
|
||||
putStr "> "
|
||||
userInput <- getLine
|
||||
maybe
|
||||
(putStrLn "Input parse failed, maybe a Typo?")
|
||||
(\request -> do
|
||||
undefined)
|
||||
(readMaybe userInput :: Maybe JSONRequest)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue