main ∷ IO ()
main = getArgs >>= \case
  [] → putStr help
  "-d":d:ts → downloadTo d ts
  xs → fetchImageLinks xs >>= \x → mapM_ putStrLn [ y | Right y ← x ]

-- | Downloads all the images with the given tag to the given
-- directory.
downloadTo 
main ∷ IO ()
main = getArgs >>= \case
  [] → putStr help
  "-d":d:ts → downloadTo d ts
  xs → fetchImageLinks xs >>= \x → mapM_ putStrLn [ y | Right y ← x ]

-- | Downloads all the images with the given tag to the given
-- directory.
main = getArgs >>= \case
  [] → putStr help
  "-d":d:ts → downloadTo d ts
  xs → fetchImageLinks xs >>= \x → mapM_ putStrLn [ y | Right y ← x ]

-- | Downloads all the images with the given tag to the given
-- directory.