modified: RdzeN-Profile.ps1

This commit is contained in:
Tomasz Kostrzewa 2024-03-06 19:17:29 +01:00
parent 4830c705bd
commit 41fad4267b

View File

@ -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