From b025c9af015fbe58fbe7711425f86160ef8ba4a3 Mon Sep 17 00:00:00 2001 From: Carl Johnsen Date: Mon, 27 Jan 2025 21:25:18 +0100 Subject: [PATCH] Added passing all of the commandline options to the inner run method --- Tools/RemoteSynchronization/Program.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Tools/RemoteSynchronization/Program.cs b/Tools/RemoteSynchronization/Program.cs index 4972352ea..7e4d6c8dc 100644 --- a/Tools/RemoteSynchronization/Program.cs +++ b/Tools/RemoteSynchronization/Program.cs @@ -1,4 +1,4 @@ -// Copyright (C) 2025, The Duplicati Team +// Copyright (C) 2025, The Duplicati Team // https://duplicati.com, hello@duplicati.com // // Permission is hereby granted, free of charge, to any person obtaining a @@ -24,6 +24,7 @@ using Duplicati.Library.Interface; using System; using System.Collections.Generic; using System.CommandLine; +using System.CommandLine.Invocation; using System.IO; using System.Linq; using System.Threading; @@ -43,12 +44,19 @@ namespace RemoteSynchronization root_cmd.AddArgument(src_arg); root_cmd.AddArgument(dst_arg); - root_cmd.SetHandler(Run, src_arg, dst_arg); + root_cmd.SetHandler((InvocationContext ctx) => + { + var parsed = ctx.ParseResult; + + Dictionary options = parsed.CommandResult.Command.Options.ToDictionary(x => x.Name, x => parsed.GetValueForOption(x)); + + Run(parsed.GetValueForArgument(src_arg), parsed.GetValueForArgument(dst_arg), options).Wait(); + }); return await root_cmd.InvokeAsync(args); } - private static async Task Run(string src, string dst) + private static async Task Run(string src, string dst, Dictionary options) { var options = new Dictionary();