just.sh icon indicating copy to clipboard operation
just.sh copied to clipboard

Attributes unsupported

Open wiktor-k opened this issue 5 months ago • 0 comments

Hi!

I just found your project and wanted to use it to shellcheck the justfile but found one issue: it seems justfiles with attributes are unsupported:

Eg. this works:

test:
    echo a

but this doesn't:

[group('a')]
test:
    echo a

The error during generation looks like this:

$ just.sh
WARNING: Call `./just.sh` instead of `just.sh` to execute the generated script.
Compiling Justfile to shell script: `.justfile` -> `just.sh`
Traceback (most recent call last):
  File "/home/wiktor/src/meta/wkd-exporter/.venv/bin/just.sh", line 8, in <module>
    sys.exit(cli_entrypoint())
             ~~~~~~~~~~~~~~^^
  File "/home/wiktor/src/meta/wkd-exporter/.venv/lib/python3.13/site-packages/just_sh/convert.py", line 1907, in cli_entrypoint
    main(parsed_args.infile, parsed_args.outfile, verbose=parsed_args.verbose)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wiktor/src/meta/wkd-exporter/.venv/lib/python3.13/site-packages/just_sh/convert.py", line 1874, in main
    f.write(compile(justfile_data, outfile_path, verbose))
            ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wiktor/src/meta/wkd-exporter/.venv/lib/python3.13/site-packages/just_sh/convert.py", line 1842, in compile
    compiler_state = CompilerState(justfile_parse(justfile, verbose=verbose))
                                   ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wiktor/src/meta/wkd-exporter/.venv/lib/python3.13/site-packages/just_sh/parse.py", line 520, in parse
    return cast(List[Item], justfile_parser.parse(preprocess(data)))
                            ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/wiktor/src/meta/wkd-exporter/.venv/lib/python3.13/site-packages/parsy/__init__.py", line 98, in parse
    (result, _) = (self << eof).parse_partial(stream)
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/home/wiktor/src/meta/wkd-exporter/.venv/lib/python3.13/site-packages/parsy/__init__.py", line 112, in parse_partial
    raise ParseError(result.expected, stream, result.furthest)
parsy.ParseError: expected one of ',', '[ \\t]+', '\\s+', ']' at 0:6

I think just.sh could safely strip all attributes.

By the way just now has a JSON output (via just --dump --dump-format json) which may be useful for parsing... I actually don't know if you use that already so sorry for the noise in advance 😅

wiktor-k avatar Aug 01 '25 11:08 wiktor-k