We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi All,
Is there an easy way to remove the trailing empty newline that is added in multi-line strings?
Given the following code:
local script = ||| case "$ver" in %(current)s) echo "Same" exit 0 ;; %(upgrade)s *) echo "Wrong" exit 2 ;; esac |||; script % { current: '10', target: '20', upgrade: (if $.current != '20' then ||| %(target)s) echo "Different" exit 1 ;; ||| % { current: $.current, target: $.target } else ''), }
It produces the following output:
case "$ver" in 10) echo "Same" exit 0 ;; 20) echo "Different" exit 1 ;; *) echo "Wrong" exit 2 ;; esac
I would like to get rid of the empty line that was added between the 20 and * cases. Is there an easy way to do this?
20
*
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered:
The best way right now is probably to write a function that strips the trailing newline and call that around the |||.
Related FRs:
#289 #915
Sorry, something went wrong.
Thanks for your answer and your hint :-). This one did the trick:
upgrade: (if $.current != '2.0' then std.rstripChars(||| %(target)s) echo "Different" exit 1 ;; ||| % { current: $.current, target: $.target }, '\n') else ''),
FYI for those following I implemented a "chomped multiline string" syntax in a PR at #1175. Would love some feedback on it and/or to get it merged! 🙂
No branches or pull requests
Hi All,
Is there an easy way to remove the trailing empty newline that is added in multi-line strings?
Given the following code:
It produces the following output:
I would like to get rid of the empty line that was added between the
20
and*
cases. Is there an easy way to do this?Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: