From f4b80c574945be3aca60ec3e76d50b386b53f293 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 22 Sep 2015 12:06:10 -0400 Subject: 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. --- Utility/SshConfig.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Utility/SshConfig.hs') 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 -- cgit v1.2.3