diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-02-17 14:15:12 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-02-17 14:15:12 -0600 |
| commit | c21b459f7dcc9c55260e5b3036a64083eeced140 (patch) | |
| tree | 20007e3b8b771a0db779f329ca08ccbe04cefcf2 /src | |
| parent | 8fdfc74c403f00425d2b56dd39bdc2d1e1a5fd18 (diff) | |
| download | slskd-c21b459f7dcc9c55260e5b3036a64083eeced140.tar.gz | |
document options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/Options.cs | 16 |
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"); } } } |
