Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support o>>, e>>, o+e>> to append output to an external file #10764

Merged
merged 58 commits into from Nov 27, 2023

Conversation

WindSoilder
Copy link
Collaborator

@WindSoilder WindSoilder commented Oct 18, 2023

Description

Close: #10278

This pr introduces o>>, e>>, o+e>> to allow redirection to append to a file.
Examples:

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

@WindSoilder WindSoilder marked this pull request as ready for review November 23, 2023 14:32
Copy link
Member

@amtoine amtoine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just tried out the new feature and, as the OP of the issue this addresses, i'm very happy to see it in Nushell from now on 👍

thanks @WindSoilder 🙏
once the review thread gets sorted out, please feel free to land the PR, i'm all for it 😌

@fdncred fdncred merged commit 077d1c8 into nushell:main Nov 27, 2023
19 checks passed
@fdncred
Copy link
Collaborator

fdncred commented Nov 27, 2023

Since we have a couple weeks, let's run with this and see how it goes.

@WindSoilder WindSoilder deleted the append_mode_redirect branch November 28, 2023 09:48
@rgwood
Copy link
Contributor

rgwood commented Dec 1, 2023

I love seeing improvements to redirection. Thanks for all your work in this area, @WindSoilder !

hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Dec 14, 2023
…ushell#10764)

# Description
Close: nushell#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
dmatos2012 pushed a commit to dmatos2012/nushell that referenced this pull request Feb 20, 2024
…ushell#10764)

# Description
Close: nushell#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow redirection to append to files
4 participants