From f14dfcdc873d595b9ab8cd8dedc0739ef83949cb Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 28 Jun 2016 19:36:18 +0200 Subject: [PATCH] Add static badge plugin --- service_static.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 service_static.go diff --git a/service_static.go b/service_static.go new file mode 100644 index 0000000..dbd2c68 --- /dev/null +++ b/service_static.go @@ -0,0 +1,21 @@ +package main + +import "errors" + +func init() { + registerServiceHandler("static", func(params []string) (title, text, color string, err error) { + if len(params) < 2 { + err = errors.New("You need to provide title and text") + return + } + + if len(params) < 3 { + params = append(params, defaultColor) + } + + title = params[0] + text = params[1] + color = params[2] + return + }) +}