From 8c443b2fe6240c8f666f4781b1b21579ff8523b6 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 23 Feb 2025 16:46:17 -0600 Subject: add ArgsList --- src/slskd/Core/Options.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 6f8e5682..440cd8a4 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -2178,8 +2178,19 @@ namespace slskd /// /// Gets the arguments to pass to the executable. /// + /// + /// Mutually exclusive with . + /// public string Args { get; init; } + /// + /// Gets the list of arguments to pass to the executable. + /// + /// + /// Mutually exclusive with . + /// + public string[] ArgsList { get; init; } = null; + public IEnumerable Validate(ValidationContext validationContext) { var cmdIsSet = !string.IsNullOrWhiteSpace(Command); @@ -2189,6 +2200,14 @@ namespace slskd { yield return new ValidationResult($"One and only one of the fields {nameof(Command)} or {nameof(Executable)} may be specified for a single script"); } + + var argsIsSet = !string.IsNullOrWhiteSpace(Args); + var argsListIsSet = ArgsList is not null; + + if (argsIsSet && argsListIsSet) + { + yield return new ValidationResult($"Only one of the fields {nameof(Args)} or {nameof(ArgsList)} may be specified for a single script"); + } } } -- cgit v1.2.3