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
|
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 :: 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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ dependencies:
|
||||||
- base >= 4.7 && < 5
|
- base >= 4.7 && < 5
|
||||||
- tickLeiste
|
- tickLeiste
|
||||||
- tickLeiste-aeson
|
- tickLeiste-aeson
|
||||||
|
- websockets
|
||||||
|
|
||||||
executables:
|
executables:
|
||||||
tickLeisteTestClient-exe:
|
tickLeisteTestClient-exe:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b40c7faef0343a09f256833d822cc7734e3fcb4f
|
Subproject commit da214ba266d8b2924f4e77530734f771bd38abe0
|
|
@ -35,6 +35,7 @@ executable tickLeisteTestClient-exe
|
||||||
, tickLeiste
|
, tickLeiste
|
||||||
, tickLeiste-aeson
|
, tickLeiste-aeson
|
||||||
, tickLeisteTestClient
|
, tickLeisteTestClient
|
||||||
|
, websockets
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
test-suite tickLeisteTestClient-test
|
test-suite tickLeisteTestClient-test
|
||||||
|
@ -50,4 +51,5 @@ test-suite tickLeisteTestClient-test
|
||||||
, tickLeiste
|
, tickLeiste
|
||||||
, tickLeiste-aeson
|
, tickLeiste-aeson
|
||||||
, tickLeisteTestClient
|
, tickLeisteTestClient
|
||||||
|
, websockets
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue