Skip to content

Commit

Permalink
fix: match criteria with = separator (#75)
Browse files Browse the repository at this point in the history
* fix: match criteria with = separator

* chore: add nodejs v20.x
  • Loading branch information
cyjake committed Feb 20, 2024
1 parent 4fec097 commit dfbedca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x]
node-version: [12.x, 14.x, 16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand Down
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/ssh-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export function parse(text: string): SSHConfig {
else if (quoted) {
val += chr
}
else if (/[ \t]/.test(chr)) {
else if (/[ \t=]/.test(chr)) {
if (val) {
results.push(val)
val = ''
Expand Down
14 changes: 14 additions & 0 deletions test/unit/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,18 @@ describe('parse', function() {
value: '/Users/mtovino/.ssh/cloudflare/config',
})
})

// https://github.com/cyjake/ssh-config/issues/74
it('.parse match host=', function() {
const config = parse(`
Match host=*.ligo-*.caltech.edu
User albert.einstein
`)
const match = config.find(line => line.type === DIRECTIVE && line.param === 'Match')
assert.ok(match)
assert.ok('criteria' in match)
assert.deepEqual(match.criteria, {
host: '*.ligo-*.caltech.edu',
})
})
})

0 comments on commit dfbedca

Please sign in to comment.