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

feature: Strip whitespace surrounding output #18

Open
dalito opened this issue Aug 18, 2024 · 1 comment
Open

feature: Strip whitespace surrounding output #18

dalito opened this issue Aug 18, 2024 · 1 comment
Assignees
Labels
feature New feature or request fund Issue priority can be boosted

Comments

@dalito
Copy link

dalito commented Aug 18, 2024

Is your feature request related to a problem? Please describe.

When running for example git status as a a duty task the output has too much white space around it. In this case the output ends with three empty lines instead of one.

Describe the solution you'd like

Strip white space around output to achieve more consistent formatting no matter which command is run.

Additional context

This is quite easy to do by adding `|trim' in the jinja template. I modified the pretty fomat to:

{% if success %}<green>✓</green>
{% elif nofail %}<yellow>✗</yellow>
{% else %}<red>✗</red>{% endif %} 
<bold>{{ title or command }}</bold>
{% if failure %} ({{ code }}){% endif %}
{% if failure and output and not quiet %}\n
{{ ('  > ' + command + '\n') if title else '' }}
{{ output|trim|indent(2 * ' ') }}{% endif %}

Maybe you want to do this as default?

🍰 Thanks a lot for making duty! I discovered it today like it more than other command runners I looked at (make, task, just, invoke).

Boost priority

  • Boost priority in our backlog through Polar.sh. Higher pledge, higher priority.
  • Minimum pledge by user/organization is $5, minimum amount for boost is $30.
  • View all issues with pledges.
  • We receive the funds once the issue is completed and confirmed by you.
  • Features with the insiders label are released to sponsors first, and tied to a funding goal.
Fund with Polar
@dalito dalito added the feature New feature or request label Aug 18, 2024
@pawamoy
Copy link
Owner

pawamoy commented Aug 18, 2024

Thanks for the request and the kind words! Super happy you like duty ^^

The request sounds reasonable. However I'm generally very hesitant with changing output arbitrarily. For all I know, someone wants to keep all the spacing 🤔

But I agree that most of the time there's no point in keeping trailing empty lines. Let me think about it more. Whether we do this by default or not, we can at least have a toggle to enable/disable trimming ^^

@pawamoy pawamoy added the fund Issue priority can be boosted label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request fund Issue priority can be boosted
Projects
None yet
Development

No branches or pull requests

2 participants