From c21b459f7dcc9c55260e5b3036a64083eeced140 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 17 Feb 2025 14:15:12 -0600 Subject: document options --- src/slskd/Core/Options.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 183fcbe5..6f8e5682 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -2165,21 +2165,29 @@ namespace slskd /// public class ScriptRunOptions : IValidatableObject { + /// + /// Gets the shell command to run. + /// + public string Command { get; init; } + /// /// Gets the executable to start. /// public string Executable { get; init; } /// - /// Gets the command to run. + /// Gets the arguments to pass to the executable. /// - public string Command { get; init; } + public string Args { get; init; } public IEnumerable Validate(ValidationContext validationContext) { - if (string.IsNullOrWhiteSpace(Executable) && string.IsNullOrWhiteSpace(Command)) + var cmdIsSet = !string.IsNullOrWhiteSpace(Command); + var exeIsSet = !string.IsNullOrWhiteSpace(Executable); + + if ((cmdIsSet && exeIsSet) || (!cmdIsSet && !exeIsSet)) { - yield return new ValidationResult($"At least one of the {nameof(Executable)} and {nameof(Command)} fields must be specified"); + yield return new ValidationResult($"One and only one of the fields {nameof(Command)} or {nameof(Executable)} may be specified for a single script"); } } } -- cgit v1.2.3