package cmdCreate import ( "bufio" "log" "os" "strings" ) func CreateReadme(projectName, description, author, url string) bool { file, err := os.Open("../readme.template") if err != nil { log.Fatal(err) } defer file.Close() template := "" scanner := bufio.NewScanner(file) for scanner.Scan() { line := scanner.Text() line = strings.Replace(line, "", projectName, -1) line = strings.Replace(line, "", description, -1) line = strings.Replace(line, "", author, -1) line = strings.Replace(line, "", url, -1) template += line + "\n" } readmeFile, err := os.Create("README.md") if err != nil { log.Fatal(err) } defer readmeFile.Close() _, err = readmeFile.WriteString(template) if err != nil { log.Fatal(err) } return true }