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 #3012

Conversation

Cryostrixx
Copy link
Contributor

@Cryostrixx Cryostrixx commented Nov 5, 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

Resolves #2836

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. <===.

Possible Change

I'm not sure if the documentation files in ./docs/dev/features/PowerShell-Profile are necessary, I added them for completeness but if they aren't needed please let me know so I can remove them.

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.

@Cryostrixx Cryostrixx marked this pull request as draft November 5, 2024 21:30
@Cryostrixx Cryostrixx marked this pull request as ready for review November 5, 2024 21:31
Copy link
Owner

@ChrisTitusTech ChrisTitusTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the uninstall addition and the fix for updating powershell on setup.

@ChrisTitusTech ChrisTitusTech merged commit 171441d into ChrisTitusTech:main Nov 7, 2024
1 check passed
@Cryostrixx Cryostrixx changed the title Remake PR: Uninstall CTT PowerShell Profile Add Uninstall CTT PowerShell Profile feature Nov 7, 2024
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