asdf icon indicating copy to clipboard operation
asdf copied to clipboard

Display the global version of a given tool

Open fuse opened this issue 3 years ago • 1 comments

Current problem

We currently have a shell script in charge of running our linter (rubocop for ruby). We want to fallback to the global version of ruby if rubocop has not been installed for a particular version of ruby.

Example:

My projet is using 2.7.2, my global version is 3.1.0. Instead of just failing if rubocop has not been installed for 2.7.2 if want to try with 3.1.0.

I was surprised not not find a command to get the global version.

Describe the proposed solution

I would expect the global command to just print the current global version if there is no argument passed. With argument it would just set the version, as it currently does.

$ asdf global ruby
ruby            3.1.0

Describe similar asdf features and why they are not sufficient

The closer command may be asdf current ruby but in that case it will print the ruby version of the project, which is not what we need.

Describe other workarounds you've considered

Currently I just read the ~/.tool-versions

grep ruby ~/.tool-versions | cut -d' ' -f2

fuse avatar Oct 04 '22 10:10 fuse

$(cd $HOME; asdf global ruby) is the simplest command that I can think of off the top of my head. The whole concept of global and local was bolted on after the fact and doesn't fit with how it works. Global is nothing more than "version in the top most parent directory".

I'd actually rather phase out the global vs local terminology than support this.

Stratus3D avatar Oct 11 '22 15:10 Stratus3D