casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
21.42k stars 476 forks source link

Command evaluation with backticks is not supported for recipe arguments #336

Closed steveej closed 5 years ago

steveej commented 6 years ago

This could either be a bug report or a feature request, depending if this was meant to be supported already or not :laughing: In any case(y), thanks for writing just!

Recipe

mwe arg=`echo another default value`:
    echo {{arg}}

Output

$ just mwe        
error: Expected string or raw string, but found backtick
   |
46 | mwe arg=`echo another default value`:
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
casey commented 6 years ago

Puns are always appreciated! And you are very welcome ^__^

Thank you for the issue!

I believe that when I originally added default values I kept it to strings and raw strings just to be conservative. I'm not opposed to adding it, although I'm grinding really hard on another project, so I'll be unlikely to do it myself, unfortunately. I'm quite happy to mentor and help as needed, and I think this would make a great first issue.

Can you describe your use case for this? It might give me a better idea of how the feature would be used, and if there might be a better or different alternative.

I think the implementation is straightforward. Recipes with parameters may not be depended upon by other recipes, so they always run first or not at all, backticks in parameters can just be evaluated from left to right, before the recipe starts executing.

casey commented 5 years ago

Fixed in #400, cutting a release soon!

steveej commented 5 years ago

@casey yay, really looking forward to using this! thank you!

casey commented 5 years ago

You're totally welcome!