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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-newline option to nu #12410

Merged
merged 2 commits into from
Apr 9, 2024
Merged

Conversation

devyn
Copy link
Contributor

@devyn devyn commented Apr 5, 2024

Description

I have nu set as my shell in my editor, which allows me to easily pipe selections of text to things like str pascal-case or even more complex string operation pipelines, which I find super handy. However, the only annoying thing is that I pretty much always have to add | print -n at the end, because nu adds a newline when it prints the resulting value.

This adds a --no-newline option to stop that from happening, and then you don't need to pipe to print -n anymore, you can just have your shell command for your editor contain that flag.

User-Facing Changes

  • Add --no-newline command line option

Tests + Formatting

  • 馃煝 toolkit fmt
  • 馃煝 toolkit clippy
  • 馃煝 toolkit test
  • 馃煝 toolkit test stdlib

I have `nu` set as my shell in my editor, which allows me to easily pipe
selections of text to things like `str pascal-case` or even more complex
string operation pipelines, which I find super handy. However, the only
annoying thing is that I pretty much always have to add `| print -n` at
the end, because `nu` adds a newline when it prints the resulting value.

This adds a `--no-newline` option to stop that from happening, and then
you don't need to pipe to `print -n` anymore, you can just have your
shell command for your editor contain that flag.
@devyn
Copy link
Contributor Author

devyn commented Apr 5, 2024

Side note: I also noticed that many of the tests in tests/shell are wrong, they're using .expect() to try to compare values when the argument to expect is actually the error message to print on failure.

I think they can also be made to work on all platforms, too; the sh -c seems totally unnecessary to me.

tests/shell/mod.rs Outdated Show resolved Hide resolved
@fdncred fdncred merged commit 14b0ff3 into nushell:main Apr 9, 2024
15 checks passed
@fdncred
Copy link
Collaborator

fdncred commented Apr 9, 2024

Thanks.

@fdncred fdncred added the pr:commands This PR changes our commands in some way label Apr 9, 2024
@hustcer hustcer added this to the v0.93.0 milestone Apr 9, 2024
FilipAndersson245 pushed a commit to FilipAndersson245/nushell that referenced this pull request Apr 10, 2024
I have `nu` set as my shell in my editor, which allows me to easily pipe
selections of text to things like `str pascal-case` or even more complex
string operation pipelines, which I find super handy. However, the only
annoying thing is that I pretty much always have to add `| print -n` at
the end, because `nu` adds a newline when it prints the resulting value.

This adds a `--no-newline` option to stop that from happening, and then
you don't need to pipe to `print -n` anymore, you can just have your
shell command for your editor contain that flag.

- Add `--no-newline` command line option

- 馃煝 `toolkit fmt`
- 馃煝 `toolkit clippy`
- 馃煝 `toolkit test`
- 馃煝 `toolkit test stdlib`
NotTheDr01ds pushed a commit to NotTheDr01ds/nushell that referenced this pull request Apr 12, 2024
# Description
I have `nu` set as my shell in my editor, which allows me to easily pipe
selections of text to things like `str pascal-case` or even more complex
string operation pipelines, which I find super handy. However, the only
annoying thing is that I pretty much always have to add `| print -n` at
the end, because `nu` adds a newline when it prints the resulting value.

This adds a `--no-newline` option to stop that from happening, and then
you don't need to pipe to `print -n` anymore, you can just have your
shell command for your editor contain that flag.

# User-Facing Changes
- Add `--no-newline` command line option

# Tests + Formatting
- 馃煝 `toolkit fmt`
- 馃煝 `toolkit clippy`
- 馃煝 `toolkit test`
- 馃煝 `toolkit test stdlib`
@devyn devyn deleted the add-no-newline-option-to-nu branch April 19, 2024 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:commands This PR changes our commands in some way
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants