1
0
Fork 0
mirror of https://github.com/Luzifer/cmd-slack.git synced 2024-12-22 10:41:23 +00:00

Added flag to add a description

This commit is contained in:
Knut Ahlers 2016-05-22 20:23:10 +02:00
parent b7074fdf7c
commit 850343fb2e
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -18,6 +18,7 @@ var (
Username string `flag:"username,u" default:"CmdSlack" description:"Username to use in WebHook command"`
Icon string `flag:"icon,i" default:":package:" description:"Icon to use for the webhook"`
Channel string `flag:"channel,c" default:"" description:"Channel to send the message to"`
Description string `flag:"description,d" default:"" description:"Add a piece of text to prepent to the output"`
}{}
version = "dev"
@ -46,11 +47,16 @@ func main() {
os.Exit(0)
}
text := "```\n" + buf.String() + "```"
if cfg.Description != "" {
text = cfg.Description + "\n" + text
}
slo := slack{
Username: cfg.Username,
Icon: cfg.Icon,
Channel: cfg.Channel,
Text: "```\n" + buf.String() + "```",
Text: text,
}
body := bytes.NewBuffer([]byte{})