diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/Options.cs | 19 |
1 files changed, 19 insertions, 0 deletions
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 /// <summary> /// Gets the arguments to pass to the executable. /// </summary> + /// <remarks> + /// Mutually exclusive with <see cref="ArgsList"/>. + /// </remarks> public string Args { get; init; } + /// <summary> + /// Gets the list of arguments to pass to the executable. + /// </summary> + /// <remarks> + /// Mutually exclusive with <see cref="Args"/>. + /// </remarks> + public string[] ArgsList { get; init; } = null; + public IEnumerable<ValidationResult> 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"); + } } } |
