Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
b05766f3
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
b05766f3
编写于
9月 21, 2019
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
set script language interpreter
上级
04fb441e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
25 deletion
+21
-25
src/test/test.go
src/test/test.go
+4
-20
src/utils/assert/assert.go
src/utils/assert/assert.go
+4
-2
src/utils/common/utils.go
src/utils/common/utils.go
+2
-2
src/utils/config/config.go
src/utils/config/config.go
+11
-1
未找到文件。
src/test/test.go
浏览文件 @
b05766f3
package
main
import
(
"fmt
"
"regexp
"
commonUtils
"github.com/easysoft/zentaoatf/src/utils/common
"
configUtils
"github.com/easysoft/zentaoatf/src/utils/config
"
)
var
content
=
`[4. steps]
step4...
line1...
line2...
[4. expects]
[5. steps]
step5...
[5. expects]
[6. steps]
step6...
[6. expects]
?>`
func
main
()
{
myExp
:=
regexp
.
MustCompile
(
`(?U)\[.*steps\]([\S\s]+)\[(.*steps.*|$)\]`
)
config
:=
configUtils
.
ReadCurrConfig
(
)
arr
:=
myExp
.
FindAllStringSubmatch
(
content
,
-
1
)
fmt
.
Printf
(
"%+v"
,
arr
)
commonUtils
.
SetFieldVal
(
config
,
"php"
,
"sdfdsf"
)
}
src/utils/assert/assert.go
浏览文件 @
b05766f3
...
...
@@ -7,6 +7,7 @@ import (
constant
"github.com/easysoft/zentaoatf/src/utils/const"
"github.com/easysoft/zentaoatf/src/utils/file"
langUtils
"github.com/easysoft/zentaoatf/src/utils/lang"
stringUtils
"github.com/easysoft/zentaoatf/src/utils/string"
zentaoUtils
"github.com/easysoft/zentaoatf/src/utils/zentao"
"io/ioutil"
"os"
...
...
@@ -164,9 +165,10 @@ func GetScriptType(scripts []string) []string {
ext
:=
path
.
Ext
(
script
)
if
ext
!=
""
{
ext
=
ext
[
1
:
]
if
!
stringUtils
.
FindInArr
(
ext
,
exts
)
{
exts
=
append
(
exts
,
extMap
[
ext
])
}
}
exts
=
append
(
exts
,
extMap
[
ext
])
}
return
exts
...
...
src/utils/common/utils.go
浏览文件 @
b05766f3
...
...
@@ -90,10 +90,10 @@ func GetFieldVal(config model.Config, key string) string {
return
val
}
func
SetFieldVal
(
config
model
.
Config
,
key
string
,
val
string
)
string
{
func
SetFieldVal
(
config
*
model
.
Config
,
key
string
,
val
string
)
string
{
key
=
stringUtils
.
Ucfirst
(
key
)
mutable
:=
reflect
.
ValueOf
(
&
config
)
.
Elem
()
mutable
:=
reflect
.
ValueOf
(
config
)
.
Elem
()
mutable
.
FieldByName
(
key
)
.
SetString
(
val
)
return
val
...
...
src/utils/config/config.go
浏览文件 @
b05766f3
...
...
@@ -38,6 +38,8 @@ func InitScreenSize() {
}
func
SaveConfig
(
conf
model
.
Config
)
error
{
fmt
.
Printf
(
"
\n
%s=%s
\n
"
,
"php"
,
conf
.
Php
)
fileUtils
.
MkDirIfNeeded
(
fileUtils
.
GetZtfDir
()
+
"conf"
)
conf
.
Version
=
constant
.
ConfigVer
...
...
@@ -152,6 +154,8 @@ func InputForSet() {
scripts
:=
assertUtils
.
GetCaseByDirAndFile
([]
string
{
"."
})
InputForScriptInterpreter
(
scripts
,
&
conf
)
fmt
.
Printf
(
"
\n
%s=%s
\n
"
,
"php"
,
conf
.
Php
)
SaveConfig
(
conf
)
PrintCurrConfig
()
}
...
...
@@ -183,7 +187,13 @@ func InputForScriptInterpreter(scripts []string, config *model.Config) {
for
_
,
lang
:=
range
langs
{
inter
:=
stdinUtils
.
GetInput
(
".*"
,
commonUtils
.
GetFieldVal
(
*
config
,
lang
),
"set_script_interpreter"
,
lang
)
commonUtils
.
SetFieldVal
(
*
config
,
lang
,
inter
)
fmt
.
Printf
(
"lang: %s, inter: %s"
,
lang
,
inter
)
commonUtils
.
SetFieldVal
(
config
,
lang
,
inter
)
}
fmt
.
Printf
(
"
\n
%s=%s
\n
"
,
"php"
,
(
*
config
)
.
Php
)
//}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录