From f9c826fd63b2deda6e1ebe1b0c8c83b52828ef92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20B=C3=A4riswyl?= Date: Thu, 17 Aug 2023 15:16:22 +0200 Subject: [PATCH] Only append some parameters if they are set --- gttools/mvn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gttools/mvn.go b/gttools/mvn.go index 759166d..8b50f7c 100644 --- a/gttools/mvn.go +++ b/gttools/mvn.go @@ -38,8 +38,8 @@ type MvnRunSettings struct { func (tool *MvnTool) Run(settings MvnRunSettings) error { args := []string{} args = append(args, settings.Phases...) - args = append(args, "--projects", strings.Join(settings.Projects, ",")) - args = append(args, "--activate-profiles", strings.Join(settings.ActivateProfiles, ",")) + args = goext.AppendIf(args, len(settings.Projects) > 0, "--projects", strings.Join(settings.Projects, ",")) + args = goext.AppendIf(args, len(settings.ActivateProfiles) > 0, "--activate-profiles", strings.Join(settings.ActivateProfiles, ",")) args = goext.AppendIf(args, settings.AlsoMake, "--also-make") args = goext.AppendIf(args, settings.BatchMode, "--batch-mode") args = goext.AppendIf(args, settings.Debug, "--debug")