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

User Command is adding a line break #92

Closed
icr1001 opened this issue Apr 9, 2021 · 3 comments
Closed

User Command is adding a line break #92

icr1001 opened this issue Apr 9, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@icr1001
Copy link

icr1001 commented Apr 9, 2021

Thanks for this amazing plugin!!!

Describe the bug
Multiple user commands in one line is adding a line break after each command.
For example:

Day 1: <% tp.user.tp_1ofweek %>, Day 2: <% tp.user.tp_2ofweek() %>

**Expecting result **
Day 1: Result 1, Day 2: Result 2

** Current result **
Day 1: Result 1
, Day 2: Result 2

Additional information
User commands:

name comand
tp_1ofweek powershell (Get-Date (Get-Date).Date.AddDays(1 - (Get-Date).Date.DayOfWeek.value__) -UFormat '%Y-%m-%d(%a)')
tp_2ofweek powershell (Get-Date (Get-Date).Date.AddDays(2 - (Get-Date).Date.DayOfWeek.value__) -UFormat '%Y-%m-%d(%a)')
@icr1001 icr1001 added the bug Something isn't working label Apr 9, 2021
@luckman212
Copy link

luckman212 commented Apr 9, 2021

I had the same problem in Bash script but fixed it by changing echo to printf '%s' which doesn't output with newlines unless you add \n.

In PowerShell I'm not sure how to do that right now, but these links have some starting points. Write-Host -NoNewLine may work for you.

How do I output text without a newline in PowerShell? - Stack Overflow

Avoiding newline in write-output - Stack Overflow

@icr1001
Copy link
Author

icr1001 commented Apr 9, 2021

Thank you @luckman212 You are right, Write-Host -NoNewLine solves my problem with: ​

powershell (Write-Host -NoNewLine (Get-Date (Get-Date).Date.AddDays(1 - (Get-Date).Date.DayOfWeek.value__) -UFormat '%Y-%m-%d(%a)'))

It was not necessary to add this command in the old version, but now it works. Thanks))

@SilentVoid13
Copy link
Owner

Hey @icr1001 as @luckman212 said, it's not a bug in Templater.
Templater just outputs what your system command outputs, if it contains a newline, it will output a newline, etc.
Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants