I'm almost too embarrassed to ask this because I think I'm missing something obvious. A custom theme has one requirement: to implement a PS function called Write-Theme. That function has two parameters, $lastCommandFailed and $with. I have been mucking around with themes and noticed that the $with parameter never seems to have a value. So I searched the code for instances of $with and -with, but only found this:
This wasn't what I was looking for, but in the interest of completeness ... every theme.psm1 is a match because each one implements Write-Theme.
Also not a real match: the README.md files mentions $with when explaining how to create custom themes.
The module file oh-my-posh.psm1 defines a global function called Write-WithPrompt which in turn has a line in it that called Write-Theme -lastCommandFailed $lastCommandFailed -with $command.
Write-WithPrompt is not called from anywhere else in the code.
Write-WithPrompt receives $command as a parameter and does nothing with it but pass it to either Write-Theme or to Write-ClassicPrompt.
Write-ClassicPrompt, like Write-Theme, is not mentioned anywhere else in the code.
So I've been wondering: what is the purpose of this parameter that never seems to have a value, is almost never referenced in the code, and when it is referenced it seems to fall from the sky, showing up in a function that is not called from anywhere? :)
Actually, I assume that Write-WithPrompt is a callback to build the prompt, but I honestly can't tell what $command/$with actually do. Can you help me out? If they don't do anything, I can simplify my themes. :)
I'm almost too embarrassed to ask this because I think I'm missing something obvious. A custom theme has one requirement: to implement a PS function called Write-Theme. That function has two parameters,
$lastCommandFailed
and$with
. I have been mucking around with themes and noticed that the$with
parameter never seems to have a value. So I searched the code for instances of$with
and-with
, but only found this:theme.psm1
is a match because each one implementsWrite-Theme
.README.md
files mentions$with
when explaining how to create custom themes.oh-my-posh.psm1
defines a global function calledWrite-WithPrompt
which in turn has a line in it that calledWrite-Theme -lastCommandFailed $lastCommandFailed -with $command
.Write-WithPrompt
is not called from anywhere else in the code.Write-WithPrompt
receives$command
as a parameter and does nothing with it but pass it to eitherWrite-Theme
or toWrite-ClassicPrompt
.Write-ClassicPrompt
, likeWrite-Theme
, is not mentioned anywhere else in the code.So I've been wondering: what is the purpose of this parameter that never seems to have a value, is almost never referenced in the code, and when it is referenced it seems to fall from the sky, showing up in a function that is not called from anywhere? :)
Actually, I assume that
Write-WithPrompt
is a callback to build the prompt, but I honestly can't tell what$command
/$with
actually do. Can you help me out? If they don't do anything, I can simplify my themes. :)Thanks!