Skip to content

Comments

✨ Add --unix-newline flag to change newline behavior#209

Merged
kynan merged 8 commits intokynan:mainfrom
s-weigand:force-lf-eol
Feb 10, 2026
Merged

✨ Add --unix-newline flag to change newline behavior#209
kynan merged 8 commits intokynan:mainfrom
s-weigand:force-lf-eol

Conversation

@s-weigand
Copy link
Contributor

@s-weigand s-weigand commented Feb 7, 2026

First of all, thanks for the awesome tool it helps a lot in reducing noise.
I recently encountered the same pre-commit hook fight, described in #208
This change adds the CLI flag --unix-newline to use the \n default newline, the default is to use OS line ending.

Fixes #208

Copy link
Owner

@kynan kynan left a comment

Choose a reason for hiding this comment

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

Thanks for contributing this! I think we want to change the flag name and refactor the tests a bit.

@kynan
Copy link
Owner

kynan commented Feb 8, 2026

@owenlamont @varunsh-xilinx FYI, can you please share your opinion here as this is related to #202 and #208 .

@s-weigand s-weigand changed the title ✨ Add --force-lf-eol flag to normalize lineendings ✨ Add --preserve-newline flag to change newline behavior Feb 8, 2026
@kynan
Copy link
Owner

kynan commented Feb 8, 2026

Once we've settled on the flag name, can you also update the README?

s-weigand and others added 7 commits February 8, 2026 18:48
Co-authored-by: Florian Rathgeber <florian.rathgeber@gmail.com>
🧪 Use different files for test with and without flag
👌 Use same newline convention for stdout with textconv
🧪 Add test for stdout with textconv
Co-authored-by: Florian Rathgeber <florian.rathgeber@gmail.com>
@s-weigand s-weigand changed the title ✨ Add --preserve-newline flag to change newline behavior ✨ Add --unix-newline flag to change newline behavior Feb 8, 2026
Copy link
Owner

@kynan kynan left a comment

Choose a reason for hiding this comment

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

Thanks! I think this is looking good now. Even though we weren't able to solve what we originally intended it's probably still a useful feature. And given how much time we spent on it not merging now feel like a waste :)

@varunsh-xilinx
Copy link

@owenlamont @varunsh-xilinx FYI, can you please share your opinion here as this is related to #202 and #208 .

In #202, I assumed that people on Windows would also be checking out with CRLF endings and commit LF endings so using None would work well to preserve the native OS EOL, which I agree is the least surprising outcome. So having a flag to change that behavior looks good to me.

Co-authored-by: Florian Rathgeber <florian.rathgeber@gmail.com>
@kynan kynan merged commit 186d22f into kynan:main Feb 10, 2026
15 checks passed
@s-weigand s-weigand deleted the force-lf-eol branch February 11, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nbstripout 0.8.2 can fight with pre-commit-hooks v6.0.0 on Windows over line endings

3 participants