From f5e07dec6bcd956fea98b50fade12b7dc26f7ea6 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Wed, 13 May 2026 15:42:36 +0200 Subject: [PATCH] Hide test options This PR hides the `--unittest-mode` option that is used to treat all warnings as errors which is helpful when testing things, but is not intended to be used elsewhere. The option is simply not shown in the list of supported options but still works in case anyone wants to use it. --- Duplicati/Library/Main/Options.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Duplicati/Library/Main/Options.cs b/Duplicati/Library/Main/Options.cs index 99a6a8310..3e94396e6 100644 --- a/Duplicati/Library/Main/Options.cs +++ b/Duplicati/Library/Main/Options.cs @@ -391,6 +391,14 @@ namespace Duplicati.Library.Main } } + private IEnumerable GetDebugConditionalCommands() + { +#if DEBUG + yield return new CommandLineArgument("unittest-mode", CommandLineArgument.ArgumentType.Boolean, Strings.Options.UnittestmodeShort, Strings.Options.UnittestmodeLong, "false"); +#endif + yield break; + } + /// /// Gets all supported commands /// @@ -398,7 +406,6 @@ namespace Duplicati.Library.Main [ new CommandLineArgument("dblock-size", CommandLineArgument.ArgumentType.Size, Strings.Options.DblocksizeShort, Strings.Options.DblocksizeLong, DEFAULT_VOLUME_SIZE, ["remote-volume-size"]), new CommandLineArgument("auto-cleanup", CommandLineArgument.ArgumentType.Boolean, Strings.Options.AutocleanupShort, Strings.Options.AutocleanupLong, "false"), - new CommandLineArgument("unittest-mode", CommandLineArgument.ArgumentType.Boolean, Strings.Options.UnittestmodeShort, Strings.Options.UnittestmodeLong, "false"), new CommandLineArgument("control-files", CommandLineArgument.ArgumentType.Path, Strings.Options.ControlfilesShort, Strings.Options.ControlfilesLong), new CommandLineArgument("skip-file-hash-checks", CommandLineArgument.ArgumentType.Boolean, Strings.Options.SkipfilehashchecksShort, Strings.Options.SkipfilehashchecksLong, "false"), @@ -596,7 +603,8 @@ namespace Duplicati.Library.Main new CommandLineArgument("internal-profiling", CommandLineArgument.ArgumentType.Boolean, Strings.Options.InternalProfilingShort, Strings.Options.InternalProfilingLong, "false"), new CommandLineArgument("ignore-update-if-version-exists", CommandLineArgument.ArgumentType.Boolean, Strings.Options.IgnoreUpdateIfVersionExistsShort, Strings.Options.IgnoreUpdateIfVersionExistsLong, "false"), - .. GetOSConditionalCommands() + .. GetOSConditionalCommands(), + .. GetDebugConditionalCommands(), ]; ///