Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 25 lines (19 sloc) 0.634 kb
4f72dfc pat brisbin add mv
authored
1 module Main where
2
3 import Network.AWS.Utils
4 import Control.Monad (forM_, guard)
5
6 main :: IO ()
7 main = handleArgs usage parseArgs $ \(srcs, dst) ->
8 forM_ srcs $ \src -> move src dst
9
9984048 pat brisbin bugfix, streamline usage handling
authored
10 usage :: String
11 usage = "s3mv <bucket:[path]> <bucket:[path]>"
4f72dfc pat brisbin add mv
authored
12
13 parseArgs :: [String] -> Maybe ([Arg], Arg)
14 parseArgs [] = Nothing
15 parseArgs [_] = Nothing
16 parseArgs args = do
17 let srcs = map parseArg $ init args
18 let dst = parseArg $ last args
19 guard (allRemote srcs)
fc7298b pat brisbin refactor prettyResult, minor tweaks
authored
20 return (srcs, dst)
4f72dfc pat brisbin add mv
authored
21
22 move :: Arg -> Arg -> IO ()
ab89105 pat brisbin factor our common connection code
authored
23 move (R from) (R to) = withConnection $ \aws -> moveRemote aws from to
24 move _ _ = errorInvalidArgs
Something went wrong with that request. Please try again.