add a prePrompt_functions variable
See original GitHub issueDescription of the new feature/enhancement
it would be the same as zsh’s precmd_functions, which is a list of functions that are called before every prompt, this would allow module makers to add functions to the prompt without overwriting it.
Proof of concept
this allows any script to register a function to run before every command by simply doing
$prePrompt_functions += "<function_name>"
$prePrompt_functions = @()
$prevprompt = $Function:prompt
function prompt {
$prePrompt_functions | Invoke-Expression
return $prevprompt.invoke()
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:22 (11 by maintainers)
Top Results From Across the Web
prompt, variables and functions.
I want to get two number using prompt. Assign those number to two different variables, then use those two variables as parameters in...
Read more >Is there a way of pre-populating Prompt Variables? | Automic ...
Hi, I have been asked by a user if there is a way of pre-populating prompt variables. What they have in mind is...
Read more >Update variable in bash function and use it in prompt (PS1)
What I want to do is to call a function in PS1 to update a variable inside the function. Then I like to...
Read more >Can I Put Prompt Inside of a Function in JavaScript?
Yes, it is possible to put a prompt inside of a function in JavaScript. Learn how to do it and see an example...
Read more >What's the ZSH equivalent of BASH's ...
BASH supports a $PROMPT_COMMAND environment variable that defines a command to be executed before any first-level interactive prompt. I'm ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PowerLine was just a proof of concept, see Why PowerLine.
The goal was always to convince the PowerShell team to change the default
prompt
function to… and put the current prompt into that new global as three statements:
IIRC @jaykul’s PowerLine module has some functionality like this?