@@ -34,37 +34,66 @@ func main() {
34
34
}
35
35
// list all repositories for the authenticated user for the selected repos
36
36
for _ , r := range reposlist {
37
- o = append (o , fmt .Sprintf ("* %s" , r ))
37
+ project := fmt .Sprintf ("* %s" , r )
38
+ todo := []string {}
39
+ prog := []string {}
40
+ done := []string {}
38
41
data := strings .Split (r , "/" )
39
42
opts := github.IssueListByRepoOptions {
40
- State : "open" ,
43
+ State : "all" ,
44
+ ListOptions : github.ListOptions {
45
+ PerPage : 100000 ,
46
+ },
41
47
}
42
48
issues , _ , err := client .Issues .ListByRepo (ctx , data [0 ], data [1 ], & opts )
43
49
if err != nil {
44
50
fmt .Println (err )
45
51
os .Exit (1 )
46
52
}
47
53
for _ , i := range issues {
48
-
54
+ issue := [] string {}
49
55
// add org- and repo-name to tags
50
56
labels := fmt .Sprintf (":%s:%s:" , reg .ReplaceAllString (data [0 ], "" ), reg .ReplaceAllLiteralString (data [1 ], "" ))
51
57
for _ , l := range i .Labels {
52
58
labels = labels + reg .ReplaceAllString (l .GetName (), "" ) + ":"
53
59
}
54
- o = append (o , fmt .Sprintf ("** TODO %s \t \t %s" , i .GetTitle (), labels ))
60
+ status := "TODO"
61
+ for _ , a := range i .Assignees {
62
+ for _ , handle := range handlelist {
63
+ if a .GetLogin () == handle {
64
+ status = "IN PROGRESS"
65
+ }
66
+ }
67
+ }
68
+ if i .GetState () == "closed" {
69
+ status = "DONE"
70
+ }
71
+ issue = append (issue , fmt .Sprintf ("** %s %s \t \t %s" , status , i .GetTitle (), labels ))
72
+ issue = append (issue , fmt .Sprintf ("\t State : %s" , i .GetState ()))
73
+ issue = append (issue , fmt .Sprintf ("\t Creator : %s" , i .GetUser ().GetLogin ()))
55
74
// the timestamps have been created without < & > intentionally
56
75
// I do not want them to show up in the daily agenda
57
- o = append (o , fmt .Sprintf ("\t Created : %s" , i .GetCreatedAt ()))
58
- o = append (o , fmt .Sprintf ("\t Updated : %s" , i .GetUpdatedAt ()))
59
- o = append (o , fmt .Sprintf ("\t Creator : %s" , i .GetUser ().GetLogin ()))
76
+ issue = append (issue , fmt .Sprintf ("\t Created : %s" , i .GetCreatedAt ()))
77
+ issue = append (issue , fmt .Sprintf ("\t Updated : %s" , i .GetUpdatedAt ()))
60
78
for _ , a := range i .Assignees {
61
- o = append (o , fmt .Sprintf ("\t Assignee : %s" , a .GetLogin ()))
79
+ issue = append (issue , fmt .Sprintf ("\t Assignee : %s" , a .GetLogin ()))
80
+ }
81
+ if i .GetState () == "closed" {
82
+ issue = append (issue , fmt .Sprintf ("\t Closed at : %s" , i .GetClosedAt ()))
83
+ }
84
+ issue = append (issue , fmt .Sprintf ("\t [%s]" , i .GetURL ()))
85
+ issue = append (issue , "\n " )
86
+ issue = append (issue , formatBody (i .GetBody ()))
87
+ issue = append (issue , "\n " )
88
+ if status == "TODO" {
89
+ todo = append (todo , strings .Join (issue , "\n " ))
90
+ } else if status == "DONE" {
91
+ done = append (done , strings .Join (issue , "\n " ))
92
+ } else {
93
+ prog = append (prog , strings .Join (issue , "\n " ))
62
94
}
63
- o = append (o , fmt .Sprintf ("\t [%s]" , i .GetURL ()))
64
- o = append (o , "\n " )
65
- o = append (o , formatBody (i .GetBody ()))
66
- o = append (o , "\n " )
67
95
}
96
+ o = append (o , project , strings .Join (prog , "\n " ), strings .Join (todo , "\n " ), strings .Join (done , "\n " ))
68
97
}
69
98
fmt .Printf (strings .Join (o , "\n " ) + "\n " )
70
99
}
0 commit comments