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

eval output variables always fully namespaced #80

Open
zerog2k opened this issue Jun 19, 2023 · 3 comments
Open

eval output variables always fully namespaced #80

zerog2k opened this issue Jun 19, 2023 · 3 comments

Comments

@zerog2k
Copy link

zerog2k commented Jun 19, 2023

eval always namespaces the variable names, regardless of jmespath selection scope

bash-3.2$ cat test.yml
foo:
  bar:
    baz: "something"
bash-3.2$ python3 -m niet . test.yml 
foo:
  bar:
    baz: something

bash-3.2$ python3 -m niet . test.yml -f eval
foo__bar__baz="something"
bash-3.2$ python3 -m niet .foo.bar test.yml
baz: something

bash-3.2$ python3 -m niet .foo.bar test.yml -f eval
foo_bar__baz="something"
bash-3.2$ 

i.e. expected output for:

python3 -m niet .foo.bar test.yml -f eval

would be

baz="something"
@zerog2k
Copy link
Author

zerog2k commented Jun 19, 2023

a workaround is to output as flat yaml, and pipe back to niet:

$ niet .foo.bar test.yml | niet . -f eval
baz="something"

@4383
Copy link
Member

4383 commented Jun 20, 2023

Hello,

Thanks to have reported this issue.
I'll try to check why this happen.

Hervé

@4383
Copy link
Member

4383 commented Jan 11, 2024

I agree that, from a functional point of view, the variable name should be related to the given scope.

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