version-fox / vfox

A cross-platform and extendable version manager with support for Java, Node.js, Flutter, .Net & more
https://vfox.lhan.me
Apache License 2.0
2.46k stars 83 forks source link

[Feature]: Do not print and set environment variables when there is no need to set environment variables when executing vfox env -s xxx #273

Closed jan-bar closed 1 month ago

jan-bar commented 1 month ago

1. Your usage scenarios?

When there is no need to set environment variables and you don’t want the terminal to set environment variables every time you execute a command

2. What is your expected outcome?

image

Is it possible to achieve this function by changing the code in the picture above? I’m not sure if there will be bugs after the modification.

aooohan commented 1 month ago

Is it possible to achieve this function by changing the code in the picture above?

This change is a bit complicated, we just need to determine if sdkCurrentPaths is empty, as currently only PATH is being set repeatedly.

https://github.com/version-fox/vfox/blob/099640e4783d0d53edb02d5f31d5909f61a4a202/cmd/commands/env.go#L132

jan-bar commented 1 month ago

This change is a bit complicated, we just need to determine if sdkCurrentPaths is empty, as currently only PATH is being set repeatedly.

This is simpler. If there are no problems with this requirement and change, I look forward to the boss completing this change.