You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
607 B

  1. package main
  2. import (
  3. "io/ioutil"
  4. "strings"
  5. "github.com/fatih/color"
  6. )
  7. func readFile(path string) string {
  8. dat, err := ioutil.ReadFile(path)
  9. if err != nil {
  10. color.Red(path)
  11. }
  12. check(err)
  13. return string(dat)
  14. }
  15. func writeFile(path string, newContent string) {
  16. err := ioutil.WriteFile(path, []byte(newContent), 0644)
  17. check(err)
  18. color.Green(path)
  19. //color.Blue(newContent)
  20. }
  21. func getLines(text string) []string {
  22. lines := strings.Split(text, "\n")
  23. return lines
  24. }
  25. func concatStringsWithJumps(lines []string) string {
  26. var r string
  27. for _, l := range lines {
  28. r = r + l + "\n"
  29. }
  30. return r
  31. }