diff --git a/backend/config/config.go b/backend/config/config.go index 449d31e..60fee36 100644 --- a/backend/config/config.go +++ b/backend/config/config.go @@ -21,6 +21,7 @@ import ( "os/exec" "os/user" "path/filepath" + "regexp" "strings" yaml "gopkg.in/yaml.v2" @@ -137,7 +138,10 @@ func SetupConfigFile(ConfigFileName string) { dotfilesRepositoryPrefix := "\ndotfiles:\n" dotfilesRepository := fmt.Sprintf(" repository: %s\n", env.GetDotfilesRepository()) - repositoryProvider := " provider: github" + + re := regexp.MustCompile("([a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9])\\.[a-zA-Z]{2,}") + provider := re.FindStringSubmatch(dotfilesRepository)[1] + repositoryProvider := fmt.Sprintf(" provider: %s", provider) configContent = append(configContent, fmt.Sprintf("%s%s%s", dotfilesRepositoryPrefix, dotfilesRepository, repositoryProvider)...) } diff --git a/backend/env/env.go b/backend/env/env.go index 66c7295..398fd83 100644 --- a/backend/env/env.go +++ b/backend/env/env.go @@ -214,7 +214,7 @@ func GenerateRepositoriesPath() string { // GetDotfilesRepository creates conf line containing the user's input. func GetDotfilesRepository() string { - fmt.Print("\nEnter the full path to your dotfiles Github repository\n(leave blank to skip): ") + fmt.Print("\nEnter the full path to your dotfiles repository\n(leave blank to skip): ") reader := bufio.NewReader(os.Stdin) if input, _ := reader.ReadString('\n'); input != "\n" && input != "" { return string(bytes.TrimSuffix([]byte(input), []byte("\n")))