modified: RdzeN-Profile.ps1

modified:   functions/Reload-Profile.ps1
This commit is contained in:
Tomasz Kostrzewa 2024-03-05 18:57:05 +01:00
parent 8889612260
commit 2aea742524
2 changed files with 26 additions and 5 deletions

View File

@ -3,7 +3,6 @@
# Example Powershell Profile. # Example Powershell Profile.
# #
# 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"
$path_gitea_powershell_profile_functions = "$path_gitea_powershell_profile\functions" $path_gitea_powershell_profile_functions = "$path_gitea_powershell_profile\functions"
@ -19,7 +18,6 @@ if (-not (Test-Path $path_gitea_powershell_profile_functions )) {
} }
# 2. Download / pull GIT REPO # 2. Download / pull GIT REPO
$RepositoryURL = "https://gitea.rdzen.net/najlepszytomasz/PowerShell-Profile.git" $RepositoryURL = "https://gitea.rdzen.net/najlepszytomasz/PowerShell-Profile.git"
if (-not (Get-ChildItem $path_gitea_powershell_profile_functions).count -gt 0) { if (-not (Get-ChildItem $path_gitea_powershell_profile_functions).count -gt 0) {
@ -43,10 +41,33 @@ if (-not (Get-ChildItem $path_gitea_powershell_profile_functions).count -gt 0) {
} }
# 3. dot source functions. # 3. dot source functions.
Get-ChildItem $path_gitea_powershell_profile_functions | ForEach-Object { Get-ChildItem $path_gitea_powershell_profile_functions | ForEach-Object {
. $_.FullName . $_.FullName
} }
# 96. Update Profile Section:
if (-not (Test-Path $PROFILE)) {
# 97. Test Profile
Test-Profile
} else {
# 98. Override Profile
do {
New-SimulateTyping "Do you want to Override your PS Profile?"
$reload = Read-Host "Type [Y]es or [N]o"
} until (
$reload -in ("Y","N")
)
if ($reload -eq "Y") {
Override-Profile
}
}
# 99. Reload Profile # 99. Reload Profile
Reload-Profile do {
New-SimulateTyping "Do you want to Reload your PS Profile?"
$reload = Read-Host "Type [Y]es or [N]o"
} until (
$reload -in ("Y","N")
)
if ($reload -eq "Y") {
Reload-Profile
}

View File

@ -3,4 +3,4 @@
function Reload-Profile { function Reload-Profile {
. $PROFILE . $PROFILE
} }
New-SimulateTyping "Your PowerShell profile was reloaded!" New-SimulateTyping "Your PowerShell profile was Reloaded!"