Skip to content

Commit

Permalink
(GH-185) Remove console prompt default choices
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrondeau authored and ferventcoder committed Apr 13, 2015
1 parent 1502208 commit 900c23a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/chocolatey/infrastructure.app/runners/GenericRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ require admin rights. Only advanced users should run choco w/out an
elevated shell. When you open the command shell, you should ensure
that you do so with ""Run as Administrator"" selected.
Do you want to continue?", new[] { "yes", "no" }, "no", requireAnswer: true);
Do you want to continue?", new[] { "yes", "no" }, defaultChoice: null, requireAnswer: true);

if (selection.is_equal_to("no"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ private void rollback_previous_version(ChocolateyConfiguration config, PackageRe
var rollback = true;
if (config.PromptForConfirmation)
{
var selection = InteractivePrompt.prompt_for_confirmation(" Unsuccessful operation for {0}.{1} Do you want to rollback to previous version (package files only)?".format_with(packageResult.Name, Environment.NewLine), new[] { "yes", "no" }, "yes", requireAnswer: true);
var selection = InteractivePrompt.prompt_for_confirmation(" Unsuccessful operation for {0}.{1} Do you want to rollback to previous version (package files only)?".format_with(packageResult.Name, Environment.NewLine), new[] { "yes", "no" }, defaultChoice: null, requireAnswer: true);
if (selection.is_equal_to("no")) rollback = false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ public ConcurrentDictionary<string, PackageResult> uninstall_run(ChocolateyConfi
choices.Add(allVersionsChoice);
}

var selection = InteractivePrompt.prompt_for_confirmation("Which version of {0} would you like to uninstall?".format_with(packageName), choices, abortChoice, true);
var selection = InteractivePrompt.prompt_for_confirmation("Which version of {0} would you like to uninstall?".format_with(packageName), choices, defaultChoice: null, requireAnswer: true);

if (string.IsNullOrWhiteSpace(selection)) continue;
if (selection.is_equal_to(abortChoice)) continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ public bool run_action(ChocolateyConfiguration configuration, PackageResult pack
this.Log().Info(ChocolateyLoggers.Important, () => "The package {0} wants to run '{1}'.".format_with(package.Id, _fileSystem.get_file_name(chocoPowerShellScript)));
this.Log().Info(ChocolateyLoggers.Important, () => "Note: If you don't run this script, the installation will fail.");

var selection = InteractivePrompt.prompt_for_confirmation(@"Do you want to run the script?", new[] {"yes", "no", "print"}, "no", requireAnswer: true);
var selection = InteractivePrompt.prompt_for_confirmation(@"Do you want to run the script?", new[] {"yes", "no", "print"}, defaultChoice: null, requireAnswer: true);

if (selection.is_equal_to("print"))
{
this.Log().Info(ChocolateyLoggers.Important, "------ BEGIN SCRIPT ------");
this.Log().Info(() => "{0}{1}{0}".format_with(Environment.NewLine, chocoPowerShellScriptContents.escape_curly_braces()));
this.Log().Info(ChocolateyLoggers.Important, "------- END SCRIPT -------");
selection = InteractivePrompt.prompt_for_confirmation(@"Do you want to run this script?", new[] { "yes", "no" }, "no", requireAnswer: true);
selection = InteractivePrompt.prompt_for_confirmation(@"Do you want to run this script?", new[] { "yes", "no" }, defaultChoice: null, requireAnswer: true);
}

if (selection.is_equal_to("yes")) shouldRun = true;
Expand Down

0 comments on commit 900c23a

Please sign in to comment.