You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
722 B
Bash

#!/usr/bin/env bash
. "$GVM_ROOT/scripts/functions"
[[ $1 != "" ]] ||
display_fatal "Please specifiy the alias name"
[[ $2 != "" ]] ||
display_fatal "Please specifiy the go version name"
[[ ! -f "$GVM_ROOT/environments/$1" ]] ||
display_fatal "Alias already exists!"
[[ -f "$GVM_ROOT/environments/$2" ]] ||
display_fatal "Target doesn't exist!"
mkdir -p "$GVM_ROOT/environments" ||
display_fatal "Could not create folder"
mkdir -p "$GVM_ROOT/gos/$1" ||
display_fatal "Could not create folder"
cp "$GVM_ROOT/environments/$2" "$GVM_ROOT/environments/$1" ||
display_fatal "Could copy environment"
echo "export gvm_alias_name=\"$1\"" >> "$GVM_ROOT/environments/$1" ||
display_fatal "Could not extend environment"