Skip to content

Commit

Permalink
Merge pull request #8 from november-eleven/master
Browse files Browse the repository at this point in the history
SSH config souldn't be mandatory
  • Loading branch information
crosbymichael committed Feb 10, 2016
2 parents e6e6524 + 8a2b80d commit a16f671
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"io/ioutil"
"os"
"strings"

log "github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -43,12 +44,19 @@ func parseSshConfigFileSection(content string) *SshConfigFileSection {

// parseSshConfigFile parses the ~/.ssh/config file and build a list of section
func parseSshConfigFile(path string) (map[string]*SshConfigFileSection, error) {

sections := make(map[string]*SshConfigFileSection)

log.Debugf("parsing ssh config file: %s", path)
content, err := ioutil.ReadFile(path)
if err != nil {
if os.IsNotExist(err) {
log.Debugf("cannot find ssh config file: %s", path)
return sections, nil
}
return nil, err
}
sections := make(map[string]*SshConfigFileSection)

for _, split := range strings.Split(string(content), "Host ") {
split = strings.TrimSpace(split)
if split == "" {
Expand Down

0 comments on commit a16f671

Please sign in to comment.