just icon indicating copy to clipboard operation
just copied to clipboard

Allow expressions in `[confirm: …]` attribute

Open alerque opened this issue 1 year ago • 1 comments

Based on the docs and some tests it doesn't seem possible to use variable substitutions in confirm messages. I would have expected something like this to work:

[confirm("Really do stuff with {{arg}}?")]
action arg:
	@echo Doing stuff with {{arg}}

But it doesn't:

$ just action foo
Really do stuff with {{arg}}? y
Doing stuff with foo

alerque avatar Jul 31 '24 14:07 alerque

{{…}} interpolations aren't processed in strings. See #11.

But the issue is still valid, since you can't do:

[confirm("Really do stuff with " + arg + "?")]
action arg:
	@echo Doing stuff with {{arg}}

Changing this would require accepting an expression in the confirm attribute, and evaluating it. This is a somewhat involved change, since then the evaluator needs to evaluate expressions inside of attributes, but I think it's reasonable.

casey avatar Jul 31 '24 18:07 casey

Close in favor of https://github.com/casey/just/issues/2521 ?

laniakea64 avatar Dec 11 '24 23:12 laniakea64

Yup, thanks!

casey avatar Dec 11 '24 23:12 casey