diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-09-22 12:06:10 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-09-22 12:06:10 -0400 |
commit | f4b80c574945be3aca60ec3e76d50b386b53f293 (patch) | |
tree | 5d49db185f62fa8f48a1d3d179656062c3fcba64 /Utility/SshConfig.hs | |
parent | c70c8ea742236db777845088525da656574e4369 (diff) |
Improve ~/.ssh/config modification code to not add trailing spaces to lines it cannot parse.
"Host\n" is a valid line, and actually gets parsed ok, but this also holds
for other lines that it fails to parse for some reason.
Diffstat (limited to 'Utility/SshConfig.hs')
-rw-r--r-- | Utility/SshConfig.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Utility/SshConfig.hs b/Utility/SshConfig.hs index 57e4f0f38..cd15c47ce 100644 --- a/Utility/SshConfig.hs +++ b/Utility/SshConfig.hs @@ -82,7 +82,8 @@ genSshConfig = unlines . concatMap gen gen (GlobalConfig s) = [setting s] gen (HostConfig h cs) = ("Host " ++ h) : map (either comment setting) cs - setting (SshSetting indent k v) = indent ++ k ++ " " ++ v + setting (SshSetting indent k v) = indent ++ k ++ + if null v then "" else " " ++ v comment (Comment indent c) = indent ++ c findHostConfigKey :: SshConfig -> Key -> Maybe Value |