MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / templatesClone

Function templatesClone

cli/cmd/common/template.go:132–162  ·  view source on GitHub ↗

clone模版repo

()

Source from the content-addressed store, hash-verified

130
131// clone模版repo
132func templatesClone() error {
133 templatePath := filepath.Join(config.SmartIdeHome, golbalModel.TMEPLATE_DIR_NAME)
134 templateGitPath := filepath.Join(templatePath, ".git")
135 templatesGitIsExist := common.IsExist(templateGitPath)
136
137 // 通过判断.git目录存在,执行git pull,保持最新
138 if templatesGitIsExist {
139 err := common.EXEC.Realtime(`
140git checkout -- *
141git pull
142 `, templatePath)
143 if err != nil {
144 return err
145 }
146
147 } else {
148 err := os.RemoveAll(templatePath)
149 if err != nil {
150 return err
151 }
152
153 command := fmt.Sprintf("git clone %v %v", config.GlobalSmartIdeConfig.TemplateActualRepoUrl, templatePath)
154 err = common.EXEC.Realtime(command, "")
155 if err != nil {
156 return err
157 }
158
159 }
160
161 return nil
162}
163
164// 打印 service 列表
165func printTemplates(newType []templateModel.TemplateTypeInfo) {

Callers 1

GetTemplateSettingFunction · 0.70

Calls 3

IsExistMethod · 0.80
RealtimeMethod · 0.80
JoinMethod · 0.45

Tested by

no test coverage detected