casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
18.44k stars 421 forks source link

Suggestion: Doc comments for modules #2194

Closed Spatenheinz closed 1 day ago

Spatenheinz commented 5 days ago

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 commented 4 days ago

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 commented 4 days ago

I will get to it then :D

laniakea64 commented 2 days ago

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

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

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