You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a cmd in my justfile to package my release binary in a zip file, and I want to name the zip file after the CARGO_PKG_VERSION. How can I read the value of CARGO_PKG_VERSION in the justfile? :)
The text was updated successfully, but these errors were encountered:
But is there a way I can make this reuseable as a function, callable like version(subcrate)?
Because I have several binary subcrates and need this for all of them.
There isn't currently a way to define functions, although I could imagine letting recipes be called as functions in expressions though:
version SUBCRATE:
sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/v\1/p' {{SUBCRATE}}/Cargo.toml | head -1
pkg-foo:
echo {{version("foo")}}
One issue with this is that currently, Just doesn't really have a type system. Or, rather, the only type of value are strings, and a small number of built-in functions types which are special cased.
If it were possible to define functions, then these functions would have different arities, and validating statically that functions are called with the correct number of arguments might be tricky. (I would strongly prefer to do static type checking over dynamic, even though doing it dynamically would probably be easier.)
I have a cmd in my justfile to package my release binary in a zip file, and I want to name the zip file after the
CARGO_PKG_VERSION
. How can I read the value ofCARGO_PKG_VERSION
in the justfile? :)The text was updated successfully, but these errors were encountered: