summaryrefslogtreecommitdiff
path: root/examples/Client.hs
blob: 2fc66101de8d11e2833246d55bb9e8c679004253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Main (main) where
import System.Environment
import System.Exit
import System.IO
import Network.BitTorrent

parseArgs :: IO FilePath
parseArgs = do
  args <- getArgs
  case args of
    [path] -> return path
    _      -> do
      hPutStrLn stderr "Usage: client file.torrent"
      exitFailure

main :: IO ()
main = do
  path    <- parseArgs
  torrent <- fromFile path
  simpleClient $ do
    h <- openTorrent torrent
    return ()