未验证 提交 38d2264c 编写于 作者: P Phodal Huang

feat: add multiple API support

上级 a6fc2825
......@@ -11,6 +11,7 @@ import (
"log"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
)
......@@ -76,7 +77,20 @@ var apiCmd *cobra.Command = &cobra.Command{
}
func replacePackage(content string) string {
return strings.ReplaceAll(content, apiCmdConfig.RemovePackageNames, "")
var packagegsReggex string
packageNameArray := strings.Split(apiCmdConfig.RemovePackageNames, ",")
for index, name := range packageNameArray {
packagegsReggex = packagegsReggex + strings.ReplaceAll(name, ".", "\\.")
if index != len(packageNameArray) - 1 {
packagegsReggex = packagegsReggex + "|"
}
}
re, _ := regexp.Compile(packagegsReggex)
return re.ReplaceAllString(content, "")
//return strings.ReplaceAll(content, apiCmdConfig.RemovePackageNames, "")
}
func init() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册