Skip to content

Commit d590e81

Browse files
committed
Merge pull request #33 from cmuench/master
[BUGFIX] Added support for .ssh/config files indented with tabs or spaces
2 parents 0dac016 + 77907e4 commit d590e81

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Ssh/SshConfigFileConfiguration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ protected function parseSshConfigFile($file)
6060
$configs = array();
6161
$lineNumber = 1;
6262
foreach (explode(PHP_EOL, $contents) as $line) {
63-
if (trim($line) == '' || $line[0] == '#') {
63+
$line = trim($line);
64+
if ($line == '' || $line[0] == '#') {
6465
continue;
6566
}
6667
$pos = strpos($line, '=');

tests/Ssh/Fixtures/config_valid

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Port 1234
55
#This is a comment which won't appear in the parsed array
66

77
Host test
8-
HostName test.com
8+
HostName test.com
99

1010
Host testuser.com
1111
User test
@@ -21,4 +21,4 @@ IdentityFile ~/identity
2121
Host ta*
2222
User bob
2323
Port = 12345
24-
HostName test.com
24+
HostName test.com

0 commit comments

Comments
 (0)