Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
38f6d181
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
大约 1 年 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
38f6d181
编写于
2月 10, 2022
作者:
m0_58228130
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
windows set interpreter path
上级
5db1192c
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
79 addition
and
48 deletion
+79
-48
cmd/command/main.go
cmd/command/main.go
+1
-1
internal/comm/consts/consts.go
internal/comm/consts/consts.go
+4
-3
internal/comm/helper/config/config.go
internal/comm/helper/config/config.go
+9
-0
internal/comm/helper/script/asset.go
internal/comm/helper/script/asset.go
+19
-0
internal/command/config/config.go
internal/command/config/config.go
+45
-43
internal/command/index.go
internal/command/index.go
+1
-1
未找到文件。
cmd/command/main.go
浏览文件 @
38f6d181
...
...
@@ -101,7 +101,7 @@ func main() {
case
"checkout"
,
"co"
:
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
2
:
]);
err
==
nil
{
action
.
Generate
(
productId
,
moduleId
,
suiteId
,
taskId
,
independentFile
,
commConsts
.
L
anguage
,
actionModule
)
action
.
Generate
(
productId
,
moduleId
,
suiteId
,
taskId
,
independentFile
,
l
anguage
,
actionModule
)
}
case
"set"
,
"-set"
:
...
...
internal/comm/consts/consts.go
浏览文件 @
38f6d181
...
...
@@ -4,6 +4,7 @@ const (
App
=
"ztf"
AppServer
=
"server"
AppAgent
=
"agent"
AppCommand
=
"cmd"
ConfigVersion
=
"3.0"
ConfigDir
=
"conf"
...
...
internal/comm/helper/config/config.go
浏览文件 @
38f6d181
...
...
@@ -60,3 +60,12 @@ func GetFieldVal(config commDomain.ProjectConf, key string) string {
return
val
}
func
SetFieldVal
(
config
*
commDomain
.
ProjectConf
,
key
string
,
val
string
)
string
{
key
=
stringUtils
.
UcFirst
(
key
)
mutable
:=
reflect
.
ValueOf
(
config
)
.
Elem
()
mutable
.
FieldByName
(
key
)
.
SetString
(
val
)
return
val
}
internal/comm/helper/script/asset.go
浏览文件 @
38f6d181
...
...
@@ -7,9 +7,11 @@ import (
fileUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/file"
langUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/lang"
logUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/log"
stringUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/string"
serverDomain
"github.com/aaronchen2k/deeptest/internal/server/modules/v1/domain"
"github.com/kataras/iris/v12"
"io/ioutil"
"path"
"regexp"
)
...
...
@@ -142,3 +144,20 @@ func addDir(pth string, parent *serverDomain.TestAsset) (dirNode *serverDomain.T
return
}
func
GetScriptType
(
scripts
[]
string
)
[]
string
{
exts
:=
make
([]
string
,
0
)
for
_
,
script
:=
range
scripts
{
ext
:=
path
.
Ext
(
script
)
if
ext
!=
""
{
ext
=
ext
[
1
:
]
name
:=
langUtils
.
ScriptExtToNameMap
[
ext
]
if
!
stringUtils
.
FindInArr
(
name
,
exts
)
{
exts
=
append
(
exts
,
name
)
}
}
}
return
exts
}
internal/command/config/config.go
浏览文件 @
38f6d181
...
...
@@ -3,12 +3,15 @@ package commandConfig
import
(
"fmt"
commConsts
"github.com/aaronchen2k/deeptest/internal/comm/consts"
commDomain
"github.com/aaronchen2k/deeptest/internal/comm/domain"
configUtils
"github.com/aaronchen2k/deeptest/internal/comm/helper/config"
scriptUtils
"github.com/aaronchen2k/deeptest/internal/comm/helper/script"
"github.com/aaronchen2k/deeptest/internal/comm/vari"
commonUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/common"
"github.com/aaronchen2k/deeptest/internal/pkg/lib/display"
fileUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/file"
i118Utils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/i118"
langUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/lang"
logUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/log"
stdinUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/stdin"
"github.com/aaronchen2k/deeptest/internal/server/modules/v1/repo"
...
...
@@ -93,15 +96,15 @@ func InputForSet() {
conf
.
Username
=
stdinUtils
.
GetInput
(
"(.{2,})"
,
conf
.
Username
,
"enter_account"
,
conf
.
Username
)
conf
.
Password
=
stdinUtils
.
GetInput
(
"(.{2,})"
,
conf
.
Password
,
"enter_password"
,
conf
.
Password
)
}
// Todo
//
if commonUtils.IsWin() {
//
var configInterpreter bool
//
stdinUtils.InputForBool(&configInterpreter, true, "config_script_interpreter")
//
if configInterpreter {
// scripts := assertUtils.GetCaseByDirAndFile([]string{"."}
)
//
InputForScriptInterpreter(scripts, &conf, "set")
//
}
//
}
if
commonUtils
.
IsWin
()
{
var
configInterpreter
bool
stdinUtils
.
InputForBool
(
&
configInterpreter
,
true
,
"config_script_interpreter"
)
if
configInterpreter
{
scripts
:=
scriptUtils
.
LoadScriptByProject
(
commConsts
.
WorkDir
)
InputForScriptInterpreter
(
scripts
,
&
conf
,
"set"
)
}
}
configUtils
.
SaveToFile
(
conf
,
commConsts
.
WorkDir
)
PrintCurrConfig
()
}
...
...
@@ -140,37 +143,36 @@ func getZenTaoBaseUrl(url string) string {
return
base
}
//func InputForScriptInterpreter(scripts []string, config *commDomain.ProjectConf, from string) bool {
// configChanged := false
// //
// langs := assertUtils.GetScriptType(scripts)
//
// for _, lang := range langs {
// if lang == "bat" || lang == "shell" {
// continue
// }
//
// deflt := configUtils.GetFieldVal(*config, lang)
// if from == "run" && deflt != "" { // already set when run, "-" means ignore
// continue
// }
//
// if deflt == "-" {
// deflt = ""
// }
// sampleOrDefaultTips := ""
// if deflt == "" {
// sampleOrDefaultTips = i118Utils.Sprintf("for_example", langUtils.LangMap[lang]["interpreter"]) + " " +
// i118Utils.Sprintf("empty_to_ignore")
// } else {
// sampleOrDefaultTips = deflt
// }
//
// configChanged = true
//
// inter := stdinUtils.GetInputForScriptInterpreter(deflt, "set_script_interpreter", lang, sampleOrDefaultTips)
// configUtils.SetFieldVal(config, lang, inter)
// }
//
// return configChanged
//}
func
InputForScriptInterpreter
(
scripts
[]
string
,
config
*
commDomain
.
ProjectConf
,
from
string
)
bool
{
configChanged
:=
false
langs
:=
scriptUtils
.
GetScriptType
(
scripts
)
for
_
,
lang
:=
range
langs
{
if
lang
==
"bat"
||
lang
==
"shell"
{
continue
}
deflt
:=
configUtils
.
GetFieldVal
(
*
config
,
lang
)
if
from
==
"run"
&&
deflt
!=
""
{
// already set when run, "-" means ignore
continue
}
if
deflt
==
"-"
{
deflt
=
""
}
sampleOrDefaultTips
:=
""
if
deflt
==
""
{
sampleOrDefaultTips
=
i118Utils
.
Sprintf
(
"for_example"
,
langUtils
.
LangMap
[
lang
][
"interpreter"
])
+
" "
+
i118Utils
.
Sprintf
(
"empty_to_ignore"
)
}
else
{
sampleOrDefaultTips
=
deflt
}
configChanged
=
true
inter
:=
stdinUtils
.
GetInputForScriptInterpreter
(
deflt
,
"set_script_interpreter"
,
lang
,
sampleOrDefaultTips
)
configUtils
.
SetFieldVal
(
config
,
lang
,
inter
)
}
return
configChanged
}
internal/command/index.go
浏览文件 @
38f6d181
...
...
@@ -20,7 +20,7 @@ func InitConfig() {
commandConfig
.
InitScreenSize
()
// internationalization
i118Utils
.
Init
(
commConsts
.
Language
,
commConsts
.
App
Server
)
i118Utils
.
Init
(
commConsts
.
Language
,
commConsts
.
App
Command
)
langUtils
.
GetExtToNameMap
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录