Skip to content

Commit

Permalink
feat(pwsh): add context for V2 users
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Jan 19, 2021
1 parent d102567 commit ee4b039
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/powershell/oh-my-posh/oh-my-posh.psd1
Expand Up @@ -31,7 +31,7 @@
# Aliases to export from this module
AliasesToExport = '*'
# Functions to export from this module
FunctionsToExport = @('Get-PoshThemes', 'Set-PoshPrompt', 'Write-PoshTheme', 'Set-PoshContext')
FunctionsToExport = @('Get-PoshThemes', 'Set-PoshPrompt', 'Write-PoshTheme', 'Set-PoshContext', 'Get-PoshInfoForV2Users')
# Private data to pass to the module specified in RootModule. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
PSData = @{
Expand Down
28 changes: 28 additions & 0 deletions packages/powershell/oh-my-posh/oh-my-posh.psm1
Expand Up @@ -108,3 +108,31 @@ Register-ArgumentCompleter `
-CommandName Set-PoshPrompt `
-ParameterName Theme `
-ScriptBlock $function:ThemeCompletion


# V2 compatibility functions
# These should be removed at a certain point in time
# but to facilitate ease of transition they are kept
# as long as issues/feature requests keep popping up

function Get-PoshInfoForV2Users {
Write-Host @'
Hi there!
It seems you're using an oh-my-posh V2 cmdlet while running V3.
To migrate your current setup to V3, have a look the documentation.
https://ohmyposh.dev/docs/upgrading
'@
}

Set-Alias -Name Set-Prompt -Value Get-PoshInfoForV2Users -Force
Set-Alias -Name Set-Theme -Value Get-PoshInfoForV2Users -Force
Set-Alias -Name Get-ThemesLocation -Value Get-PoshInfoForV2Users -Force
Set-Alias -Name Get-Theme -Value Get-PoshInfoForV2Users -Force
Set-Alias -Name Show-ThemeSymbols -Value Get-PoshInfoForV2Users -Force
Set-Alias -Name Show-ThemeColors -Value Get-PoshInfoForV2Users -Force
Set-Alias -Name Show-Colors -Value Get-PoshInfoForV2Users -Force
Set-Alias -Name Write-ColorPreview -Value Get-PoshInfoForV2Users -Force

0 comments on commit ee4b039

Please sign in to comment.