Skip to content

Commit 03876be

Browse files
lemonlambdagep13
authored andcommitted
(#2848) Removed [A]ll - yes to all
After some discussion with the Chocolatey team, it has been decided that the prompt option for "All - yes to all" is rather verbose, and the need to include "yes to all" is unneeded, and not in line with how other package managers do it when prompted with similar choices. This commit removes the "All - yes to all" and replaces it with simply "All scripts", which is more succinct. In addition, the unit/pester tests have been updated to reflect this change. It was necessary to remove a unit test, since in the previous prompt "all - yes to all" was actually treated as two options, split on the "-", i.e. both "all" and "all - yes to all" were accepted answers to the prompt. This is no longer the case when the option is "All scripts", so only one unit test is now required.
1 parent e3d4af7 commit 03876be

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ public class When_prompting_answer_with_dash_with_interactivePrompt : Interactiv
666666
public override void Context()
667667
{
668668
base.Context();
669-
Choices.Add("all - yes to all");
669+
Choices.Add("all scripts");
670670
}
671671

672672
public override void Because()
@@ -683,17 +683,9 @@ public override void AfterObservations()
683683
[Fact]
684684
public void Should_return_all_when_full_all_answer_is_given()
685685
{
686-
Console.Setup(c => c.ReadLine()).Returns("all - yes to all");
686+
Console.Setup(c => c.ReadLine()).Returns("all scripts");
687687
var result = _prompt();
688-
result.Should().Be("all - yes to all");
689-
}
690-
691-
[Fact]
692-
public void Should_return_all_when_only_all_is_given()
693-
{
694-
Console.Setup(c => c.ReadLine()).Returns("all");
695-
var result = _prompt();
696-
result.Should().Be("all - yes to all");
688+
result.Should().Be("all scripts");
697689
}
698690
}
699691
}

src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void RevertChanges(bool removeBackup = false)
125125
if (property.Name == "PromptForConfirmation")
126126
{
127127
// We do not overwrite this value between backups as it is intended to be a global setting;
128-
// if a user has selected a "[A] yes to all" prompt interactively, this option is
128+
// if a user has selected a "[A]ll scripts" prompt interactively, this option is
129129
// set and should be retained for the duration of the operations.
130130
continue;
131131
}

src/chocolatey/infrastructure.app/services/PowershellService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public bool RunAction(ChocolateyConfiguration configuration, PackageResult packa
279279
this.Log().Info(ChocolateyLoggers.Important, () => @"choco feature enable -n allowGlobalConfirmation");
280280

281281
var selection = InteractivePrompt.PromptForConfirmation(@"Do you want to run the script?",
282-
new[] { "yes", "all - yes to all", "no", "print" },
282+
new[] { "yes", "all scripts", "no", "print" },
283283
defaultChoice: null,
284284
requireAnswer: true,
285285
allowShortAnswer: true,
@@ -305,7 +305,7 @@ public bool RunAction(ChocolateyConfiguration configuration, PackageResult packa
305305
shouldRun = true;
306306
}
307307

308-
if (selection.IsEqualTo("all - yes to all"))
308+
if (selection.IsEqualTo("all scripts"))
309309
{
310310
configuration.PromptForConfirmation = false;
311311
shouldRun = true;

tests/pester-tests/commands/choco-install.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,8 +1704,8 @@ To install a local, or remote file, you may use:
17041704
}
17051705
}
17061706

1707-
It "Ran both installation scripts after selecting [A] Yes to all at the first prompt" {
1708-
$promptLine = "Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint):"
1707+
It "Ran both installation scripts after selecting [A]ll scripts at the first prompt" {
1708+
$promptLine = "Do you want to run the script?([Y]es/[A]ll scripts/[N]o/[P]rint):"
17091709
$prompts = $Output.Lines | Where-Object { $_ -eq $promptLine }
17101710

17111711
$prompts.Count | Should -Be 1

0 commit comments

Comments
 (0)