Hey there! Is there any way to run a command with ...
# general
f
Hey there! Is there any way to run a command with a specific Pants environment once? Like setting an env variable or something? I do cross-platform development from an M1, and would like to override the default environment settings to be able to do a local build for just one
pants package
command, without having to mess with the files.
c
If it’s a one off, you could provide it on the command line. If it’s more frequent, you could put it into an
alias
Copy code
# pants.toml
[cli.alias]
env-command = "some pants config flags and goals etc"
then just
Copy code
> pants env-command ...
https://www.pantsbuild.org/docs/reference-cli#alias
f
That's cool! But what is the flag for specifying which environment to use?
c
see this section in the docs about how you can redirect the environment name target mapping through config: https://www.pantsbuild.org/docs/environments#toggle-use-of-an-environment-for-some-consumers so you can redirect that with command line flags for one-offs.