moovweb / gvm

Go Version Manager
http://github.com/moovweb/gvm
MIT License
9.86k stars 520 forks source link

Fish shell support #137

Open pyprism opened 9 years ago

pyprism commented 9 years ago

Its would be great if u could add support for Fish shell

emilevauge commented 9 years ago

+1 :)

buaazp commented 9 years ago

need too

hacpai commented 9 years ago

Fish is a good shell, I think it should add support for it.

ebramanti commented 8 years ago

Anyone worked this out?

ebramanti commented 8 years ago

I've been using Bass as a way to get gvm working in fish. I'm still working to get gvm use to work, but I'll update this post when I do. It's pretty glitchy overall, but its working for now.

To setup, run the normal install command in bash:

bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

Then, add gvm.fish to your functions folder:

function gvm
  bass source ~/.gvm/scripts/gvm ';' gvm $argv
end

You should be up and running!

alanhoff commented 8 years ago

+1

davidbarton commented 8 years ago

+1

egoist commented 8 years ago

@jadengore Yep, that's a workaround for people using fish :)

ebramanti commented 8 years ago

@egoist gvm use still does not work for me, but it's something!

nrkfeller commented 8 years ago

+1 - the regular shell makes me sad

simonszu commented 7 years ago

+1 - the workaround has no persistent gvm use between shell sessions.

nerosnm commented 6 years ago

+1 - gvm install doesn't work for me using this method, I have to drop into bash

rodrigomageste commented 4 years ago

I add an file named gvm.fish in ~/.config/fish/functions/ folder with:

function gvm
    set after_env (mktemp -t env)
    set path_env (mktemp -t env)

    bash -c "source ~/.gvm/scripts/gvm && gvm $argv && printenv > $after_env"

    # remove any pre-existing .gvm paths
    for elem in $PATH
        switch $elem
            case '*/.gvm/*'
                # ignore
            case '*'
                echo "$elem" >> $path_env
        end
    end

    for env in (cat $after_env)
        set env_name (echo $env | sed s/=.\*//)
        set env_value (echo $env | sed s/.\*=//)
        switch $env_name
            case 'PATH'
                for elem in (echo $env_value | tr ':' '\n')
                    switch $elem
                        case '*/.gvm/*'
                            echo "$elem" >> $path_env
                    end
                end
            case '*'
                switch $env_value
                    case '*/.gvm/*'
                        eval set -g $env_name $env_value > /dev/null
                end
        end
    end
    set -gx PATH (cat $path_env) ^ /dev/null

    rm -f $after_env
    rm -f $path_env
end

And in my file ~/.config/fish/config.fish I add the following line:

bass source ~/.gvm/environments/default

Its works for me!