Skip to content

Commit

Permalink
feat(powershell, pwsh): Introducing unified pwsh and powershell profile
Browse files Browse the repository at this point in the history
I moved all of the previous configuration into the windows powershell
profile, because of backwards compatibility. The cross-platform
powershell now loads first the windows powershell profile, and after
that it loads its specific profile.
  • Loading branch information
Botond Kalocsai committed Apr 22, 2024
1 parent 3d78a95 commit 0dea6ce
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion home/.chezmoiscripts/run_after_Copy-TargetStates.ps1.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if eq .chezmoi.os "windows" }}
."{{- .chezmoi.sourceDir -}}\Documents\PowerShell\Functions.ps1"
."{{- .chezmoi.sourceDir -}}\Documents\WindowsPowerShell\Functions.ps1"

if (Test-Command -Name "scoop"){
$ScoopList = $(scoop list)
Expand Down
16 changes: 11 additions & 5 deletions home/Documents/PowerShell/Microsoft.PowerShell_profile.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
$ProfileLocation = Split-Path -Path $Profile.CurrentUserCurrentHost -Parent
# Loading Windows PowerShell profile
$WindowsPowershellProfile = (
powershell -NoProfile -Command {
Write-OutPut -InputObject $($Profile.CurrentUserCurrentHost)
}
)
.$WindowsPowershellProfile

."$ProfileLocation\Variables.ps1"
."$ProfileLocation\Initialisations.ps1"
."$ProfileLocation\Functions.ps1"
."$ProfileLocation\Aliases.ps1"
# Loading Cross Platform powershell specific profile
$PwshProfileLocation = (
Split-Path -Path $Profile.CurrentUserCurrentHost -Parent
)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$WindowsPowershellProfileLocation = (
Split-Path -Path $Profile.CurrentUserCurrentHost -Parent
)

."$WindowsPowershellProfileLocation\Variables.ps1"
."$WindowsPowershellProfileLocation\Initialisations.ps1"
."$WindowsPowershellProfileLocation\Functions.ps1"
."$WindowsPowershellProfileLocation\Aliases.ps1"
File renamed without changes.
4 changes: 2 additions & 2 deletions home/dot_local/windows_setup/Install-WindowsSetup.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
."..\..\Documents\PowerShell\Functions.ps1"
."..\..\Documents\PowerShell\Variables.ps1"
."..\..\Documents\WindowsPowerShell\Functions.ps1"
."..\..\Documents\WindowsPowerShell\Variables.ps1"

# Install Scoop packages
# NOTE: Scoop is the primary package manager for my environment
Expand Down
4 changes: 2 additions & 2 deletions home/dot_local/windows_setup/Uninstall-WindowsSetup.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
."..\..\Documents\PowerShell\Functions.ps1"
."..\..\Documents\PowerShell\Variables.ps1"
."..\..\Documents\WindowsPowerShell\Functions.ps1"
."..\..\Documents\WindowsPowerShell\Variables.ps1"

# Cleaning up configuration
Remove-EnvironmentVariablesSetup -Scope "User" # Remove environment variables
Expand Down

0 comments on commit 0dea6ce

Please sign in to comment.