1 Star 1 Fork 1

U语言组织 / U语言

forked from 秋来冬风 / U语言 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
set.go 840 Bytes
一键复制 编辑 原始数据 按行查看 历史
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
// setCmd represents the set command
var setCmd = &cobra.Command{
Use: "set",
Short: `set设置使用的编译器版本
示例:
upam set v0.4.3`,
Long: `set设置使用的编译器版本
示例:
upam set v0.4.3`,
Run: func(cmd *cobra.Command, args []string) {
typ := istip(args)
err := SetComplier(typ)
if err != nil {
cmd.PrintErrf("%s\n", err.Error())
}
},
}
func init() {
rootCmd.AddCommand(setCmd)
}
func SetComplier(typ string) error {
err := checkVersion(typ) //检查版本号是否正确
if err != nil {
return err
}
if !IsVersion(typ) { //检查指定版本是否安装
return fmt.Errorf("版本 %s 没有下载并安装", typ)
}
err = Link(typ) //将 $U_HOME\sdk\link 设置为指定编译器版本的目录符号链接
return err
}
Go
1
https://gitee.com/u-language/u-language.git
git@gitee.com:u-language/u-language.git
u-language
u-language
U语言
a214d6007862

搜索帮助

53164aa7 5694891 3bd8fe86 5694891