aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-02-17 14:15:12 -0600
committerJP Dillingham <jp@dillingham.me>2025-02-17 14:15:12 -0600
commitc21b459f7dcc9c55260e5b3036a64083eeced140 (patch)
tree20007e3b8b771a0db779f329ca08ccbe04cefcf2 /src
parent8fdfc74c403f00425d2b56dd39bdc2d1e1a5fd18 (diff)
downloadslskd-c21b459f7dcc9c55260e5b3036a64083eeced140.tar.gz
document options
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/Options.cs16
1 files changed, 12 insertions, 4 deletions
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
@@ -2166,20 +2166,28 @@ namespace slskd
public class ScriptRunOptions : IValidatableObject
{
/// <summary>
+ /// Gets the shell command to run.
+ /// </summary>
+ public string Command { get; init; }
+
+ /// <summary>
/// Gets the executable to start.
/// </summary>
public string Executable { get; init; }
/// <summary>
- /// Gets the command to run.
+ /// Gets the arguments to pass to the executable.
/// </summary>
- public string Command { get; init; }
+ public string Args { get; init; }
public IEnumerable<ValidationResult> 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");
}
}
}