-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requiring --unstable breaks recursive invocations #1564
Comments
To get around this I name my justfiles [private]
generate-unstable-justfile:
#!/usr/bin/env bash
set -euxo pipefail
echo -n > justfile
for recipe in $(just --justfile this.justfile --unstable --summary); do
echo "@$recipe:" >> justfile
echo " just --justfile this.justfile --unstable $recipe" >> justfile
done I have a pre-commit hook that will run just --justfile path/to/common.justfile --working-directory path/containing/this.justfile generate-unstable-justfile |
honestly working around the limitations feels like |
Rewrote this in python to handle arguments properly: #!/usr/bin/env python3
import subprocess
from argparse import ArgumentParser, FileType
def format_arg(arg: str) -> str:
if arg[:1] == "+":
arg = f"*{arg[1:]}"
return arg.split("=")[0]
def format_var(var: str) -> str:
return f"{{{{{var.lstrip('+*').split('=')[0]}}}}}"
def main():
parser = ArgumentParser()
parser.add_argument("src", help="source justfile", type=FileType("r"))
args = parser.parse_args()
lines = [
x.strip()
for x in subprocess.run(
["just", "--justfile", args.src.name, "--unstable", "--list"],
check=True,
capture_output=True,
)
.stdout.decode("utf-8")
.splitlines()
if x != "Available recipes:"
]
print("# AUTO GENERATED. DO NOT EDIT.")
for line in lines:
parts = line.split()
recipe = parts.pop(0)
print(f"@{' '.join([recipe]+[format_arg(x) for x in parts])}:")
print(
" {{just_executable()}}",
"--justfile",
args.src.name,
"--unstable",
recipe,
*[format_var(x) for x in parts],
)
if __name__ == "__main__":
try:
main()
except subprocess.CalledProcessError as e:
print(e.stderr)
raise e should be run in the directory you want the destination justfile to live, ie: python3 -u script.py relative/path/to/unstable.justfile > justfile |
@sgtsquiggs I have purely Not sure if it fills the same need as your Python script. |
A workaround is now available, you can set the |
If you happen to add an unstable feature like
!include
to your justfile, now all your recursive invocations are broken because they fail without--unstable
. This seems suboptimal. Proposal: allowJUST_UNSTABLE=true
to be set in the environment instead.Related: #1430
The text was updated successfully, but these errors were encountered: