casey / just

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

Recipe parameters for variables? #2209

Open bukowa opened 1 week ago

bukowa commented 1 week ago

Can it be done?

[unix]
export VAR=1

[windows]
export VAR=2
laniakea64 commented 1 week ago

So you're seeking to export different values for a particular environment variable depending whether running on Windows or a Unix OS?

Does this do what you're looking for? -

export VAR := if os_family() == 'windows' { "2" } else { "1" }
bukowa commented 1 week ago

So you're seeking to export different values for a particular environment variable depending whether running on Windows or a Unix OS?

Does this do what you're looking for? -

export VAR := if os_family() == 'windows' { "2" } else { "1" }

Yes, thank you. I was hoping for a (e.g. undocumented) more expressive expression like in my example.

casey commented 1 week ago

I'm not opposed to allowing OS attributes on variables, so I'll leave this open.