From 31850c99011cf3fb0adb769bc7546c61c234f55d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= <tseeker@nocternity.net>
Date: Sat, 27 Feb 2021 10:54:40 +0100
Subject: [PATCH] Plugin - Accept format strings+data for AddLine

Most calls were being made from fmt.Sprintf() anyway, so it was clear
this required formatted input.
---
 plugin/plugin.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugin/plugin.go b/plugin/plugin.go
index 5cacbb5..eee5be9 100644
--- a/plugin/plugin.go
+++ b/plugin/plugin.go
@@ -58,17 +58,17 @@ func (p *Plugin) SetState(status Status, message string) {
 }
 
 // AddLine adds the specified string to the extra output text buffer.
-func (p *Plugin) AddLine(line string) {
+func (p *Plugin) AddLine(format string, data ...interface{}) {
 	if p.extraText == nil {
 		p.extraText = list.New()
 	}
-	p.extraText.PushBack(line)
+	p.extraText.PushBack(fmt.Sprintf(format, data...))
 }
 
 // AddLines add the specified `lines` to the output text.
 func (p *Plugin) AddLines(lines []string) {
 	for _, line := range lines {
-		p.AddLine(line)
+		p.AddLine("%s", line)
 	}
 }