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

Allow defining private variables #2299

Closed
adsnaider opened this issue Aug 3, 2024 · 4 comments · Fixed by #2300
Closed

Allow defining private variables #2299

adsnaider opened this issue Aug 3, 2024 · 4 comments · Fixed by #2300

Comments

@adsnaider
Copy link
Contributor

adsnaider commented Aug 3, 2024

Often, I need to define variables that are built from a smaller set of fundamental settings/variables. It would be useful to allow [private] to work on variables such that they can't be defined by the user of the script. Alternatively, the _ prefix could also be used such that just --variables avoids listing them.

Happy to work on a PR if this is something that will be accepted

@casey
Copy link
Owner

casey commented Aug 3, 2024

Thanks for the report! Can you give an example of how a user redefining a variable would be a problem? I want to make sure I understand the use-case.

I think allowing [private] on variables and, if present, not showing them in just --variables, would be pretty easy and reasonable.

@adsnaider
Copy link
Contributor Author

Thanks @casey, I just finished migrating to just on my project so here you'll find examples where private variables would be nice to have (currently just using _ prefix)

@laniakea64
Copy link
Contributor

The requested feature would also be useful to reduce clutter in just --evaluate. That said, being able to view all variables' values is useful for debugging, so maybe a new additional flag (maybe just --evaluate --debug or maybe just --evaluate --all?) to also show evaluated private variables?

@adsnaider
Copy link
Contributor Author

My implementation above specifically doesn't filter out private assignments on evaluation since that's useful information. I think you're right that it would be useful to filter them out by default and have an extra flag to flip that behavior. I'll see if I can implement that today

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

Successfully merging a pull request may close this issue.

3 participants