Go fmt
This commit is contained in:
@ -18,6 +18,7 @@ func color(c int) string {
|
|||||||
return fmt.Sprintf("\033[0;%dm", 29+c)
|
return fmt.Sprintf("\033[0;%dm", 29+c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO maybe make the text into some datastructure which remembers the color
|
// TODO maybe make the text into some datastructure which remembers the color
|
||||||
func colorText(text string, color string, offColor string) string {
|
func colorText(text string, color string, offColor string) string {
|
||||||
return fmt.Sprintf("%s%s%s", color, text, offColor)
|
return fmt.Sprintf("%s%s%s", color, text, offColor)
|
||||||
|
|||||||
12
main.go
12
main.go
@ -143,7 +143,7 @@ func sendChat(message string) {
|
|||||||
func formatOutput(api keybase.ChatAPI) string {
|
func formatOutput(api keybase.ChatAPI) string {
|
||||||
ret := ""
|
ret := ""
|
||||||
msgType := api.Msg.Content.Type
|
msgType := api.Msg.Content.Type
|
||||||
switch (msgType) {
|
switch msgType {
|
||||||
case "text", "attachment":
|
case "text", "attachment":
|
||||||
var c = messageHeaderColor
|
var c = messageHeaderColor
|
||||||
ret = colorText(outputFormat, c, noColor)
|
ret = colorText(outputFormat, c, noColor)
|
||||||
@ -153,7 +153,7 @@ func formatOutput(api keybase.ChatAPI) string {
|
|||||||
msg = colorRegex(msg, `(@\w*(\.\w+)*)`, messageLinkColor, messageBodyColor)
|
msg = colorRegex(msg, `(@\w*(\.\w+)*)`, messageLinkColor, messageBodyColor)
|
||||||
// mention URL
|
// mention URL
|
||||||
msg = colorRegex(msg, `(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))`, messageLinkColor, messageBodyColor)
|
msg = colorRegex(msg, `(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))`, messageLinkColor, messageBodyColor)
|
||||||
msg = colorText(colorReplaceMentionMe(msg, messageBodyColor), messageBodyColor,c)
|
msg = colorText(colorReplaceMentionMe(msg, messageBodyColor), messageBodyColor, c)
|
||||||
if msgType == "attachment" {
|
if msgType == "attachment" {
|
||||||
msg = fmt.Sprintf("%s\n%s", msg, colorText("[Attachment]", messageAttachmentColor, c))
|
msg = fmt.Sprintf("%s\n%s", msg, colorText("[Attachment]", messageAttachmentColor, c))
|
||||||
}
|
}
|
||||||
@ -180,9 +180,9 @@ func populateList() {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
clearView("List")
|
clearView("List")
|
||||||
var recentPMs = fmt.Sprintf("%s---[PMs]---%s\n", channelsHeaderColor, channelsColor);
|
var recentPMs = fmt.Sprintf("%s---[PMs]---%s\n", channelsHeaderColor, channelsColor)
|
||||||
var recentPMsCount = 0
|
var recentPMsCount = 0
|
||||||
var recentChannels = fmt.Sprintf("%s---[Teams]---%s\n", channelsHeaderColor, channelsColor);
|
var recentChannels = fmt.Sprintf("%s---[Teams]---%s\n", channelsHeaderColor, channelsColor)
|
||||||
var recentChannelsCount = 0
|
var recentChannelsCount = 0
|
||||||
for _, s := range testVar.Result.Conversations {
|
for _, s := range testVar.Result.Conversations {
|
||||||
channels = append(channels, s.Channel)
|
channels = append(channels, s.Channel)
|
||||||
@ -190,7 +190,7 @@ func populateList() {
|
|||||||
recentChannelsCount++
|
recentChannelsCount++
|
||||||
if recentChannelsCount <= ((maxY - 2) / 3) {
|
if recentChannelsCount <= ((maxY - 2) / 3) {
|
||||||
if s.Unread {
|
if s.Unread {
|
||||||
recentChannels += fmt.Sprintf("%s*",color(0))
|
recentChannels += fmt.Sprintf("%s*", color(0))
|
||||||
}
|
}
|
||||||
recentChannels += fmt.Sprintf("%s\n\t#%s\n%s", s.Channel.Name, s.Channel.TopicName, channelsColor)
|
recentChannels += fmt.Sprintf("%s\n\t#%s\n%s", s.Channel.Name, s.Channel.TopicName, channelsColor)
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ func populateList() {
|
|||||||
recentPMsCount++
|
recentPMsCount++
|
||||||
if recentPMsCount <= ((maxY - 2) / 3) {
|
if recentPMsCount <= ((maxY - 2) / 3) {
|
||||||
if s.Unread {
|
if s.Unread {
|
||||||
recentChannels += fmt.Sprintf("%s*",color(0))
|
recentChannels += fmt.Sprintf("%s*", color(0))
|
||||||
}
|
}
|
||||||
recentPMs += fmt.Sprintf("%s\n%s", cleanChannelName(s.Channel.Name), channelsColor)
|
recentPMs += fmt.Sprintf("%s\n%s", cleanChannelName(s.Channel.Name), channelsColor)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// Path where Downloaded files will default to
|
// Path where Downloaded files will default to
|
||||||
var downloadPath = "/tmp/"
|
var downloadPath = "/tmp/"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user