mirror of
https://github.com/nushell/nushell.git
synced 2025-04-26 06:08:21 +02:00
Make sure to apply captures when setting prompt (#4583)
This commit is contained in:
parent
d1ec05b12b
commit
07cd8f483e
@ -68,12 +68,17 @@ fn get_prompt_string(
|
|||||||
stack
|
stack
|
||||||
.get_env_var(engine_state, prompt)
|
.get_env_var(engine_state, prompt)
|
||||||
.and_then(|v| match v {
|
.and_then(|v| match v {
|
||||||
Value::Block { val: block_id, .. } => {
|
Value::Block {
|
||||||
|
val: block_id,
|
||||||
|
captures,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
let block = engine_state.get_block(block_id);
|
let block = engine_state.get_block(block_id);
|
||||||
|
let mut stack = stack.captures_to_stack(&captures);
|
||||||
// Use eval_subexpression to force a redirection of output, so we can use everything in prompt
|
// Use eval_subexpression to force a redirection of output, so we can use everything in prompt
|
||||||
let ret_val = eval_subexpression(
|
let ret_val = eval_subexpression(
|
||||||
engine_state,
|
engine_state,
|
||||||
stack,
|
&mut stack,
|
||||||
block,
|
block,
|
||||||
PipelineData::new(Span::new(0, 0)), // Don't try this at home, 0 span is ignored
|
PipelineData::new(Span::new(0, 0)), // Don't try this at home, 0 span is ignored
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user