| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package issues
- import (
- "os"
- )
- func readPath(path string) (output string, err error) {
- content, err := os.ReadFile(path)
- if err != nil {
- return "", err
- }
- for _, line := range content {
- output = output + string(line)
- }
- return output, nil
- }
- // Reports true when the specified path conforms to the minimum Poorman spec
- func IsIssue(path string) bool {
- files, err := os.ReadDir(path)
- if err != nil {
- return false
- }
- var specFiles []bool
- for _, file := range files {
- if file.Name() == "description" || file.Name() == "status" {
- specFiles = append(specFiles, true)
- }
- }
- if len(specFiles) >= 2 {
- return true
- }
- return false
- }
- // Reports true when the specified path is a directory of Issues
- func IsIssueCollection(path string) bool {
- if IsIssue(path) {
- return false
- }
- files, err := os.ReadDir(path)
- if err != nil {
- return false
- }
- var isIssue []bool
- for _, file := range files {
- if IsIssue(path + "/" + file.Name()) {
- isIssue = append(isIssue, true)
- }
- }
- if len(isIssue) > 0 {
- return true
- }
- return false
- }
- // Writes a issue to disk
- func WriteIssue(issue Issue) (success bool, err error) { return false, nil } // TODO: implement
- // Removes a issue from disk
- func DeleteIssue(issue Issue) (success bool, err error) { return false, nil } // TODO: implement
|