diff options
Diffstat (limited to 'src/main.lib/Services/Interfaces/IInputService.cs')
-rw-r--r-- | src/main.lib/Services/Interfaces/IInputService.cs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.lib/Services/Interfaces/IInputService.cs b/src/main.lib/Services/Interfaces/IInputService.cs index 78d155c..b59f82c 100644 --- a/src/main.lib/Services/Interfaces/IInputService.cs +++ b/src/main.lib/Services/Interfaces/IInputService.cs @@ -8,7 +8,7 @@ namespace PKISharp.WACS.Services { Task<TResult?> ChooseOptional<TSource, TResult>(string what, IEnumerable<TSource> options, Func<TSource, Choice<TResult?>> creator, string nullChoiceLabel) where TResult : class; Task<TResult> ChooseRequired<TSource, TResult>(string what, IEnumerable<TSource> options, Func<TSource, Choice<TResult>> creator); - Task<TResult> ChooseFromMenu<TResult>(string what, List<Choice<TResult>> choices); + Task<TResult> ChooseFromMenu<TResult>(string what, List<Choice<TResult>> choices, Func<string, Choice<TResult>>? unexpected = null); Task<bool> PromptYesNo(string message, bool defaultOption); Task<string?> ReadPassword(string what); Task<string> RequestString(string what); @@ -27,11 +27,14 @@ namespace PKISharp.WACS.Services string? description = null, string? command = null, bool @default = false, - bool disabled = false, - string? disabledReason = null, + (bool, string?)? disabled = null, ConsoleColor? color = null) { var newItem = new Choice<TItem>(item); + if (disabled == null) + { + disabled = (false, null); + } // Default description is item.ToString, but it may // be overruled by the optional parameter here if (!string.IsNullOrEmpty(description)) @@ -40,8 +43,8 @@ namespace PKISharp.WACS.Services } newItem.Command = command; newItem.Color = color; - newItem.Disabled = disabled; - newItem.DisabledReason = disabledReason; + newItem.Disabled = disabled.Value.Item1; + newItem.DisabledReason = disabled.Value.Item2; newItem.Default = @default; return newItem; } |