Skip to content

Commit 77031d5

Browse files
committed
Preserve snapshot display names in CLI output
1 parent 1cc15d8 commit 77031d5

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

conda_self/cli/main_reset.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ class Snapshot(Enum):
3030
def __str__(self) -> str:
3131
return self.value
3232

33+
@property
34+
def display_name(self) -> str:
35+
match self:
36+
case Snapshot.CURRENT:
37+
return "current"
38+
case Snapshot.INSTALLER:
39+
return "installer"
40+
case Snapshot.INSTALLER_EXACT:
41+
return "installer-provided (exact)"
42+
case Snapshot.INSTALLER_UPDATED:
43+
return "installer-provided (with updates)"
44+
case Snapshot.BASE_PROTECTION:
45+
return "base-protection"
46+
3347
@property
3448
def file_path(self) -> Path | None:
3549
"""The ``conda-meta/*.txt`` file this snapshot mode reads, if any."""
@@ -142,13 +156,13 @@ def execute(args: argparse.Namespace) -> int:
142156

143157
if not context.json and not context.quiet:
144158
if snapshot is not None:
145-
print(WHAT_TO_EXPECT_SNAPSHOT.format(mode_name=snapshot))
159+
print(WHAT_TO_EXPECT_SNAPSHOT.format(mode_name=snapshot.display_name))
146160
else:
147161
print(WHAT_TO_EXPECT_CURRENT)
148162

149163
prompt = "Proceed with resetting the base environment"
150164
if snapshot is not None:
151-
prompt += f" using the '{snapshot}' mode"
165+
prompt += f" using the '{snapshot.display_name}' mode"
152166
confirm_yn(f"{prompt}?[y/n]:\n", default="no", dry_run=context.dry_run)
153167

154168
if not context.json and not context.quiet:
@@ -169,7 +183,7 @@ def execute(args: argparse.Namespace) -> int:
169183
stdout_json_success()
170184
elif not context.quiet:
171185
if snapshot is not None:
172-
print(SUCCESS_SNAPSHOT.format(mode_name=snapshot))
186+
print(SUCCESS_SNAPSHOT.format(mode_name=snapshot.display_name))
173187
else:
174188
print(SUCCESS)
175189

demos/quickstart.gif

-91.6 KB
Loading

demos/reset.gif

-3.66 KB
Loading

news/clarify-conda-terminology

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
* Align CLI help, errors, documentation, and recorded demos with Conda
44
terminology and the existing behavior of package operations and base
5-
protection. Use the exact CLI reset mode names in prompts and completion messages.
5+
protection.

0 commit comments

Comments
 (0)