feat(pwsh): add context for V2 users

This commit is contained in:
Jan De Dobbeleer 2021-01-19 19:17:41 +01:00 committed by Jan De Dobbeleer
parent d1025670fb
commit ee4b039e7a
2 changed files with 29 additions and 1 deletions

View file

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

View file

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