From 87e564e969c5881dfd379e8fceacf4c2dacba267 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Wed, 25 Sep 2013 23:29:35 +0200 Subject: [PATCH] Improved interface for create-report --- Duplicati/CommandLine/Commands.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Duplicati/CommandLine/Commands.cs b/Duplicati/CommandLine/Commands.cs index 481d0fc86..2d08bd76d 100644 --- a/Duplicati/CommandLine/Commands.cs +++ b/Duplicati/CommandLine/Commands.cs @@ -554,15 +554,14 @@ namespace Duplicati.CommandLine public static int CreateBugReport(List args, Dictionary options, Library.Utility.IFilter filter) { - if (args.Count != 2) - return PrintWrongNumberOfArguments(args, 2); - // Support for not adding the --auth-username if possible - string dbpath; + string dbpath = null; options.TryGetValue("dbpath", out dbpath); if (string.IsNullOrEmpty(dbpath)) { - dbpath = Library.Main.DatabaseLocator.GetDatabasePath(args[0], new Duplicati.Library.Main.Options(options), false, true); + if (args.Count > 0) + dbpath = Library.Main.DatabaseLocator.GetDatabasePath(args[0], new Duplicati.Library.Main.Options(options), false, true); + if (dbpath == null) { Console.WriteLine("No local database found, please add --{0}", "dbpath"); @@ -570,8 +569,14 @@ namespace Duplicati.CommandLine } else options["dbpath"] = dbpath; + } - + + if (args.Count == 0) + args = new List(new string[] { "file://unused", "report" }); + else if (args.Count == 1) + args.Add("report"); + using(var i = new Library.Main.Controller(args[0], options, new ConsoleOutput(options))) i.CreateLogDatabase(args[1]);