()
| 43 | |
| 44 | // Map: host -> info |
| 45 | export async function getSshConfigHostInfos(): Promise<Map<string, ISshConfigHostInfo>> { |
| 46 | const hostInfos: Map<string, ISshConfigHostInfo> = new Map<string, ISshConfigHostInfo>(); |
| 47 | |
| 48 | for (const configPath of getSshConfigurationFiles()) { |
| 49 | const config: Configuration = await getSshConfiguration(configPath); |
| 50 | const hosts: { [host: string]: string } = extractHostNames(config); |
| 51 | Object.keys(hosts).forEach(name => hostInfos.set(name, { hostName: hosts[name], file: configPath })); |
| 52 | } |
| 53 | |
| 54 | return hostInfos; |
| 55 | } |
| 56 | |
| 57 | function extractHostNames(parsedConfig: Configuration): { [host: string]: string } { |
| 58 | const hostNames: { [host: string]: string } = Object.create(null); |
no test coverage detected