casey / just

🤖 Just a command runner

Home Page:https://just.systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow expressions in `[confirm: …]` attribute

alerque opened this issue · 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

{{…}} 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.