Skip to content

Commit

Permalink
Merge pull request #33 from cmuench/master
Browse files Browse the repository at this point in the history
[BUGFIX] Added support for .ssh/config files indented with tabs or spaces
  • Loading branch information
Herzult committed Aug 20, 2014
2 parents 0dac016 + 77907e4 commit d590e81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Ssh/SshConfigFileConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ protected function parseSshConfigFile($file)
$configs = array();
$lineNumber = 1;
foreach (explode(PHP_EOL, $contents) as $line) {
if (trim($line) == '' || $line[0] == '#') {
$line = trim($line);
if ($line == '' || $line[0] == '#') {
continue;
}
$pos = strpos($line, '=');
Expand Down
4 changes: 2 additions & 2 deletions tests/Ssh/Fixtures/config_valid
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Port 1234
#This is a comment which won't appear in the parsed array

Host test
HostName test.com
HostName test.com

Host testuser.com
User test
Expand All @@ -21,4 +21,4 @@ IdentityFile ~/identity
Host ta*
User bob
Port = 12345
HostName test.com
HostName test.com

0 comments on commit d590e81

Please sign in to comment.