@@ -69,12 +69,15 @@ async function parseSSHConfigFromFile(filePath: string, userConfig: boolean) {
6969 for ( let i = 0 ; i < config . length ; i ++ ) {
7070 const line = config [ i ] ;
7171 if ( isIncludeDirective ( line ) ) {
72- const includePaths = await glob ( normalizeToSlash ( untildify ( line . value ) ) , {
73- absolute : true ,
74- cwd : normalizeToSlash ( path . dirname ( userConfig ? defaultSSHConfigPath : systemSSHConfig ) )
75- } ) ;
76- for ( const p of includePaths ) {
77- includedConfigs . set ( i , await parseSSHConfigFromFile ( p , userConfig ) ) ;
72+ const values = ( line . value as string ) . split ( ',' ) . map ( s => s . trim ( ) ) ;
73+ for ( const value of values ) {
74+ const includePaths = await glob ( normalizeToSlash ( untildify ( value ) ) , {
75+ absolute : true ,
76+ cwd : normalizeToSlash ( path . dirname ( userConfig ? defaultSSHConfigPath : systemSSHConfig ) )
77+ } ) ;
78+ for ( const p of includePaths ) {
79+ includedConfigs . set ( i , await parseSSHConfigFromFile ( p , userConfig ) ) ;
80+ }
7881 }
7982 }
8083 }
@@ -101,7 +104,7 @@ export default class SSHConfiguration {
101104 const hosts = new Set < string > ( ) ;
102105 for ( const line of this . sshConfig ) {
103106 if ( isHostSection ( line ) ) {
104- const value = Array . isArray ( line . value as string [ ] | string ) ? line . value [ 0 ] : line . value ;
107+ const value = Array . isArray ( line . value ) ? line . value [ 0 ] : line . value ;
105108 const isPattern = / ^ ! / . test ( value ) || / [ ? * ] / . test ( value ) ;
106109 if ( ! isPattern ) {
107110 hosts . add ( value ) ;
@@ -113,6 +116,8 @@ export default class SSHConfiguration {
113116 }
114117
115118 getHostConfiguration ( host : string ) : Record < string , string > {
116- return this . sshConfig . compute ( host ) ;
119+ // Only a few directives return an array
120+ // https://github.com/jeanp413/ssh-config/blob/8d187bb8f1d83a51ff2b1d127e6b6269d24092b5/src/ssh-config.ts#L9C1-L9C118
121+ return this . sshConfig . compute ( host ) as Record < string , string > ;
117122 }
118123}
0 commit comments