#!/bin/env fish
begin
    set -l dir (status dirname)
    source "$dir/../../Scripts/software.fish"

    function installSW
        curl https://pyenv.run | bash
    end

    function configureSW -V dir
        source "$dir/../bash/profile.fish"
        source "$dir/../fish/profile.fish"

        begin
            printf %s\n "" \
                'export PYENV_ROOT="$HOME/.pyenv"' \
                'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' \
                'eval "$(pyenv init -)"'
        end | installBashProfile pyenv >/dev/null

        if type -q fish
            installFishProfile pyenv pyenv "pyenv init - | source"
        end
    end

    runInstaller $argv
end