Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-8) Refine Posh Prompting
  • Loading branch information
ferventcoder committed Mar 14, 2016
2 parents 7ff95f7 + 7c2a76c commit 90e229b
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ private static string[] get_hotkey_and_label(string input)

public override int PromptForChoice(string caption, string message, Collection<ChoiceDescription> choices, int defaultChoice)
{
this.Log().Warn(caption.escape_curly_braces());
if (!string.IsNullOrWhiteSpace(caption)) this.Log().Warn(caption.escape_curly_braces());
if (!string.IsNullOrWhiteSpace(message)) this.Log().Warn(ChocolateyLoggers.Important, message.escape_curly_braces());

string[,] promptData = build_hotkeys_and_plain_labels(choices);

Expand All @@ -208,14 +209,14 @@ public override int PromptForChoice(string caption, string message, Collection<C
{
choicePrompt.Append(String.Format(
CultureInfo.CurrentCulture,
"|{0}> {1} ",
"[{0}] {1} ",
promptData[0, element],
promptData[1, element]));
}

choicePrompt.Append(String.Format(
CultureInfo.CurrentCulture,
"[Default is ({0}]",
"(default is \"{0}\")",
promptData[0, defaultChoice]));

while (true)
Expand Down Expand Up @@ -255,7 +256,9 @@ public override PSCredential PromptForCredential(string caption, string message,

public override PSCredential PromptForCredential(string caption, string message, string userName, string targetName, PSCredentialTypes allowedCredentialTypes, PSCredentialUIOptions options)
{
this.Log().Warn(caption.escape_curly_braces());
if (!string.IsNullOrWhiteSpace(caption)) this.Log().Warn(caption.escape_curly_braces());
if (!string.IsNullOrWhiteSpace(message)) this.Log().Warn(ChocolateyLoggers.Important, message.escape_curly_braces());

if (string.IsNullOrWhiteSpace(userName))
{
this.Log().Warn("Please provide username:");
Expand Down

0 comments on commit 90e229b

Please sign in to comment.