Skip to content

Commit 9eb34b9

Browse files
committed
refactor: move type definitions to a new file
The Owner, Repo, PullRequestInfo, and CommitComparison types have been moved from main.go to a new types.go file for better organization and maintainability.
1 parent fc74086 commit 9eb34b9

File tree

2 files changed

+42
-41
lines changed

2 files changed

+42
-41
lines changed

main.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,47 +16,6 @@ import (
1616
"github.com/spf13/cobra"
1717
)
1818

19-
type Owner struct {
20-
ID string `json:"id"`
21-
Login string `json:"login"`
22-
}
23-
24-
type Repo struct {
25-
Owner Owner `json:"owner"`
26-
NameWithOwner string `json:"nameWithOwner"`
27-
IsArchived bool `json:"isArchived"`
28-
UpdatedAt string `json:"updatedAt"`
29-
Parent struct {
30-
NameWithOwner string `json:"nameWithOwner"`
31-
DefaultBranchRef struct {
32-
Name string `json:"name"`
33-
Target struct {
34-
Oid string `json:"oid"`
35-
} `json:"target"`
36-
} `json:"defaultBranchRef"`
37-
} `json:"parent"`
38-
DefaultBranchRef struct {
39-
Name string `json:"name"`
40-
Target struct {
41-
Oid string `json:"oid"`
42-
} `json:"target"`
43-
} `json:"defaultBranchRef"`
44-
}
45-
46-
type PullRequestInfo struct {
47-
HeadRepository struct {
48-
NameWithOwner string `json:"nameWithOwner"`
49-
} `json:"headRepository"`
50-
Number int `json:"number"`
51-
Title string `json:"title"`
52-
Url string `json:"url"`
53-
}
54-
55-
type CommitComparison struct {
56-
AheadBy int `json:"ahead_by"`
57-
BehindBy int `json:"behind_by"`
58-
}
59-
6019
func showSpinner(ctx context.Context, done chan bool) {
6120
spinner := []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}
6221
i := 0

types.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package main
2+
3+
type Owner struct {
4+
ID string `json:"id"`
5+
Login string `json:"login"`
6+
}
7+
8+
type Repo struct {
9+
Owner Owner `json:"owner"`
10+
NameWithOwner string `json:"nameWithOwner"`
11+
IsArchived bool `json:"isArchived"`
12+
UpdatedAt string `json:"updatedAt"`
13+
Parent struct {
14+
NameWithOwner string `json:"nameWithOwner"`
15+
DefaultBranchRef struct {
16+
Name string `json:"name"`
17+
Target struct {
18+
Oid string `json:"oid"`
19+
} `json:"target"`
20+
} `json:"defaultBranchRef"`
21+
} `json:"parent"`
22+
DefaultBranchRef struct {
23+
Name string `json:"name"`
24+
Target struct {
25+
Oid string `json:"oid"`
26+
} `json:"target"`
27+
} `json:"defaultBranchRef"`
28+
}
29+
30+
type PullRequestInfo struct {
31+
HeadRepository struct {
32+
NameWithOwner string `json:"nameWithOwner"`
33+
} `json:"headRepository"`
34+
Number int `json:"number"`
35+
Title string `json:"title"`
36+
Url string `json:"url"`
37+
}
38+
39+
type CommitComparison struct {
40+
AheadBy int `json:"ahead_by"`
41+
BehindBy int `json:"behind_by"`
42+
}

0 commit comments

Comments
 (0)