diff options
author | Joey Hess <joey@kitenet.net> | 2013-03-30 19:05:51 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-30 19:05:51 -0400 |
commit | 7ad60a109ab957499a45ac93697a86a5633bf96d (patch) | |
tree | 72eedfec2cef09b5ede9bbc8db4e0c566cd5e3c3 /Utility/Rsync.hs | |
parent | 883395c399a0996d825711c6d8f29aa49ed07a69 (diff) |
minor refactoring
Diffstat (limited to 'Utility/Rsync.hs')
-rw-r--r-- | Utility/Rsync.hs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Utility/Rsync.hs b/Utility/Rsync.hs index 41eb53c21..a36c6076f 100644 --- a/Utility/Rsync.hs +++ b/Utility/Rsync.hs @@ -12,6 +12,7 @@ import Utility.Metered import Data.Char import System.Console.GetOpt +import Data.Tuple.Utils {- Generates parameters to make rsync use a specified command as its remote - shell. -} @@ -130,13 +131,10 @@ parseRsyncProgress = go [] . reverse . progresschunks (_, []) -> Nothing (b, _) -> readish b -{- Rsync options that are safe to pass to rsync in server mode, without - - causing it to eg, expose files. - - - - Note: Ensure that when calling getopt, the first component of the - - output is a subset of the input. - -} -rsyncSafeOptions :: [OptDescr String] -rsyncSafeOptions = [ Option [] ["bwlimit"] (reqArgLong "bwlimit") "" ] +{- Filters options to those that are safe to pass to rsync in server mode, + - without causing it to eg, expose files. -} +filterRsyncSafeOptions :: [String] -> [String] +filterRsyncSafeOptions = fst3 . getOpt Permute + [ Option [] ["bwlimit"] (reqArgLong "bwlimit") "" ] where reqArgLong x = ReqArg (\v -> "--" ++ x ++ "=" ++ v) "" |