@@ -6,11 +6,11 @@ import BuildInfo_ambiata_mismi_cli
66import DependencyInfo_ambiata_mismi_cli
77
88import Control.Lens (over , set )
9- import Control.Monad.IO.Class
10- import Control.Monad.Trans.Resource
9+ import Control.Monad.IO.Class ( MonadIO , liftIO )
10+ import Control.Monad.Trans.Resource ( runResourceT )
1111
1212import qualified Data.ByteString as BS
13- import Data.Conduit
13+ import Data.Conduit ( (=$=) , ($$) , ($$+-) )
1414import qualified Data.Conduit.List as DC
1515import qualified Data.List as List
1616import Data.Map (Map )
@@ -25,22 +25,23 @@ import qualified Mismi.OpenSSL as O
2525import Mismi.S3
2626import Mismi.S3.Amazonka (s3 )
2727
28- import Options.Applicative
29-
3028import P hiding (All )
3129
32- import System.IO
30+ import System.IO ( BufferMode ( .. ), FilePath , IO , hSetBuffering , print , stderr , stdout )
3331import System.Environment (lookupEnv )
34- import System.Exit
35- import System.FilePath
36- import System.Posix.Signals
37- import System.Posix.Process
32+ import System.Exit ( ExitCode ( .. ), exitFailure , exitSuccess )
33+ import qualified System.FilePath as FP
34+ import System.Posix.Signals ( Handler ( .. ), installHandler , sigINT , sigQUIT , sigTERM )
35+ import System.Posix.Process ( exitImmediately )
3836
3937import Text.Printf (printf )
4038
41- import X.Control.Monad.Trans.Either.Exit
39+ import X.Control.Monad.Trans.Either.Exit ( orDie )
4240import X.Control.Monad.Trans.Either (EitherT , eitherT , runEitherT , firstEitherT )
43- import X.Options.Applicative
41+ import X.Options.Applicative (Completer , Parser , RunType (.. ), SafeCommand (.. )
42+ , action , auto , command' , flag , flag' , help , long , metavar
43+ , pOption , option , short , value )
44+ import qualified X.Options.Applicative as XOA
4445
4546data Recursive =
4647 NotRecursive
@@ -103,7 +104,7 @@ main = do
103104 installHandler s (Catch . void . exitImmediately $ ExitFailure 111 ) Nothing
104105
105106 f <- lookupEnv " AWS_FORCE"
106- dispatch (mismi $ parseForce f) >>= \ case
107+ XOA. dispatch (mismi $ parseForce f) >>= \ case
107108 VersionCommand ->
108109 T. putStrLn (" s3: " <> T. pack buildInfoVersion) >> exitSuccess
109110 DependencyCommand ->
@@ -283,16 +284,16 @@ renderExit f =
283284
284285optAppendFileName :: FilePath -> Key -> FilePath
285286optAppendFileName f k = fromMaybe f $ do
286- fp <- valueOrEmpty (hasTrailingPathSeparator f || takeFileName f == " ." ) (takeDirectory f)
287+ fp <- valueOrEmpty (FP. hasTrailingPathSeparator f || FP. takeFileName f == " ." ) (FP. takeDirectory f)
287288 bn <- basename k
288- pure . combine fp $ T. unpack bn
289+ pure . FP. combine fp $ T. unpack bn
289290
290291mismi :: Force -> Parser (SafeCommand Command )
291292mismi f =
292- safeCommand (commandP' f <|> deprecatedCommandP')
293+ XOA. safeCommand (commandP' f <|> deprecatedCommandP')
293294
294295commandP' :: Force -> Parser Command
295- commandP' f = subparser $
296+ commandP' f = XOA. subparser $
296297 command' " upload"
297298 " Upload a file to s3."
298299 (Upload <$> filepath' <*> address' <*> writeMode' f)
@@ -331,8 +332,8 @@ commandP' f = subparser $
331332 (List <$> address' <*> recursive')
332333
333334deprecatedCommandP' :: Parser Command
334- deprecatedCommandP' = subparser $
335- internal <> command'
335+ deprecatedCommandP' = XOA. subparser $
336+ XOA. internal <> command'
336337 " read"
337338 " Read from an address. (Deprecated in favour of `s3 cat`.)"
338339 (Read <$> address')
@@ -371,26 +372,26 @@ detail' =
371372 <> help " Display only the combined total for a prefix."
372373
373374address' :: Parser Address
374- address' = argument (pOption s3Parser) $
375+ address' = XOA. argument (pOption s3Parser) $
375376 metavar " S3URI"
376377 <> help " An s3 uri, i.e. s3://bucket/prefix/key"
377- <> completer addressCompleter
378+ <> XOA. completer addressCompleter
378379
379380outputAddress' :: Parser Address
380381outputAddress' = option (pOption s3Parser) $
381382 long " output"
382383 <> metavar " S3URI"
383384 <> help " An s3 uri, i.e. s3://bucket/prefix/key"
384- <> completer addressCompleter
385+ <> XOA. completer addressCompleter
385386
386387filepath' :: Parser FilePath
387- filepath' = strArgument $
388+ filepath' = XOA. strArgument $
388389 metavar " FILEPATH"
389390 <> help " Absolute file path, i.e. /tmp/fred"
390391 <> action " file"
391392
392393text' :: Parser Text
393- text' = T. pack <$> (strArgument $
394+ text' = T. pack <$> (XOA. strArgument $
394395 metavar " STRING"
395396 <> help " Data to write to S3 address." )
396397
@@ -414,14 +415,14 @@ syncMode' =
414415 <|> (flag' OverwriteSync $ long " overwrite" <> help " Overwrite files that already exist in the target location." )
415416
416417fork' :: Parser Int
417- fork' = option auto $
418+ fork' = XOA. option auto $
418419 long " fork"
419420 <> metavar " INT"
420421 <> help " Number of threads to fork CopyObject call by."
421422 <> value 8
422423
423424addressCompleter :: Completer
424- addressCompleter = mkCompleter $ \ s -> do
425+ addressCompleter = XOA. mkCompleter $ \ s -> do
425426 res <- runEitherT (go s)
426427 case res of
427428 Left _ -> pure []
0 commit comments