feat: Add GitRepoRegistration cmdlets #5
1 changed files with 21 additions and 1 deletions
chore(custom-host): Add way to manage PromptForChoice
commit
6ae34b3c83
|
|
@ -121,6 +121,19 @@ public class CustomUiHost : PSHostUserInterface
|
|||
|
||||
public string Output => output.ToString();
|
||||
|
||||
private int? _nextChoiceOption;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the next choice option to be used on the next call to <see cref="PromptForChoice"/>.
|
||||
///
|
||||
/// You'll probably get the
|
||||
/// </summary>
|
||||
/// <param name="choiceOption"></param>
|
||||
public void SetNextPromptChoice(int choiceOption)
|
||||
{
|
||||
_nextChoiceOption = choiceOption;
|
||||
}
|
||||
|
||||
public override Dictionary<string, PSObject> Prompt(string caption, string message, System.Collections.ObjectModel.Collection<FieldDescription> descriptions)
|
||||
{
|
||||
throw new NotImplementedException("Prompt is not implemented. The script is asking for input, which is a problem since there's no console. Make sure the script can execute without prompting the user for input.");
|
||||
|
|
@ -128,7 +141,14 @@ public class CustomUiHost : PSHostUserInterface
|
|||
|
||||
public override int PromptForChoice(string caption, string message, System.Collections.ObjectModel.Collection<ChoiceDescription> choices, int defaultChoice)
|
||||
{
|
||||
throw new NotImplementedException("PromptForChoice is not implemented. The script is asking for input, which is a problem since there's no console. Make sure the script can execute without prompting the user for input.");
|
||||
if (_nextChoiceOption is null)
|
||||
{
|
||||
throw new NotImplementedException("PromptForChoice is not implemented. The script is asking for input, which is a problem since there's no console. Make sure the script can execute without prompting the user for input.");
|
||||
}
|
||||
|
||||
var choiceReturn = _nextChoiceOption.Value;
|
||||
_nextChoiceOption = null;
|
||||
return choiceReturn;
|
||||
}
|
||||
|
||||
public override PSCredential PromptForCredential(string caption, string message, string userName, string targetName, PSCredentialTypes allowedCredentialTypes, PSCredentialUIOptions options)
|
||||
|
|
|
|||
Loading…
Reference in a new issue