-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
does not remove initial new line #20
Comments
Could be handled via optional argument? Or maybe another function |
Yeah I guess there's a few options 🤔 |
FWIW, I found this package when I needed a way to write multiline literal strings with leading tabs for unit tests in a readable manner. That an initial newline isn't removed makes this implementation unpleasant to use since I have to write something like this:
Rather than this (the only difference being the placement of the opening bracket:
|
For the record, the solution I settled on is the obvious one. At the top of the
with
|
Thanks @krader1961 - this seems to work perfectly. I applied that in my fork to keep handy around until fix lands in main repo. |
I just append query := dedent.Dedent(`
SELECT *
FROM t1, t2
WHERE t1.col > 2000;
`)[1:] |
@bersace Yes, that works but is less efficient and requires the user to explicitly remove the newline prefix. Which, in the context of this package, shouldn't be necessary. |
Yes, this is a workaround. But I prefer to handle it when producing a string with Dedent rather than presuming any string starting with a |
I have the feeling that adding a new function that skips initial new line would be a good compromise preserving behaviour / explicitness to folks that prefer it and nice short-cut for these who want to skip new line. @lithammer I am happy to put in PR with the change if you think this is a right approach? |
Hit this as well. I ended up wrapping it as |
running code from readme does not seem to remove the initial empty line
The text was updated successfully, but these errors were encountered: