modified: RdzeN-Profile.ps1
This commit is contained in:
parent
4830c705bd
commit
41fad4267b
@ -65,8 +65,13 @@ if ($git_tmp -match "(Your branch is up to date)") {
|
|||||||
Pull-Repository
|
Pull-Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
# 4. List functions
|
# 4. Load functions
|
||||||
$path_to_search = "$path_gitea_powershell_profile_functions\*"
|
$path_to_search = "$path_gitea_powershell_profile_functions"
|
||||||
|
Get-ChildItem $path_to_search | ForEach-Object {
|
||||||
|
. $_
|
||||||
|
}
|
||||||
|
|
||||||
|
# 5. List functions
|
||||||
$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
|
||||||
@ -74,22 +79,20 @@ Get-ChildItem $path_to_search | ForEach-Object {
|
|||||||
foreach ($match in $matches) {
|
foreach ($match in $matches) {
|
||||||
$found_functions += $match.Value.Trim()
|
$found_functions += $match.Value.Trim()
|
||||||
}
|
}
|
||||||
# 4.5 Load functions
|
|
||||||
. $_
|
|
||||||
}
|
}
|
||||||
$found_functions = $found_functions | Sort-Object
|
$found_functions = $found_functions | Sort-Object
|
||||||
|
|
||||||
for ($i = 0; $i -lt $found_functions.Count; $i++) {
|
for ($i = 0; $i -lt $found_functions.Count; $i++) {
|
||||||
Write-Host "$($i+1)" -NoNewline -ForegroundColor Cyan
|
Write-Host "$($i+1)" -NoNewline -ForegroundColor Cyan
|
||||||
Write-Host ")`t" -NoNewline -ForegroundColor Blue
|
Write-Host ")`t" -NoNewline -ForegroundColor Blue
|
||||||
Write-Host "$($found_functions[$i])" -ForegroundColor Cyan
|
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_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.
|
|
||||||
|
# 6. 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user