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

Shab always adds a newline to the input file #15

Closed
Alch-Emi opened this issue Jun 7, 2022 · 3 comments
Closed

Shab always adds a newline to the input file #15

Alch-Emi opened this issue Jun 7, 2022 · 3 comments

Comments

@Alch-Emi
Copy link

Alch-Emi commented Jun 7, 2022

Running shab on any input produces the expected output plus one newline at the end of the output. This seems to be due to the way that appending the delimiter (SHAB_$id) to the output is implemented.

It's possible to bandaid this by passing the output to head -c-1, although I couldn't find a way to fix this at its root. I can PR the head fix, although I thought I'd open an issue in case someone can come up with a better solution

Edit: Looking over it, it seems like the first call to cat on line 28 can be replaced with head to do this without additional overhead, although looking over past issues on the repo, it seems like adding a dependency on head is something you're trying to avoid.
https://github.com/zimbatm/shab/blob/b33927943dae0b80bf56a0424571ba3a5f45b8e1/shab#L28=

@zimbatm
Copy link
Owner

zimbatm commented Jun 7, 2022

Is the extra newline causing some issues for you, or is it more for correctness' sake?

Yeah, it's a shame but adding a dependency on head would go counter to the spirit of the project :)

@Alch-Emi
Copy link
Author

Alch-Emi commented Jun 9, 2022 via email

@zimbatm
Copy link
Owner

zimbatm commented Jun 10, 2022

I'm leaning towards letting go of the correctness for that specific case. Just to keep things simple and dependency-free. This should be documented though.

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

No branches or pull requests

2 participants