-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtype.go
53 lines (48 loc) · 1.23 KB
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package kervanscout
import (
"fmt"
"strings"
)
// IssueType is the type of issue
type IssueType string
const (
// IssueTypeUnknown is the default issue type
IssueTypeUnknown IssueType = "unknown"
// IssueTypeExecution is an execution issue
IssueTypeExecution = "execution"
// IssueTypeBug is a bug
IssueTypeBug = "bug"
// IssueTypeFeature is a feature
IssueTypeFeature = "feature"
// IssueTypeEnhancement is an enhancement
IssueTypeEnhancement = "enhancement"
// IssueTypeQuestion is a question
IssueTypeQuestion = "question"
// IssueTypeHelp is a help issue
IssueTypeHelp = "help"
)
// String returns the string representation of the issue type
func (it IssueType) String() string {
return string(it)
}
// ParseIssueType parses the issue type from a string
func ParseIssueType(s string) (IssueType, error) {
switch strings.ToLower(s) {
case "bug":
return IssueTypeBug, nil
case "execution":
return IssueTypeExecution, nil
case "feature":
return IssueTypeFeature, nil
case "enhancement":
return IssueTypeEnhancement, nil
case "question":
return IssueTypeQuestion, nil
case "help":
return IssueTypeHelp, nil
case "unknown":
return IssueTypeUnknown, nil
default:
return "", fmt.Errorf("unknown issue type: %s", s)
}
}