提交 b7a92a2d 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix issue#3348

上级 e3795036
......@@ -43,12 +43,18 @@ desc:
# select: 如果引用的文件是excel表,可以查询里面的某一个字段。
# where: 如果引用的文件是excel表,可以使用查询条件。
# loop定义
# 可以使用一个数字来指定字段循环的次数,比如loop:2。
# 可以使用区间来定义字段循环的次数。比如loop:2-10。
# range定义
# 使用逗号连接不同的元素。比如 range: 1,2,3
# 元素也可以是一个区间。比如 range:1-10, A-Z
# 使用逗号连接不同的元素。比如 range: 1,2,3
# 元素也可以是一个区间。比如 range:1-10, A-Z
# 区间可以通过冒号:来指定步长。比如 range:1-10:2。
# 步长可以是小数。比如 range: 1-10:0.1
# 步长可以是小数。比如 range: 1-10:0.1。
# 步长可以是负数。比如 range:100-1:-1。
# 区间可以通过R来指定随机。比如 range: 1-10:R,随机和步长只能二选一。
# 可以通过一个文件来指定列表。比如range: list.txt。文件名是相对路径时,以配置文件为基准计算。
# 可以通过{n}的方式来重复某一个元素。比如 range: user1{100},user2{100}
......
......@@ -48,15 +48,16 @@ $>zd.exe -d demo/default.yaml -o test.sql -t user -s mysql --trim # Remove th
$>zd.exe -i demo/zentao.sql -o db # Generate YAML files for each table by parsing zentao.sql.
$>zd.exe -c demo/default.yaml -i test.txt --decode # Parse the file specified by -i according to the config of -d.
$>zd.exe -l # List all build-in data types.
$>zd.exe -v system.address.v1 # View data types in build-in Excel file system/address/v1.xlsx.
$>zd.exe -v system.address.v1.china # View data items in Excel sheet "china".
$>zd.exe -v system.ip.v1.yaml # View data items in build-in instances。
$>zd.exe -l # List all build-in data types.
$>zd.exe -v system.address.v1 # View data types in build-in Excel file system/address/v1.xlsx.
$>zd.exe -v system.address.v1.china # View data items in Excel sheet "china".
$>zd.exe -v system.ip.v1.yaml # View data items in build-in instances。
Service Example:
$zd.exe -p 80 # Listen port 80. Use the directory of zd.exe as the root.
$zd.exe -p 80 -R d:\zd\config # Listen port 80. Use d:\zd\config as the root.
$zd.exe -p 80 # Listen port 80. Use the directory of zd.exe as the root.
$zd.exe -p 80 -R d:\zd\config # Listen port 80. Use d:\zd\config as the root.
/home/user/zd/config
Client Call:
......
此差异已折叠。
......@@ -20,19 +20,19 @@ import (
func InitConfig() {
vari.ExeDir = fileUtils.GetExeDir()
CheckConfigPermission()
constant.ConfigFile = vari.ExeDir + constant.ConfigFile
if commonUtils.IsWin() {
shellUtils.ExeShell("chcp 65001")
}
constant.ConfigFile = vari.ExeDir + constant.ConfigFile
vari.Config = getInst()
i118Utils.InitI118(vari.Config.Language)
}
func SaveConfig(conf model.Config) error {
fileUtils.MkDirIfNeeded(fileUtils.GetExeDir() + "conf")
fileUtils.MkDirIfNeeded(vari.ExeDir + "conf")
conf.Version = constant.ConfigVer
......@@ -74,7 +74,7 @@ func ReadCurrConfig() model.Config {
return config
}
ini.MapTo(&config, constant.ConfigFile)
ini.MapTo(&config, configPath)
return config
}
......
package fileUtils
import (
"fmt"
"github.com/easysoft/zendata/res"
commonUtils "github.com/easysoft/zendata/src/utils/common"
constant "github.com/easysoft/zendata/src/utils/const"
......@@ -116,7 +117,7 @@ func GetExeDir() string { // where zd.exe file in
arg1 := strings.ToLower(os.Args[0])
name := filepath.Base(arg1)
if strings.Index(name, "ztf") == 0 && strings.Index(arg1, "go-build") < 0 {
if strings.Index(name, "zd") == 0 && strings.Index(arg1, "go-build") < 0 {
p, _ := exec.LookPath(os.Args[0])
if strings.Index(p, string(os.PathSeparator)) > -1 {
dir = p[:strings.LastIndex(p, string(os.PathSeparator))]
......@@ -128,7 +129,7 @@ func GetExeDir() string { // where zd.exe file in
dir, _ = filepath.Abs(dir)
dir = AddSepIfNeeded(dir)
//fmt.Printf("Debug: Launch %s in %s \n", arg1, dir)
fmt.Printf("Debug: Launch %s in %s \n", arg1, dir)
return dir
}
......
......@@ -45,8 +45,8 @@ func PrintUsage() {
regx, _ = regexp.Compile(`zd.exe`)
usage = regx.ReplaceAllString(usage, "zd")
regx, _ = regexp.Compile(`d:`)
usage = regx.ReplaceAllString(usage, "/home/user")
regx, _ = regexp.Compile(`d:/zd/config `)
usage = regx.ReplaceAllString(usage, "/home/user/zd/config")
}
fmt.Printf("%s\n", usage)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册