Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Uninstall CTT PowerShell Profile feature #2855

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Cryostrixx
Copy link
Contributor

@Cryostrixx Cryostrixx commented Oct 1, 2024

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Hotfix
  • Security patch
  • UI/UX improvement

Description

Implements the ability to uninstall the CTT PowerShell Profile and all its related dependencies.

Testing

I have tested the profile uninstallation functionality by running it in the following test scenarios:

  • Baseline: Installing the CTT PowerShell Profile
  • Test 1: Uninstallation of OhMyPosh dependency: [✅] Successful
  • Test 2: Uninstallation of Nerd Fonts dependency: [❓] Conditional
    • Additional Context: See Notes for Test 2 in Additional Information.
  • Test 3: Uninstallation of Terminal-Icons dependency: [✅] Successful
  • Test 4: Uninstallation of Zoxide dependency: [✅] Successful
  • Test 5: Skipping uninstallation of in-use dependencies: [✅] Successful
  • Test 6: Uninstallation of CTT PowerShell Profile: [✅] Successful

Impact

  • Covered by ## Description, ## Testing, and ## Additional Information.

Issue related to PR

Additional Information

New Files Created

  • $PSProfile.hash: A file that stores the hash of the CTT PowerShell Profile; this is used to check if the profile is installed on the system.
    • Additional Context:
      • The path is derived from the $PSProfile variable with .hash being appended to the end of the file path.
      • Example Hash File Path: C:\Users\<user>\Documents\PowerShell\Microsoft.PowerShell_profile.ps1.hash.
      • This file will be cleaned up and removed when the CTT PowerShell Profile is uninstalled from the system.
  • $PSProfile.bak: A file that is used as a backup of the PowerShell profile prior to the CTT PowerShell Profile being installed on the system.
    • Additional Context:
      • The path is derived from the $PSProfile variable with .bak being appended to the end of the file path.
      • Example Backup File Path: C:\Users\<user>\Documents\PowerShell\Microsoft.PowerShell_profile.ps1.bak.
      • This file will be moved back to the original PowerShell profile's location when the CTT PowerShell Profile is uninstalled from the system.

Notes for Test 2

  • Note 1: Nerd Fonts won't always be installed due to an issue with the setup script for the PowerShell profile.
  • Note 2: If the font is not installed, the user will see the message: ===> Already Uninstalled: Nerd Fonts. <===.

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no errors/warnings/merge conflicts.

@Marterich
Copy link
Contributor

Seeing that Powershell profile Installation is pulled in from a remote repo, would it maybe be a better way to create the uninstall logic also in the remote repo instead of in winutil itself?
Alternatively we could completely merge both repos and maintain the psprofile as a part of winutil in the future. All in all, no matter what's done in the end, I think we should keep the psprofile logic (install and uninstall) in the same repo

@Cryostrixx Cryostrixx marked this pull request as draft October 1, 2024 21:01
@Cryostrixx Cryostrixx marked this pull request as ready for review October 1, 2024 22:04
@Cryostrixx Cryostrixx marked this pull request as draft October 1, 2024 22:47
@Cryostrixx Cryostrixx marked this pull request as ready for review October 3, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat req: option to remove CTT profile.ps1
2 participants