summaryrefslogtreecommitdiffstats
path: root/src/main.lib/Services/InputService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.lib/Services/InputService.cs')
-rw-r--r--src/main.lib/Services/InputService.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.lib/Services/InputService.cs b/src/main.lib/Services/InputService.cs
index 0dd4ed2..06416d3 100644
--- a/src/main.lib/Services/InputService.cs
+++ b/src/main.lib/Services/InputService.cs
@@ -339,7 +339,7 @@ namespace PKISharp.WACS.Services
/// Print a (paged) list of choices for the user to choose from
/// </summary>
/// <param name="choices"></param>
- public async Task<T> ChooseFromMenu<T>(string what, List<Choice<T>> choices)
+ public async Task<T> ChooseFromMenu<T>(string what, List<Choice<T>> choices, Func<string, Choice<T>>? unexpected = null)
{
if (!choices.Any())
{
@@ -379,6 +379,11 @@ namespace PKISharp.WACS.Services
_log.Warning($"The option you have chosen is currently disabled. {disabledReason}");
selected = null;
}
+
+ if (selected == null && unexpected != null)
+ {
+ selected = unexpected(choice);
+ }
}
} while (selected == null);
return selected.Item;