]> git.rkrishnan.org Git - functorrent.git/blobdiff - src/Main.hs
README: indent usage examples
[functorrent.git] / src / Main.hs
index 8171d385a4ccfefe2f8136e8c0199f82ce50966a..3aa65874efa581464d016899bcfcaf60356ae591 100644 (file)
@@ -1,8 +1,8 @@
 {-# LANGUAGE OverloadedStrings #-}
 module Main where
 
-import Prelude hiding (log, length, readFile)
-import Data.ByteString.Char8 (ByteString, readFile, unpack)
+import Prelude hiding (log, length, readFile, getContents)
+import Data.ByteString.Char8 (ByteString, getContents, readFile, unpack)
 import System.Environment (getArgs)
 import System.Exit (exitSuccess)
 import System.Directory (doesFileExist)
@@ -25,7 +25,7 @@ usage :: IO ()
 usage = putStrLn "usage: functorrent torrent-file"
 
 parse :: [String] -> IO ByteString
-parse [] = usage >> exit
+parse [] = getContents
 parse [a] = do
   fileExist <- doesFileExist a
   if fileExist
@@ -41,7 +41,7 @@ main = do
     log "Starting up functorrent"
     log $ "Parsing arguments " ++ concat args
     torrentStr <- parse args
-    case (torrentToMetainfo torrentStr) of
+    case torrentToMetainfo torrentStr of
      Left e -> logError e log
      Right m -> do
        log "Input File OK"
@@ -55,5 +55,5 @@ main = do
         Right peerList -> do
           log $ "Peers List : " ++ (show . peers $ peerList)
           let p1 = head (peers peerList)
-          handlePeerMsgs p1 m peerId log
+          handlePeerMsgs p1 m peerId
     logStop logR