From df620acc90692cdf7633d24b2b7d2e4db655aec7 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Sun, 24 Nov 2024 06:00:52 +0100 Subject: [PATCH] fix(tooling): nullable options --- source/Nuke.Tooling/ToolTasks.Run.cs | 6 +++--- source/Nuke.Tooling/ToolTasks.cs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/Nuke.Tooling/ToolTasks.Run.cs b/source/Nuke.Tooling/ToolTasks.Run.cs index 0d72e7a3b..79db7f372 100644 --- a/source/Nuke.Tooling/ToolTasks.Run.cs +++ b/source/Nuke.Tooling/ToolTasks.Run.cs @@ -12,9 +12,9 @@ namespace Nuke.Common.Tooling; partial class ToolTasks { - protected virtual IReadOnlyCollection Run(ToolOptions options) + protected virtual partial IReadOnlyCollection Run(ToolOptions options) { - var secrets = options.GetSecrets().ToList(); + var secrets = options?.GetSecrets().ToList() ?? []; string Filter(string text) => secrets.Aggregate(text, (str, s) => str.Replace(s, "[REDACTED]")); options = PreProcess(options); @@ -35,7 +35,7 @@ protected virtual IReadOnlyCollection Run(ToolOptions options) return process.Output; } - protected virtual (TResult Result, IReadOnlyCollection Output) Run(ToolOptions options) + protected virtual partial (TResult Result, IReadOnlyCollection Output) Run(ToolOptions options) { var output = Run(options); try diff --git a/source/Nuke.Tooling/ToolTasks.cs b/source/Nuke.Tooling/ToolTasks.cs index fca2dd3e8..5d2c900ee 100644 --- a/source/Nuke.Tooling/ToolTasks.cs +++ b/source/Nuke.Tooling/ToolTasks.cs @@ -17,6 +17,8 @@ public abstract partial class ToolTasks protected internal virtual partial Action GetLogger(ToolOptions options = null); protected virtual partial string GetToolPath(ToolOptions options = null); + protected virtual partial IReadOnlyCollection Run(ToolOptions options = null); + protected virtual partial (TResult Result, IReadOnlyCollection Output) Run(ToolOptions options = null); protected virtual partial Func GetExitHandler(ToolOptions options = null); protected virtual ToolOptions PreProcess(ToolOptions options) => options;