From 34b5a8f570319572308c1006a2a954db3ec9e395 Mon Sep 17 00:00:00 2001 From: Andrej Benz Date: Thu, 14 Nov 2024 07:09:22 +0100 Subject: [PATCH] calc: minor --- internal/modules/calc.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/modules/calc.go b/internal/modules/calc.go index c2e740a..16c3815 100644 --- a/internal/modules/calc.go +++ b/internal/modules/calc.go @@ -49,16 +49,18 @@ func (c *Calc) Setup(cfg *config.Config) bool { func (c *Calc) SetupData(cfg *config.Config, ctx context.Context) {} func (c Calc) Entries(ctx context.Context, term string) []util.Entry { - hasNumber := false + if c.requireNumber { + hasNumber := false - for _, c := range term { - if unicode.IsDigit(c) { - hasNumber = true + for _, c := range term { + if unicode.IsDigit(c) { + hasNumber = true + } } - } - if !hasNumber { - return []util.Entry{} + if !hasNumber { + return []util.Entry{} + } } entries := []util.Entry{}