diff --git a/Duplicati/CommandLine/Commands.cs b/Duplicati/CommandLine/Commands.cs index 8fbed1b63..f569d9ed9 100644 --- a/Duplicati/CommandLine/Commands.cs +++ b/Duplicati/CommandLine/Commands.cs @@ -695,6 +695,26 @@ namespace Duplicati.CommandLine return 0; } + + public static int TestFilters(List args, Dictionary options, Library.Utility.IFilter filter) + { + if (args == null || args.Count < 1) + { + Console.WriteLine("No source paths given"); + return 200; + } + + options["verbose"] = "true"; + + using(var i = new Library.Main.Controller("dummy://", options, new ConsoleOutput(options))) + { + var result = i.TestFilter(args.ToArray(), filter); + + Console.WriteLine("Matched {0} files ({1})", result.FileCount, Duplicati.Library.Utility.Utility.FormatSizeString(result.FileSize)); + } + + return 0; + } } } diff --git a/Duplicati/CommandLine/Program.cs b/Duplicati/CommandLine/Program.cs index 5d430f17b..e3406ffc5 100644 --- a/Duplicati/CommandLine/Program.cs +++ b/Duplicati/CommandLine/Program.cs @@ -183,6 +183,7 @@ namespace Duplicati.CommandLine knownCommands["compare"] = Commands.ListChanges; knownCommands["test"] = Commands.Test; knownCommands["verify"] = Commands.Test; + knownCommands["test-filters"] = Commands.TestFilters; if (verbose) { diff --git a/Duplicati/CommandLine/help.txt b/Duplicati/CommandLine/help.txt index 195181e42..4919d9796 100644 --- a/Duplicati/CommandLine/help.txt +++ b/Duplicati/CommandLine/help.txt @@ -1,403 +1,412 @@ -# This file is the help for the Duplicati Command Line Client. It shows what -# commands the CLI understands and what the outputs are. Sometimes we used -# placeholders for options. In that case descriptions are taken directly from -# the modules. Sometimes we described options here. The reason for that is, -# that we found the new description much better but did not want to create a -# need for translation as many options are described in the UI as well and -# they are translated there. -# ============================================================================= -> duplicati.commandline.exe -> duplicati.commandline.exe help - -See duplicati.commandline.exe help for more information. - Examples: example - Commands: backup, find, restore, delete, compact, test, compare, repair - Debugging: debug, logging, create-report - Targets: %BACKENDS% - Modules: %ENCRYPTIONMODULES%, %COMPRESSIONMODULES%, %GENERICMODULES% - Formats: date, time, size, encryption, compression - Advanced: mail, advanced, returncodes, filter,