Last active
March 25, 2021 11:14
-
-
Save Eun/6d6d3c835a7f0ba3f6431d671073960c to your computer and use it in GitHub Desktop.
selectgo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to your config.fish | |
# make sure your $HOME looks like | |
# ls /home/tobias/go | |
# go1.14.6/ go1.15.2/ go1.15.4/ go1.16/ | |
function selectgo | |
set -l GOVERSIONS | |
pushd $HOME/go/ | |
for f in go* | |
set -l LINE $f | |
set -l LINE $LINE $f | |
set -l LINE $LINE OFF | |
set GOVERSIONS $LINE $GOVERSIONS | |
end | |
popd | |
set -l RESULT (/usr/bin/dialog --output-fd 1 --radiolist "Which go version you want?" 0 0 0 $GOVERSIONS) | |
if test -n (echo $RESULT) | |
set -x GOROOT $HOME/go/$RESULT | |
set -x PATH $GOROOT/bin $PATH | |
echo "Updated \$GOROOT to $GOROOT" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment