diff --git a/app/Main.hs b/app/Main.hs index 0848f95..28ced1e 100644 --- a/app/Main.hs +++ b/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) + + + diff --git a/package.yaml b/package.yaml index ab64935..795b52b 100644 --- a/package.yaml +++ b/package.yaml @@ -23,6 +23,7 @@ dependencies: - base >= 4.7 && < 5 - tickLeiste - tickLeiste-aeson +- websockets executables: tickLeisteTestClient-exe: diff --git a/tickLeiste b/tickLeiste index b40c7fa..da214ba 160000 --- a/tickLeiste +++ b/tickLeiste @@ -1 +1 @@ -Subproject commit b40c7faef0343a09f256833d822cc7734e3fcb4f +Subproject commit da214ba266d8b2924f4e77530734f771bd38abe0 diff --git a/tickLeisteTestClient.cabal b/tickLeisteTestClient.cabal index 8214497..4c99bc1 100644 --- a/tickLeisteTestClient.cabal +++ b/tickLeisteTestClient.cabal @@ -35,6 +35,7 @@ executable tickLeisteTestClient-exe , tickLeiste , tickLeiste-aeson , tickLeisteTestClient + , websockets default-language: Haskell2010 test-suite tickLeisteTestClient-test @@ -50,4 +51,5 @@ test-suite tickLeisteTestClient-test , tickLeiste , tickLeiste-aeson , tickLeisteTestClient + , websockets default-language: Haskell2010