just icon indicating copy to clipboard operation
just copied to clipboard

Preserve module doc and group attributes when formatting

Open quotidian-ennui opened this issue 10 months ago • 4 comments

The documentation says I can annotate modules with doc and group (amongst other things).

bsh ❯ just
Available recipes:
  [apps]
  pihole ... # Manage the pihole configuration

  [help]
  help       # Show recipes

When we format the justfile then we lose the [doc()] and [group()] tags.

bsh ❯ just --unstable --fmt --justfile Justfile
Wrote justfile to `/home/lchan/code/personal/just-fmt-repro/Justfile`

bsh ❯ just
Available recipes:
  pihole ...

  [help]
  help       # Show recipes

bsh ❯ cat Justfile
set positional-arguments := true

mod pihole "pihole.just"

[doc("Show recipes")]
[group("help")]
@help:
    just --list --list-prefix "  "

quotidian-ennui avatar Feb 10 '25 20:02 quotidian-ennui

The justfiles as referenced above are here : https://github.com/quotidian-ennui/just-fmt-repro

quotidian-ennui avatar Feb 10 '25 20:02 quotidian-ennui

Can you copy and paste the before and after of the formatted justfile?

casey avatar Feb 10 '25 21:02 casey

Before (as per https://github.com/quotidian-ennui/just-fmt-repro/blob/main/Justfile)

set positional-arguments := true

[doc("Manage the pihole configuration")]
[group("apps")]
mod pihole "pihole.just"

[group("help")]
[doc("Show recipes")]
@help:
    just --list --list-prefix "  "

After is as per the issue details (2nd code block):

set positional-arguments := true

mod pihole "pihole.just"

[doc("Show recipes")]
[group("help")]
@help:
    just --list --list-prefix "  "

quotidian-ennui avatar Feb 10 '25 21:02 quotidian-ennui

Thanks! This is definitely a bug.

casey avatar Feb 10 '25 23:02 casey