remove Params constructor
Before it gets into released API...
This commit is contained in:
parent
446a2e4c9a
commit
a5bb972d94
|
@ -22,7 +22,8 @@ sshCachingParams hn = do
|
||||||
let ps =
|
let ps =
|
||||||
[ Param "-o"
|
[ Param "-o"
|
||||||
, Param ("ControlPath=" ++ socketfile)
|
, Param ("ControlPath=" ++ socketfile)
|
||||||
, Params "-o ControlMaster=auto -o ControlPersist=yes"
|
, Param "-o", Param "ControlMaster=auto"
|
||||||
|
, Param "-o", Param "ControlPersist=yes"
|
||||||
]
|
]
|
||||||
|
|
||||||
maybe noop (expireold ps socketfile)
|
maybe noop (expireold ps socketfile)
|
||||||
|
@ -37,7 +38,7 @@ sshCachingParams hn = do
|
||||||
then touchFile f
|
then touchFile f
|
||||||
else do
|
else do
|
||||||
void $ boolSystem "ssh" $
|
void $ boolSystem "ssh" $
|
||||||
[ Params "-O stop" ] ++ ps ++
|
[ Param "-O", Param "stop" ] ++ ps ++
|
||||||
[ Param "localhost" ]
|
[ Param "localhost" ]
|
||||||
nukeFile f
|
nukeFile f
|
||||||
tenminutes = 600
|
tenminutes = 600
|
||||||
|
|
|
@ -19,25 +19,23 @@ import Prelude
|
||||||
|
|
||||||
-- | Parameters that can be passed to a shell command.
|
-- | Parameters that can be passed to a shell command.
|
||||||
data CommandParam
|
data CommandParam
|
||||||
= Params String -- ^ Contains multiple parameters, separated by whitespace
|
= Param String -- ^ A parameter
|
||||||
| Param String -- ^ A single parameter
|
|
||||||
| File FilePath -- ^ The name of a file
|
| File FilePath -- ^ The name of a file
|
||||||
deriving (Eq, Show, Ord)
|
deriving (Eq, Show, Ord)
|
||||||
|
|
||||||
-- | Used to pass a list of CommandParams to a function that runs
|
-- | Used to pass a list of CommandParams to a function that runs
|
||||||
-- a command and expects Strings. -}
|
-- a command and expects Strings. -}
|
||||||
toCommand :: [CommandParam] -> [String]
|
toCommand :: [CommandParam] -> [String]
|
||||||
toCommand = concatMap unwrap
|
toCommand = map unwrap
|
||||||
where
|
where
|
||||||
unwrap (Param s) = [s]
|
unwrap (Param s) = s
|
||||||
unwrap (Params s) = filter (not . null) (split " " s)
|
|
||||||
-- Files that start with a non-alphanumeric that is not a path
|
-- Files that start with a non-alphanumeric that is not a path
|
||||||
-- separator are modified to avoid the command interpreting them as
|
-- separator are modified to avoid the command interpreting them as
|
||||||
-- options or other special constructs.
|
-- options or other special constructs.
|
||||||
unwrap (File s@(h:_))
|
unwrap (File s@(h:_))
|
||||||
| isAlphaNum h || h `elem` pathseps = [s]
|
| isAlphaNum h || h `elem` pathseps = s
|
||||||
| otherwise = ["./" ++ s]
|
| otherwise = "./" ++ s
|
||||||
unwrap (File s) = [s]
|
unwrap (File s) = s
|
||||||
-- '/' is explicitly included because it's an alternative
|
-- '/' is explicitly included because it's an alternative
|
||||||
-- path separator on Windows.
|
-- path separator on Windows.
|
||||||
pathseps = pathSeparator:"./"
|
pathseps = pathSeparator:"./"
|
||||||
|
|
Loading…
Reference in New Issue