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.54k stars 84 forks source link

[Feature]: Allow running 'vfox use' inside shell scripts #320

Open tsmgodoi opened 2 weeks ago

tsmgodoi commented 2 weeks ago

1. Your usage scenarios?

I want to use vfox on setup scripts and on CI environments. But I've noticed I can't run it inside a shell script file (for example, a file named script.sh):

#/bin/bash
set -e
vfox use java@17
java --version

It will issue an error if I run it: java: command not found

If I run the script again, after the first error, it will run successfully this time.

2. What is your expected outcome?

I should be able to run vfox use and use the sdk version after that inside a shell script.

aooohan commented 1 week ago

https://github.com/version-fox/vfox/issues/253

Did you hook vfox into bash?

tsmgodoi commented 6 days ago

253

Did you hook vfox into bash?

Yes, I did.