mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Support o>>
, e>>
, o+e>>
to append output to an external file (#10764)
# Description Close: #10278 This pr introduces `o>>`, `e>>`, `o+e>>` to allow redirection to append to a file. Examples: ```nushell echo abc o>> a.txt echo abc o>> a.txt cat asdf e>> a.txt cat asdf e>> a.txt cat asdf o+e>> a.txt ``` ~~TODO:~~ ~~1. currently internal commands with `o+e>` redirect to a variable is broken: `let x = "a.txt"; echo abc o+e> $x`, not sure when it was introduced...~~ ~~2. redirect stdout and stderr with append mode doesn't supported yet: `cat asdf o>>a.txt e>>b.ext`~~ ~~For these 2 items, I'd like to fix them in different prs.~~ Already done in this pr
This commit is contained in:
@ -124,7 +124,7 @@ impl Command for FromNuon {
|
||||
} else {
|
||||
match pipeline.elements.remove(0) {
|
||||
PipelineElement::Expression(_, expression)
|
||||
| PipelineElement::Redirection(_, _, expression)
|
||||
| PipelineElement::Redirection(_, _, expression, _)
|
||||
| PipelineElement::And(_, expression)
|
||||
| PipelineElement::Or(_, expression)
|
||||
| PipelineElement::SameTargetRedirection {
|
||||
@ -132,7 +132,7 @@ impl Command for FromNuon {
|
||||
..
|
||||
}
|
||||
| PipelineElement::SeparateRedirection {
|
||||
out: (_, expression),
|
||||
out: (_, expression, _),
|
||||
..
|
||||
} => expression,
|
||||
}
|
||||
|
Reference in New Issue
Block a user