From 41fad4267bcf731e7c8846349a652d35edc11ccd Mon Sep 17 00:00:00 2001 From: Tomasz Kostrzewa Date: Wed, 6 Mar 2024 19:17:29 +0100 Subject: [PATCH] modified: RdzeN-Profile.ps1 --- RdzeN-Profile.ps1 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/RdzeN-Profile.ps1 b/RdzeN-Profile.ps1 index 8e2c102..4bcf275 100644 --- a/RdzeN-Profile.ps1 +++ b/RdzeN-Profile.ps1 @@ -65,8 +65,13 @@ if ($git_tmp -match "(Your branch is up to date)") { Pull-Repository } -# 4. List functions -$path_to_search = "$path_gitea_powershell_profile_functions\*" +# 4. Load functions +$path_to_search = "$path_gitea_powershell_profile_functions" +Get-ChildItem $path_to_search | ForEach-Object { + . $_ +} + +# 5. List functions $found_functions = @() Get-ChildItem $path_to_search | ForEach-Object { $file_content = Get-Content $_.FullName -Raw @@ -74,22 +79,20 @@ Get-ChildItem $path_to_search | ForEach-Object { foreach ($match in $matches) { $found_functions += $match.Value.Trim() } - # 4.5 Load functions - . $_ } $found_functions = $found_functions | Sort-Object - for ($i = 0; $i -lt $found_functions.Count; $i++) { Write-Host "$($i+1)" -NoNewline -ForegroundColor Cyan Write-Host ")`t" -NoNewline -ForegroundColor Blue Write-Host "$($found_functions[$i])" -ForegroundColor Cyan } -# 5. Check if current Profile is equal to repo profile file. + +# 6. Check if current Profile is equal to repo profile file. $profile_repo = Get-Content "$path_gitea_powershell_profile\RdzeN-Profile.ps1" $profile_system = Get-Content $PROFILE - $compare_profile = Compare-Object -ReferenceObject $profile_repo -DifferenceObject $profile_system -# 6. Override actual profile and reload it. + +# 6. Override actual profile and reload it if needed. if ($compare_profile.sideindicator.count -gt 0) { Override-Profile Reload-Profile