just icon indicating copy to clipboard operation
just copied to clipboard

Variable substitution in doc comment

Open halostatue opened this issue 1 year ago • 1 comments

It would be useful to have variable substitution in a task doc comment:

# Run the primary CI test (PostgreSQL {{ PROD_POSTGRESQL }})
ci-test-primary: createdb test dropdb

This did not work, as it only shows the literal {{ PROD_POSTGRESQL }} and does not substitute the variable value (which is set). This would make the output of just --list somewhat more dynamic.

halostatue avatar Mar 11 '24 19:03 halostatue

I think the easiest way to do this is to add a doc attribute, which allows using an expression as the doc comment:

[doc("Run the primary CI test (PostgreSQL " + PROD_POSTGRESQL + ")")]
ci-test-primary: createdb test dropdb

I think this would be relatively easy. When we eventually have interpolation in strings, it could be written as:

[doc(f"Run the primary CI test (PostgreSQL {{PROD_POSTGRESQL)")]
ci-test-primary: createdb test dropdb

casey avatar May 15 '24 02:05 casey