modified: RdzeN-Profile.ps1

This commit is contained in:
Tomasz Kostrzewa 2024-03-06 19:20:40 +01:00
parent 41fad4267b
commit 35b2a96da9

View File

@ -3,6 +3,9 @@
# Example Powershell Profile. # Example Powershell Profile.
# #
# TO-DO
# Step 0, precheck for git, notepad++ and vscode installed.
# 1. Check if GITEA folder exists. # 1. Check if GITEA folder exists.
$path_gitea = "$($env:USERPROFILE)\GITEA" $path_gitea = "$($env:USERPROFILE)\GITEA"
$path_gitea_powershell_profile = "$path_gitea\PowerShell-Profile" $path_gitea_powershell_profile = "$path_gitea\PowerShell-Profile"
@ -75,9 +78,9 @@ Get-ChildItem $path_to_search | ForEach-Object {
$found_functions = @() $found_functions = @()
Get-ChildItem $path_to_search | ForEach-Object { Get-ChildItem $path_to_search | ForEach-Object {
$file_content = Get-Content $_.FullName -Raw $file_content = Get-Content $_.FullName -Raw
$matches = [Regex]::Matches($file_content, '(?<=function\s).*?(?={)') $matched_functions = [Regex]::Matches($file_content, '(?<=function\s).*?(?={)')
foreach ($match in $matches) { $matched_functions | ForEach-Object {
$found_functions += $match.Value.Trim() $found_functions += $_.Value.Trim()
} }
} }
$found_functions = $found_functions | Sort-Object $found_functions = $found_functions | Sort-Object
@ -92,11 +95,11 @@ $profile_repo = Get-Content "$path_gitea_powershell_profile\RdzeN-Profile.ps1"
$profile_system = Get-Content $PROFILE $profile_system = Get-Content $PROFILE
$compare_profile = Compare-Object -ReferenceObject $profile_repo -DifferenceObject $profile_system $compare_profile = Compare-Object -ReferenceObject $profile_repo -DifferenceObject $profile_system
# 6. Override actual profile and reload it if needed. # 7. Override actual profile and reload it if needed.
if ($compare_profile.sideindicator.count -gt 0) { if ($compare_profile.sideindicator.count -gt 0) {
Override-Profile Override-Profile
Reload-Profile Reload-Profile
} }
# 99. Prompt profile loaded # 99. Prompt profile loaded
New-SimulateTyping "PowerShell User Profile is loaded" New-SimulateTyping "PowerShell User Profile is loaded"