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

Suggestion: Doc comments for modules #2194

Closed
Spatenheinz opened this issue Jun 26, 2024 · 4 comments
Closed

Suggestion: Doc comments for modules #2194

Spatenheinz opened this issue Jun 26, 2024 · 4 comments

Comments

@Spatenheinz
Copy link
Contributor

With the Justfiles (in v. 1.29.1):

# Justfile
# recipes for foo'ing
mod foo

# foo.just
bar:
  echo "foobar"

calling just --list gives:

Available recipes:
    foo ...

It would be great if modules has doc comments similar to recipes.

Available recipes:
    foo ...  # recipes for foo'ing
@casey
Copy link
Owner

casey commented Jun 27, 2024

I think this would be great. The relevant code is here. There's already a function for getting the last doc comment, which is used to get recipe doc comments. All that's needed is to add a comment field to Item::Module, populate it by calling pop_doc_comment when parsing, and it through to the parsed Justfile, and display it in --list.

@Spatenheinz
Copy link
Contributor Author

I will get to it then :D

@laniakea64
Copy link
Contributor

Comment style doc for modules works for me, but [doc] attribute style doesn't work? 😕

[doc("Foo.")]
mod j
$ just --unstable --list
error: Expected '*', ':', '$', '=', identifier, or '+', but found end of line
 ——▶ justfile:2:6
  │
2 │ mod j
  │      ^

@casey
Copy link
Owner

casey commented Jun 29, 2024

The [doc(…)] syntax hasn't been implemented yet, I opened #2207 to track it.

@casey casey closed this as completed Jun 29, 2024
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

No branches or pull requests

3 participants