Skip to content

Commit 9f49de8

Browse files
authored
Merge pull request #2398 from ActiveState/mitchell/dx-1612
Use different messages for `state clean uninstall` depending on whether or not `--all` is present.
2 parents a5658f9 + 6ec66bd commit 9f49de8

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

internal/locale/locales/en-us.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,12 @@ err_clean_cache_activated:
13751375
err_clean_config_activated:
13761376
other: Cannot remove the config directory while in an activated state. Please deactivate by entering [ACTIONABLE]exit[/RESET] or pressing [ACTIONABLE]Ctrl+D[/RESET] and then try again.
13771377
uninstall_confirm:
1378+
other: |
1379+
You are about to remove the State Tool.
1380+
Your config and cache files will remain.
1381+
If you would also like to remove those files, add the [ACTIONABLE]--all[/RESET] flag.
1382+
Continue?
1383+
uninstall_confirm_all:
13781384
other: You are about to remove the State Tool, installed language runtimes, and all configuration information. Continue?
13791385
clean_cache_confirm:
13801386
other: You are about to reset the State Tool cache. Continue?

internal/runners/clean/uninstall.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ func (u *Uninstall) Run(params *UninstallParams) error {
6363

6464
if !params.Force {
6565
defaultChoice := params.NonInteractive
66-
ok, err := u.confirm.Confirm(locale.T("confirm"), locale.T("uninstall_confirm"), &defaultChoice)
66+
confirmMessage := locale.T("uninstall_confirm")
67+
if params.All {
68+
confirmMessage = locale.T("uninstall_confirm_all")
69+
}
70+
ok, err := u.confirm.Confirm(locale.T("confirm"), confirmMessage, &defaultChoice)
6771
if err != nil {
6872
return locale.WrapError(err, "err_uninstall_confirm", "Could not confirm uninstall choice")
6973
}

test/integration/uninstall_int_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ func (suite *UninstallIntegrationTestSuite) testUninstall(all bool) {
4444
cp = ts.Spawn("clean", "uninstall")
4545
}
4646
cp.Expect("You are about to remove")
47+
if !all {
48+
cp.Expect("--all") // verify mention of "--all" to remove everything
49+
}
4750
cp.SendLine("y")
4851
if runtime.GOOS == "windows" {
4952
cp.ExpectLongString("Deletion of State Tool has been scheduled.")

0 commit comments

Comments
 (0)