1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Display OpsGenie oncall data for one specific schedule

This commit is contained in:
Chris Cummer
2018-04-02 21:41:46 -07:00
committed by Chris Cummer
parent 62502c24d0
commit 945dfc8db7
6 changed files with 71 additions and 38 deletions

View File

@@ -9,13 +9,11 @@ import (
type Client struct {
CommitCount int
Repository string
}
func NewClient() *Client {
client := Client{
CommitCount: 10,
Repository: "/Users/Chris/Documents/Lendesk/core-api",
}
return &client
@@ -23,7 +21,7 @@ func NewClient() *Client {
/* -------------------- Unexported Functions -------------------- */
func (client *Client) CurrentBranch() string {
func (client *Client) Branch() string {
arg := []string{"rev-parse", "--abbrev-ref", "HEAD"}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
@@ -50,3 +48,11 @@ func (client *Client) Commits() []string {
return data
}
func (client *Client) Repository() string {
arg := []string{"rev-parse", "--show-toplevel"}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
return str
}

View File

@@ -7,8 +7,8 @@ func Fetch() map[string][]string {
result := make(map[string][]string)
result["repo"] = []string{client.Repository}
result["branch"] = []string{client.CurrentBranch()}
result["repo"] = []string{client.Repository()}
result["branch"] = []string{client.Branch()}
result["changes"] = client.ChangedFiles()
result["commits"] = client.Commits()