Skip to content
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

Do not shared {args} among all scripts #987

Closed
ketozhang opened this issue Oct 5, 2023 · 2 comments
Closed

Do not shared {args} among all scripts #987

ketozhang opened this issue Oct 5, 2023 · 2 comments

Comments

@ketozhang
Copy link

The named scripts share {args} in unexpected ways. For example...

[tool.hatch.envs.default.scripts]
echo1="echo {args:1}"
echo2="echo {args:2}"
echo3="echo {args:3}"
echoall=["echo1 a", "echo2 b", "echo3 c"]
$ hatch run echoall
cmd [1] | echo 1
1
cmd [2] | echo 2
2
cmd [3] | echo 3
3

Actual

$ hatch run echoall 4
cmd [1] | echo 4 a
4 a
cmd [2] | echo 4 b
4 b
cmd [3] | echo 4 c
4 c

Expected

$ hatch run echoall 4
cmd [1] | echo a
a
cmd [2] | echo b
b
cmd [3] | echo c
c
@ofek
Copy link
Sponsor Collaborator

ofek commented Oct 5, 2023

Nested scripts do not consume {args} but rather are concatenated https://hatch.pypa.io/latest/config/environment/overview/#scripts

@ofek
Copy link
Sponsor Collaborator

ofek commented Oct 7, 2023

This is a design decision and therefore won't be changed.

@ofek ofek closed this as completed Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants