-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple.go
39 lines (33 loc) · 1.22 KB
/
simple.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import "flag"
type simpleCmdData struct {
CFGLocation *string
head *string
title *string
title_url *string
body *string
color *string
fields fieldList
Debug *bool
}
func (this *simpleCmdData) Init(flagSet *flag.FlagSet) {
this.CFGLocation = flagSet.String("cfg", "/etc/sendmsg.yml", "Path to sendmsg config")
this.head = flagSet.String("head", "", "The header of the message to send (required)")
this.title = flagSet.String("title", "", "The title of the message to send (required)")
this.title_url = flagSet.String("title_url", "", "The url of the title of the message to send")
this.body = flagSet.String("body", "", "The body of the message to send")
this.color = flagSet.String("color", "", "The color of the message to send")
flagSet.Var(&this.fields, "fields", "A comma seperated list of fields (name:text) to be added")
this.Debug = flagSet.Bool("debug", false, "Whether to print verbose debug messages")
}
func (this *simpleCmdData) Parse() Message {
var msg Message
msg.Body = *this.body
msg.Head = *this.head
msg.Color = *this.color
msg.Body_title = *this.title
msg.Body_link = *this.title_url
msg.Fields = this.fields
msg.Frontend = "simple"
return msg
}