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.

45 lines
779 B

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