~alcinnz/hurl

25589da5831b923918049bf7ca14c1497dd4e75f — Adrian Cochrane 4 years ago a00b30a
Implement simple commandline version of HURL.
3 files changed, 21 insertions(+), 7 deletions(-)

A Main.hs
M hurl.cabal
D src/Main.hs
A Main.hs => Main.hs +19 -0
@@ 0,0 1,19 @@
module Main where

import Network.URI.Fetch
-- Input parsing
import System.Environment (getArgs)
import Network.URI (parseURI, nullURI)
import Data.Maybe (catMaybes)
-- Where to save files
import System.Directory (getCurrentDirectory)

main :: IO ()
main = do
    urls <- getArgs
    let urls' = catMaybes $ map parseURI urls
    session <- newSession
    dir <- getCurrentDirectory

    res <- fetchURLs session ["*/*"] urls' $ saveDownload nullURI dir
    putStrLn $ show res

M hurl.cabal => hurl.cabal +2 -2
@@ 129,10 129,10 @@ executable hurl
  main-is:             Main.hs

  -- Other library packages from which modules are imported
  build-depends:       base >=4.9 && <=4.12, hurl
  build-depends:       base >=4.9 && <=4.12, hurl, network-uri, directory

  -- Directories containing source files.
  hs-source-dirs:      src
  hs-source-dirs:      .

  -- Base language which the package is written in.
  default-language:    Haskell2010

D src/Main.hs => src/Main.hs +0 -5
@@ 1,5 0,0 @@
module Main where

main :: IO ()
main = do
    putStrLn "Hello, world!"