mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
feat(pwsh): theme parameter is optional
This commit is contained in:
parent
177f328ac6
commit
18746bdc4b
|
@ -30,23 +30,17 @@ if ($IsWindows) {
|
||||||
|
|
||||||
function Set-PoshPrompt {
|
function Set-PoshPrompt {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $false)]
|
||||||
[string]
|
[string]
|
||||||
$Theme
|
$Theme
|
||||||
)
|
)
|
||||||
|
|
||||||
$themePath = ""
|
|
||||||
if (Test-Path "$PSScriptRoot/Themes/$Theme.json") {
|
if (Test-Path "$PSScriptRoot/Themes/$Theme.json") {
|
||||||
$themePath = "$PSScriptRoot/Themes/$Theme.json"
|
$global:PoshSettings.Theme = "$PSScriptRoot/Themes/$Theme.json"
|
||||||
}
|
}
|
||||||
elseif (Test-Path $Theme) {
|
elseif (Test-Path $Theme) {
|
||||||
$themePath = $Theme
|
$global:PoshSettings.Theme = $Theme
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Write-Error -Message "Unable to locate theme, please verify the name and/or location"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
$global:PoshSettings.Theme = $themePath
|
|
||||||
|
|
||||||
[ScriptBlock]$Prompt = {
|
[ScriptBlock]$Prompt = {
|
||||||
$realLASTEXITCODE = $global:LASTEXITCODE
|
$realLASTEXITCODE = $global:LASTEXITCODE
|
||||||
|
|
Loading…
Reference in a new issue