mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Basic New Relic deploy info
This commit is contained in:
committed by
Chris Cummer
parent
a82db2bea8
commit
6303acc9a4
25
wtf/utils.go
25
wtf/utils.go
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -34,6 +35,30 @@ func ExecuteCommand(cmd *exec.Cmd) string {
|
||||
return str
|
||||
}
|
||||
|
||||
func Exclude(strs []string, val string) bool {
|
||||
for _, str := range strs {
|
||||
if val == str {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func NameFromEmail(email string) string {
|
||||
parts := strings.Split(email, "@")
|
||||
return strings.Title(strings.Replace(parts[0], ".", " ", -1))
|
||||
}
|
||||
|
||||
func NamesFromEmails(emails []string) []string {
|
||||
names := []string{}
|
||||
|
||||
for _, email := range emails {
|
||||
names = append(names, NameFromEmail(email))
|
||||
}
|
||||
|
||||
return names
|
||||
}
|
||||
|
||||
func PrettyDate(dateStr string) string {
|
||||
newTime, _ := time.Parse(DateFormat, dateStr)
|
||||
return fmt.Sprint(newTime.Format("Jan 2, 2006"))
|
||||
|
||||
Reference in New Issue
Block a user