asdf-vm / asdf-ruby

Ruby plugin for asdf version manager
https://github.com/asdf-vm/asdf
MIT License
659 stars 134 forks source link

Support for $HOME/.config/asdf/asdfrc? #203

Open brandondrew opened 3 years ago

brandondrew commented 3 years ago

The nature of this request depends on whether you already support keeping asdf's rc file inside $HOME/.config or not.

If so, that's awesome. Would you consider adding that to the README (mentioning that location along with $HOME/.asdfrc)?

If not, then would you consider adding support for that?

Or alternately, if you don't have time to add support for that, would you accept a PR that added such support?

cho-m commented 3 years ago

I think the location of asdf's config file is managed by the core asdf repo. The rc file should have already been processed/parsed before making use of this ruby plugin.

The ASDF_CONFIG_FILE environment variable is supposed to allow a user to change location of the file to any arbitrary file path: https://github.com/asdf-vm/asdf/blob/0f75c2162944f50120906ba61faa62783cecfcb5/lib/utils.bash#L371.

The main documentation for this is on the asdf homepage, which is also saved inside asdf repo as markdown file.

There is nothing specific to $HOME/.config. That would be up to the user to manage like adding the following into shell's environment:

export ASDF_CONFIG_FILE="$HOME/.config/asdf/asdfrc"

or for someone who wants to use XDG directories:

export ASDF_CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/asdfrc"
export ASDF_DEFAULT_TOOL_VERSIONS_FILENAME="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/tool-versions"
export ASDF_DATA_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/asdf"

The latter is what I use and it works for Ruby legacy_version_file.