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

Print mutli-line doc comments before recipe #2090

Merged
merged 2 commits into from
May 26, 2024
Merged

Print mutli-line doc comments before recipe #2090

merged 2 commits into from
May 26, 2024

Conversation

casey
Copy link
Owner

@casey casey commented May 25, 2024

No description provided.

@casey casey marked this pull request as draft May 25, 2024 10:02
@casey
Copy link
Owner Author

casey commented May 25, 2024

@kranurag7 re your comment in #2090, this prints out multiline doc comments:

[doc('multiline
comment')]
foo:

Like this:

Available recipes:
    # multiline
    # comment
    foo

How does that strike you?

I was thinking that:

Available recipes:
    foo # multiline
          comment

Could get awkward to read, and would mean that a long doc comment would be squashed to the right.

@kranurag7
Copy link

Thanks for the fix.

With 1st, one have to re-think that the comment is for the recipe that is listed down and one may get confused if the comment is for the recipe listed down or above.

I think keeping it on the right is more flexible for users because then they'll read from left to right.

Details

$ ./target/debug/just -f justfile.foo --list
Available recipes:
    # multiline
    # comment
    foo
    hello
    moo
    # this is a comment
    # for test recipe
    # comment
    test
    work
    zoo

Could get awkward to read, and would mean that a long doc comment would be squashed to the right.

we can auto-wrap after few characters, something like git commit messages where auto-wrapping is recommended after 72 characters.

@casey
Copy link
Owner Author

casey commented May 26, 2024

Auto-wrapping would require word-splitting, which is error prone. For example, if word-splitting is done on spaces, the splitter would split commands like echo foo in the middle. Whatever we do, I'm inclined to leave the lines as the author wrote them, and they can adjust the line-length how they want.

@casey casey marked this pull request as ready for review May 26, 2024 01:11
@casey casey merged commit 2bacbdd into master May 26, 2024
5 checks passed
@casey casey deleted the multiline-doc branch May 26, 2024 01:12
@casey
Copy link
Owner Author

casey commented May 26, 2024

I'm going to merge this, since it's definitely an improvement over the current behavior. I'm still undecided about trying to print multi-line doc-comments after recipes with alignment. I think it's probably not a simple win, since I think things like this look pretty awkward:

Available recipes:
    a # this is
        a long comment
    b # another comment
```

@zekefast
Copy link

I'm going to merge this, since it's definitely an improvement over the current behavior. I'm still undecided about trying to print multi-line doc-comments after recipes with alignment. I think it's probably not a simple win, since I think things like this look pretty awkward:

Please, please do the alignment! We have lots of recipes with a lot of docs and the output of just --list is just a mess.

It wasn't well aligned previously, especially when there is a recipe with long list of arguments (3 and more), but with moving documentation under the recipe name while for other recipes it is right aligned make everything very hard to read!

@casey
Copy link
Owner Author

casey commented Jun 25, 2024

@zekefast I'm happy to consider it! Could you open a new issue with an example of the current output you're getting how you'd like it to be improved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants