make asdf follow the XDG spec

Oct 20, 2023

To make asdf roughly follow the XDG spec:

if [[ -d $HOME/.local/share/asdf ]]; then
    # I really wish asdf supported XDG_CONFIG:
    # so let's set a bunch of variables that let us pretend it does
    export ASDF_DIR="$HOME/.local/share/asdf"
    export ASDF_DATA_DIR="$HOME/.local/share/asdf"

    . "$ASDF_DIR/"
    . "$ASDF_DIR/completions/asdf.bash"

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

    export ASDF_NPM_DEFAULT_PACKAGES_FILE="$HOME/.config/asdf/default-npm-packages"

    export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="$HOME/.config/asdf/default-python-packages"

Once you have those variables set, you should have asdf config in ~/.config/asdf and asdf binaries and package installs in ~/.local/share/asdf.

If you already have asdf installed to the default location of ~/.asdf, you can move that directory into ~/.config/asdf and run asdf reshim.

this issue tracks asdf support of the XDG spec

↑ up