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

fix: list-task with multiline desc #1656

Merged
merged 6 commits into from
Jun 28, 2024
Merged

Conversation

vmaerten
Copy link
Member

Linked to :

I have multiple solutions in mind

  • First solution : remove all \n so we display one line
    image

  • Second solution : Display only the first line. We could considere for longer desc, we should use summary and not desc
    image

  • Third solution: Display "as it" with multiline
    image

I would considere that desc should be short and summary for long description. So, I would go for the first one.

@vmaerten vmaerten requested a review from pd93 May 13, 2024 10:48
@pd93
Copy link
Member

pd93 commented May 13, 2024

Also related:

I generally agree that descriptions should be short and kept to a single line. However, I suspect we will have users complain about options 1 and 2 as it restricts their options. A lot of people use the --list functionality as their docs and I can understand that restricting this to 1 line is annoying.

I've had a ton of issues using text/tabwriter in the past and gave up on trying to make it work. (for example task --experiements is still not aligned correctly). If you're able to find a good generalised solution for alignment, I'd be very interested.

@vmaerten vmaerten force-pushed the fix/logger-desc branch 2 times, most recently from f11fa7b to 534bac7 Compare May 13, 2024 12:51
@vmaerten
Copy link
Member Author

@pd93 I agree, I was not aware of this issue.

I've changed to the solution 3. I've also fixed the issue with experiments display. Now, all experiments are aligned in a table.
image

It seems tabwrite does not work well with colors (cf : https://stackoverflow.com/questions/35398497/how-do-i-get-colors-to-work-with-golang-tabwriter / fatih/color#175 / golang/go#12073)

That why, it can be trick, as we display multiple colors in the same table.

It may be worthy to take a look at https://github.com/juju/ansiterm/
I'll take a look if I can find something that can handle both tabs and colors

@vmaerten
Copy link
Member Author

vmaerten commented May 13, 2024

I've push a last version, using https://github.com/Ladicle/tabwriter as a drop in replacement of tabwriter but supporting color

It's way easier to use (no more headache debugging the tabwrite, yes I have a headache now 😂 ) than the text/tabwriter

I've separate in multiple commit, so we can revert a part if needed

@vmaerten vmaerten requested a review from andreynering May 13, 2024 15:33
@vmaerten vmaerten added the area: formatting Changes related to output and formatting. label May 13, 2024
Copy link
Member

@andreynering andreynering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I prefer option 1, forcing descriptions to be a single line. We have summary for longer documentation.

Thoughts?

testdata/desc/Taskfile.yml Outdated Show resolved Hide resolved
testdata/desc/Taskfile.yml Outdated Show resolved Hide resolved
@andreynering andreynering linked an issue May 16, 2024 that may be closed by this pull request
@vmaerten
Copy link
Member Author

I totally agree with you @andreynering. I did this at the first time before the @pd93's comment
We could write in the doc that desc will be printed in one line. If you want multiple lines you need to use summary

@pd93
Copy link
Member

pd93 commented Jun 9, 2024

I'm happy to go with option 1 if you both agree. I do think we will get some complaints about this though. I generally prefer to encourage users to doing something a specific way rather than forcing, but we can see how it goes.

edit: Massive thanks for finding a fix for the tabwriter issue. That was driving me crazy 😆

@vmaerten
Copy link
Member Author

Option 1 has been chosen.
Here is the result:

image

@vmaerten
Copy link
Member Author

It's good for review @pd93

@vmaerten vmaerten requested a review from andreynering June 28, 2024 16:46
@pd93 pd93 linked an issue Jun 28, 2024 that may be closed by this pull request
@pd93 pd93 merged commit 375106c into go-task:main Jun 28, 2024
13 checks passed
pd93 added a commit that referenced this pull request Jun 28, 2024
@vmaerten vmaerten deleted the fix/logger-desc branch July 7, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: formatting Changes related to output and formatting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

align target hints by column Text of multi line description not aligned when running task --list
3 participants