io.go 906 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package issues
  2. import (
  3. "os"
  4. )
  5. func readPath(path string) (output string, err error) {
  6. content, err := os.ReadFile(path)
  7. if err != nil {
  8. return "", err
  9. }
  10. for _, line := range content {
  11. output = output + string(line)
  12. }
  13. return output, nil
  14. }
  15. // Reports true when the specified path conforms to the minimum Poorman spec
  16. func IsIssue(path string) bool {
  17. files, err := os.ReadDir(path)
  18. if err != nil {
  19. return false
  20. }
  21. var specFiles []bool
  22. for _, file := range files {
  23. if file.Name() == "description" || file.Name() == "status" {
  24. specFiles = append(specFiles, true)
  25. }
  26. }
  27. if len(specFiles) >= 2 {
  28. return true
  29. }
  30. return false
  31. }
  32. // Writes a issue to disk
  33. func WriteIssue(issue Issue) (success bool, err error) { return false, nil } // TODO: implement
  34. // Removes a issue from disk
  35. func DeleteIssue(issue Issue) (success bool, err error) { return false, nil } // TODO: implement