Skip to content

Instantly share code, notes, and snippets.

@Eun
Last active March 25, 2021 11:14
Show Gist options
  • Save Eun/6d6d3c835a7f0ba3f6431d671073960c to your computer and use it in GitHub Desktop.
Save Eun/6d6d3c835a7f0ba3f6431d671073960c to your computer and use it in GitHub Desktop.
selectgo
# 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