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

Configure a few CLI args via env variables #714

Closed
hadim opened this issue Jan 28, 2024 · 3 comments
Closed

Configure a few CLI args via env variables #714

hadim opened this issue Jan 28, 2024 · 3 comments
Labels
✨ enhancement Feature request

Comments

@hadim
Copy link
Contributor

hadim commented Jan 28, 2024

Problem description

The candidates would be:

  • --frozen
  • --locked
  • --quiet/--verbose
  • --color

It's convenient when consuming pixi from within a docker image, as it's easy to configure a global behavior with env variables.

@hadim hadim added the ✨ enhancement Feature request label Jan 28, 2024
@ruben-arts
Copy link
Contributor

I like it! I think this can be easily done with https://docs.rs/clap/latest/clap/struct.Arg.html#method.env.

Do you know of any tools that also do this, that we can use as an example?

@hadim
Copy link
Contributor Author

hadim commented Jan 29, 2024

Do you know of any tools that also do this, that we can use as an example?

None that come to my mind.


Are you ok if I submit a PR? That should be quite a quick one.

@ruben-arts
Copy link
Contributor

Sure!, I trust you come up with a good abstraction and make sure it aligns between all cli commands that could use it.

ruben-arts pushed a commit that referenced this issue Jan 31, 2024
See #714 for context.

In short, it adds:

- `PIXI_COLOR` to configure `--color`
- `PIXI_LOCKED` to configure `--locked`
- `PIXI_FROZEN` to configure `--frozen`

I could not find a way to configure `--quiet` and `--verbose` since the
`Verbosity` struct belongs to `clap_verbosity_flag`.

I went the easy way for the name of the env variables, but please let me
know if you prefer something else.

---

TODO:

- [x] write doc for the new env variables.
@hadim hadim closed this as completed Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement Feature request
Projects
None yet
Development

No branches or pull requests

2 participants