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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

vmaerten
Copy link
Collaborator

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
Copy link
Collaborator 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
Collaborator 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 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
Co-authored-by: Andrey Nering <andrey@nering.com.br>
@vmaerten
Copy link
Collaborator 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

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
3 participants