Skip to content

Commit 18746bd

Browse files
feat(pwsh): theme parameter is optional
1 parent 177f328 commit 18746bd

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

packages/powershell/go-my-posh/go-my-posh.psm1

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,17 @@ if ($IsWindows) {
3030

3131
function Set-PoshPrompt {
3232
param(
33-
[Parameter(Mandatory = $true)]
33+
[Parameter(Mandatory = $false)]
3434
[string]
3535
$Theme
3636
)
3737

38-
$themePath = ""
3938
if (Test-Path "$PSScriptRoot/Themes/$Theme.json") {
40-
$themePath = "$PSScriptRoot/Themes/$Theme.json"
39+
$global:PoshSettings.Theme = "$PSScriptRoot/Themes/$Theme.json"
4140
}
4241
elseif (Test-Path $Theme) {
43-
$themePath = $Theme
42+
$global:PoshSettings.Theme = $Theme
4443
}
45-
else {
46-
Write-Error -Message "Unable to locate theme, please verify the name and/or location"
47-
return
48-
}
49-
$global:PoshSettings.Theme = $themePath
5044

5145
[ScriptBlock]$Prompt = {
5246
$realLASTEXITCODE = $global:LASTEXITCODE

0 commit comments

Comments
 (0)