35 lines
928 B
Haskell
35 lines
928 B
Haskell
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 = 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)
|
|
|
|
|
|
|