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

package script

上级 d4766f31
title: IP地址
desc: 含有多种实现的示例。
author: wwccss
version: 1.0
field: ip
instances:
- instance: privateC
note: C类IP地址
prefix: 192.168.
fields:
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
- instance: privateB
note: B类IP地址
prefix: 172.
fields:
- field: part2
range: 16-31
postfix: .
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
- instance: privateA
note: A类IP地址
prefix: 10.
fields:
- field: part2
range: 0-254
postfix: .
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
\ No newline at end of file
title: IP地址
desc: 含有多种实现的示例。
author: wwccss
version: 1.0
field: ip
instances:
- instance: privateC
note: C类IP地址
prefix: 192.168.
fields:
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
- instance: privateB
note: B类IP地址
prefix: 172.
fields:
- field: part2
range: 16-31
postfix: .
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
- instance: privateA
note: A类IP地址
prefix: 10.
fields:
- field: part2
range: 0-254
postfix: .
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
\ No newline at end of file
title: IP地址
desc: 含有多种实现的示例。
author: wwccss
version: 1.0
field: ip
instances:
- instance: privateC
note: C类IP地址
prefix: 192.168.
fields:
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
- instance: privateB
note: B类IP地址
prefix: 172.
fields:
- field: part2
range: 16-31
postfix: .
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
- instance: privateA
note: A类IP地址
prefix: 10.
fields:
- field: part2
range: 0-254
postfix: .
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
\ No newline at end of file
......@@ -62,45 +62,54 @@ fields:
- field: field_common # 默认的列表类型,通过逗号隔成若干区段。
range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30
prefix: int_ # 前缀
postfix: \t # 后缀
postfix: "\t" # 后缀,特殊字符加引号,否则无法解析。
- field: field_step # 区间可以指定步长。
range: 1-10:2, 1-2:0.1 # 1,3,5,7,9,1, 1.1,1.2...,2
postfix: "\t"
- field: field_random # 通过R属性指定随机。R属性和步长不能同时出现。
range: 1-10:R # 1,5,8...
postfix: "\t"
- field: field_file # 从一个文件中读取列表,并指定随机。
range: _users.txt:R # 该文件中一行作为一个元素,并随机。
range: users.txt:R # 该文件中一行作为一个元素,并随机。
postfix: "\t"
- field: field_loop # 自循环的字段。
range: a-z # a_b_c | d_e_f | g_h_i
loop: 3 # 循环三次
loopfix: _ # 每次循环的连接符。
postfix: "|" # 特殊字符加引号,否则无法解析。
postfix: "\t"
- field: field_repeat # 通过{}定义重复的元素。
range: user-1{3},[user2,user3]{2} # user-1,user-1,user-1,user2,user3,user2,user3
postfix: "\t"
- field: field_format # 通过格式化字符串输出。
range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。
format: "passwd%02d" # 用%2d补零,使密码整体保持8位,%2d默认补空格。
postfix: "\t"
- field: field_use_another_file # 可以引用其他的定义文件。
config: _numb_field.yaml # 引用当前目录下面的_numb_field.yaml文件里面的定义。
config: numb_field.yaml # 引用当前目录下面的numb_field.yaml文件里面的定义。
postfix: "\t"
- field: field_use_ranges_file # 引用其他的定义文件,该文件定义了多个range,他们共享了一些field层面的属性。
from: _numb_ranges.yaml # 引用当前目录下面的_numb_field.yaml文件里面的定义。
from: numb_ranges.yaml # 引用当前目录下面的numb_field.yaml文件里面的定义。
use: medium # 使用该文件中定义的medium分组。
postfix: "\t"
- field: field_use_instance # 引用其他的定义文件,该文件定义了多个实例。
from: system.ip.v1.yaml # 引用data/system/ip/v1.yaml
use: privateC,privateC # 使用该文件中定义的privateC和privateB两个实例。
postfix: "\t"
- field: field_use_excel # 从excel数据源里面取数据。
from: system.address.v1.china # 从data/system/address/v1.xlsx文件中读取名为china的工作簿。
select: city # 查询city字段。
where: state like '%山东%' # 条件是 省份包含山东。
where: state like '%山东%' # 条件是 省份包含山东。
postfix: "\t"
- field: field_with_children # 嵌套字段
fields:
......
title: zendata config syntax
desc:
# File composition
# zendata defines the format for each field in YAML file.
# YAML file is composed of file description and field definition.
# File description
# title: A short text to summarize the data type defined by this file.
# desc: Detailed text to describe the data type defined in this file, optional.
# author: Optional.
# version: Version number, optional.
# Field list
# Field is defined in fields.
# A YAML file contains one or more fields.
# Field list starts from -field.
# A child field can be defined by fields.
# Field definition
# field: Field name; letters, digits, underlines and dots only.
# range: List range; the most important definition.
# loop: The number of loops; define how many times a field can loop.
# loopfix: The connector for each loop.
# format: Support formatted output.
# prefix: Prefix of this field.
# postfix: Postfix of this field.
# length: The length of this field. If separators are not used, specify the field length in bytes.
# leftpad: Left-padded characters. If the length is not enough, specify a character. The default is space.
# rightpad: Right-padded characters. If the length is not enough, specify a character.
# config: Refer to the definition in other file.
# from: Refer to a definition file.
# use: Use instances defined in the referred file.
# select: If refer to an excel table, you can query a field in it.
# where: If refer to an excel table, you can use query conditions.
# range definition
# Use commas to connect elements. e.g. range: 1,2,3.
# Elements can be a range, e.g. range:1-10, A-Z.
# Use colons to define steps, e.g. range:1-10:2.
# Steps can be decimals, e.g. range: 1-10:0.1.
# Intervals can be set as random by R, e.g. range: 1-10:R. Set either random or a specified step.
# Use a file to specify a list, e.g. range: list.txt. If the file name is a relative path, it is based on the config file.
# Use {n} to repeat a element, e.g. range: user1{100},user2{100}.
# Use [], if intervals and elements are repeated, e.g. range: [user1,user2,user3]{100}.
author: zentao
version: 1.0
fields:
- field: field_common # The list type by default. Separated by commas.
range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30
prefix: int_ # Prefix
postfix: \t # Postfix
- field: field_step # Interval steps can be specified.
range: 1-10:2, 1-2:0.1 # 1,3,5,7,9,1, 1.1,1.2...,2
- field: field_random # Use R to specify randomly. Set either R or a specified step.
range: 1-10:R # 1,5,8...
- field: field_file # Read a list from a file and set it as random.
range: _users.txt:R # Using the lines of users.txt as range and set it as random.
- field: field_loop # Self-loop field.
range: a-z # a_b_c | d_e_f | g_h_i
loop: 3 # Loop three times.
loopfix: _ # The connector for each loop.
postfix: |
- field: field_repeat # Use {} to define repeated elements.
range: user-1{3},[user2,user3]{2} # user-1,user-1,user-1,user2,user3,user2,user3
- field: field_format # Output as formatted strings.
range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。
format: "passwd%02d"
- field: field_use_another_file # Other definition file can be referred.
config: _numb_field.yaml # Refer to the definition in nubmer.yaml of the current directory.
- field: field_use_ranges_file # Other definition file can be referred, in which more than one ranges are defined.
from: _numb_ranges.yaml # Refer to the definition in _numb_ranges.yaml of the current directory.
use: medium # use medium range.
- field: field_use_instance # Refer to other definition file which defines multiple instances.
from: system.ip.v1.yaml # Refer to data/system/ip/v1.yaml.
use: privateB,privateC # Use the two instances of privateC and privateB defined in this file.
- field: field_use_excel # Read the data from the data source of excel.
from: system.address.v1.china # Read the book named china in data/system/address/v1.xlsx.
select: city # Query the field city.
where: cityCode = 852 # Query condition.
- field: field_with_children # Embeded field.
fields:
- field: child1
range: a-z
prefix: part1_
postfix: '|'
- field: child2
range: A-Z
prefix: part2_
postfix: '|'
- field: child_with_child
prefix: part3_
postfix:
fields:
- field: field_grandson
prefix: int_
range: 10-20
postfix:
......@@ -24,4 +24,4 @@ fields:
from: system.ip.private.yaml # 引用data/system/ip/v1.yaml
use: all # 使用该文件中定义的privateC和privateB两个实例。
prefix: "[" # 复写前缀
postfix: "]" # 特殊字符加引号,否则无法解析
postfix: "]" # 特殊字符加引号,否则无法解析
\ No newline at end of file
title: table wp_posts
desc: ""
author: automated export
version: "1.0"
fields:
- field: post_title
note: 文章标题
fields:
- field: title1
type: list
range: "[标题A,TitleB]"
postfix: "-"
- field: title2
range: 1-999
format: "%03d"
- field: post_content
node: 文章内容
fields:
- field: field4.1
type: list
range: [Epic,Feature,Story]:R{1}
prefix: "<h5>"
postfix: ":</h5>"
- field: field4.2
postfix: "<br/>Aaron 2020/06/18"
fields:
- field: field4.2.1
loop: 3
fields:
- field: field4.2.1.1
postfix: "<br/>"
loop: 3
fields:
- field: field4.2.2
range: a-z:R
postfix: " "
loop: 6
- field: post_author
range: "1"
- field: post_status
range: "publish"
- field: post_date
range: "[2020-06-06 06:06:06]"
- field: post_date_gmt
range: "[2020-06-06 06:06:06]"
- field: post_modified
range: "[2020-06-06 06:06:06]"
- field: post_modified_gmt
range: "[2020-06-06 06:06:06]"
- field: guid
range: "[http://localhost:8080/?p=3800]"
- field: post_excerpt
range: ""
- field: to_ping
range: ""
- field: pinged
range: ""
- field: post_content_filtered
range: ""
......@@ -62,45 +62,54 @@ fields:
- field: field_common # 默认的列表类型,通过逗号隔成若干区段。
range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30
prefix: int_ # 前缀
postfix: \t # 后缀
postfix: "\t" # 后缀,特殊字符加引号,否则无法解析。
- field: field_step # 区间可以指定步长。
range: 1-10:2, 1-2:0.1 # 1,3,5,7,9,1, 1.1,1.2...,2
postfix: "\t"
- field: field_random # 通过R属性指定随机。R属性和步长不能同时出现。
range: 1-10:R # 1,5,8...
postfix: "\t"
- field: field_file # 从一个文件中读取列表,并指定随机。
range: _users.txt:R # 该文件中一行作为一个元素,并随机。
range: users.txt:R # 该文件中一行作为一个元素,并随机。
postfix: "\t"
- field: field_loop # 自循环的字段。
range: a-z # a_b_c | d_e_f | g_h_i
loop: 3 # 循环三次
loopfix: _ # 每次循环的连接符。
postfix: "|" # 特殊字符加引号,否则无法解析。
postfix: "\t"
- field: field_repeat # 通过{}定义重复的元素。
range: user-1{3},[user2,user3]{2} # user-1,user-1,user-1,user2,user3,user2,user3
postfix: "\t"
- field: field_format # 通过格式化字符串输出。
range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。
format: "passwd%02d" # 用%2d补零,使密码整体保持8位,%2d默认补空格。
postfix: "\t"
- field: field_use_another_file # 可以引用其他的定义文件。
config: _numb_field.yaml # 引用当前目录下面的_numb_field.yaml文件里面的定义。
config: number_field.yaml # 引用当前目录下面的number_field.yaml文件里面的定义。
postfix: "\t"
- field: field_use_ranges_file # 引用其他的定义文件,该文件定义了多个range,他们共享了一些field层面的属性。
from: _numb_ranges.yaml # 引用当前目录下面的_numb_field.yaml文件里面的定义。
from: number_ranges.yaml # 引用当前目录下面的number_field.yaml文件里面的定义。
use: medium # 使用该文件中定义的medium分组。
postfix: "\t"
- field: field_use_instance # 引用其他的定义文件,该文件定义了多个实例。
from: system.ip.v1.yaml # 引用data/system/ip/v1.yaml
use: privateC,privateC # 使用该文件中定义的privateC和privateB两个实例。
postfix: "\t"
- field: field_use_excel # 从excel数据源里面取数据。
from: system.address.v1.china # 从data/system/address/v1.xlsx文件中读取名为china的工作簿。
select: city # 查询city字段。
where: state like '%山东%' # 条件是 省份包含山东。
where: state like '%山东%' # 条件是 省份包含山东。
postfix: "\t"
- field: field_with_children # 嵌套字段
fields:
......
......@@ -62,45 +62,54 @@ fields:
- field: field_common # The list type by default. Separated by commas.
range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30
prefix: int_ # Prefix
postfix: \t # Postfix
postfix: "\t" # Postfix
- field: field_step # Interval steps can be specified.
range: 1-10:2, 1-2:0.1 # 1,3,5,7,9,1, 1.1,1.2...,2
postfix: "\t"
- field: field_random # Use R to specify randomly. Set either R or a specified step.
range: 1-10:R # 1,5,8...
postfix: "\t"
- field: field_file # Read a list from a file and set it as random.
range: _users.txt:R # Using the lines of users.txt as range and set it as random.
range: users.txt:R # Using the lines of users.txt as range and set it as random.
postfix: "\t"
- field: field_loop # Self-loop field.
range: a-z # a_b_c | d_e_f | g_h_i
loop: 3 # Loop three times.
loopfix: _ # The connector for each loop.
postfix: |
postfix: "\t"
- field: field_repeat # Use {} to define repeated elements.
range: user-1{3},[user2,user3]{2} # user-1,user-1,user-1,user2,user3,user2,user3
postfix: "\t"
- field: field_format # Output as formatted strings.
range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。
format: "passwd%02d"
postfix: "\t"
- field: field_use_another_file # Other definition file can be referred.
config: _numb_field.yaml # Refer to the definition in nubmer.yaml of the current directory.
config: number_field.yaml # Refer to the definition in number_field.yaml of the current directory.
postfix: "\t"
- field: field_use_ranges_file # Other definition file can be referred, in which more than one ranges are defined.
from: _numb_ranges.yaml # Refer to the definition in _numb_ranges.yaml of the current directory.
from: number_ranges.yaml # Refer to the definition in number_ranges.yaml of the current directory.
use: medium # use medium range.
postfix: "\t"
- field: field_use_instance # Refer to other definition file which defines multiple instances.
from: system.ip.v1.yaml # Refer to data/system/ip/v1.yaml.
use: privateB,privateC # Use the two instances of privateC and privateB defined in this file.
postfix: "\t"
- field: field_use_excel # Read the data from the data source of excel.
from: system.address.v1.china # Read the book named china in data/system/address/v1.xlsx.
select: city # Query the field city.
where: cityCode = 852 # Query condition.
postfix: "\t"
- field: field_with_children # Embeded field.
fields:
......
......@@ -121,12 +121,12 @@ func InputForSet() {
enCheck := ""
var numb string
if conf.Language == "en" {
if conf.Language == "zh" {
enCheck = "*"
numb = "1"
}
zhCheck := ""
if conf.Language == "zh" {
if conf.Language == "en" {
zhCheck = "*"
numb = "2"
}
......@@ -134,9 +134,9 @@ func InputForSet() {
numbSelected := stdinUtils.GetInput("(1|2)", numb, "enter_language", enCheck, zhCheck)
if numbSelected == "1" {
conf.Language = "en"
} else {
conf.Language = "zh"
} else {
conf.Language = "en"
}
SaveConfig(conf)
......
-- DROP TABLE IF EXISTS `zt_action`;
CREATE TABLE IF NOT EXISTS `zt_action` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`objectType` varchar(30) NOT NULL default '',
`objectID` mediumint(8) unsigned NOT NULL default '0',
`product` varchar(255) NOT NULL,
`project` mediumint(9) NOT NULL,
`actor` varchar(100) NOT NULL default '',
`action` varchar(30) NOT NULL default '',
`date` datetime NOT NULL,
`comment` text NOT NULL,
`extra` text NOT NULL,
`read` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `date` (`date`),
KEY `actor` (`actor`),
KEY `project` (`project`),
KEY `objectID` (`objectID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- DROP TABLE IF EXISTS `zt_block`;
CREATE TABLE IF NOT EXISTS `zt_block` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`account` char(30) NOT NULL,
`module` varchar(20) NOT NULL,
`title` varchar(100) NOT NULL,
`source` varchar(20) NOT NULL,
`block` varchar(20) NOT NULL,
`params` text NOT NULL,
`order` tinyint(3) unsigned NOT NULL DEFAULT '0',
`grid` tinyint(3) unsigned NOT NULL DEFAULT '0',
`height` smallint(5) unsigned NOT NULL DEFAULT '0',
`hidden` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `accountModuleOrder` (`account`,`module`,`order`),
KEY `account` (`account`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
\ No newline at end of file
title: number
desc:
author: wwccss
version: 1.0
field: number
note: 数值类型数据
prefix: "'"
postfix: "'"
loop: 2
loopfix: ","
ranges:
small: 1-9
medium: 11-99
large: 10001-99999
title: number
desc:
author: wwccss
version: 1.0
field: number
note: 数值类型数据
range: 11-99
prefix: "'"
postfix: "'"
loop: 2
loopfix: ","
\ No newline at end of file
title: test
desc: This is a test file.
author: zentao
version: 1.0
fields:
- field: char
range: a-z
- field: numb
range: 1-9
- field: basic
note: 基本属性
range: a-z
loop: 3
loopfix: ","
prefix: "'"
postfix: "'"
- field: step
note: 指定步长
range: 1-10:2, 1-2:0.1
loop: 3
loopfix: ","
prefix: "'"
postfix: "'"
- field: random
note: R属性指定随机
range: 1-10:R
loop: 6
loopfix: ","
\ No newline at end of file
title: test
desc: This is a test file.
author: zentao
version: 1.0
fields:
- field: int
note: 基本属性
range: 1-10
format: "%+d"
postfix: ", "
- field: float
note: 指定步长
range: 1.0-2.0:0.1
format: "%.3f"
postfix: ", "
- field: char
note: R属性指定随机
range: a-z:2
format: "char is %s"
\ No newline at end of file
title: test
desc: This is a test file.
author: zentao
version: 1.0
fields:
- field: basic
note: inherit from basic field
loop: 2
loopfix: " "
prefix: "{"
postfix: "}"
- field: refer2
note: inherit from reference field
loop: 2
prefix: "="
postfix: "-"
\ No newline at end of file
title: test
desc: This is a test file.
author: zentao
version: 1.0
fields:
- field: nested
fields:
- field: field1.1
type: list
range: 1-9
postfix: ". "
- field: field1.2
prefix: "'"
postfix: "'"
loop: 2
loopfix: ","
fields:
- field: field1.2.1
type: list
range: X-Z
- field: field1.2.2
type: list
range: 1-9
loop: 2
\ No newline at end of file
title: test
desc: This is a test file.
author: zentao
version: 1.0
fields:
- field: refer
from: system.ip.v1.yaml
use: privateC
- field: refer2
from: _numb.yaml
use: small,large
loop: 4
loopfix: " "
prefix: "-"
postfix: "-"
- field: excel
from: system.address.v1.city
select: name
where: state like '%山东%'
prefix: "'"
postfix: "'"
loop: 3
loopfix: "-"
\ No newline at end of file
title: test
desc: This is a test file.
author: zentao
version: 1.0
fields:
- field: objectype
range: [bug,task,story]:2{3},[testcase]{2}
postfix: " "
- field: objectid
range: 1.0-9.0:3{2}
postfix: " "
- field: action
range: [create,resolve,close]{2},[create,finish,close]{10}
\ No newline at end of file
package main
import (
"fmt"
"strings"
)
func main() {
//urlStr := "http://127.0.0.1:8848/?F=field3&lines=12"
//file := "test/code/test.yaml"
//
//yamlContent, _ := ioutil.ReadFile(file)
//yamlContent = gen.ReplaceSpecialChars(yamlContent)
//
//data := url.Values{"config": {string(yamlContent)}}
//httpUtils.PostForm(urlStr, data)
a := "我的"
b := "dsfdsfdf是我的吗"
index := strings.Index(a, b)
fmt.Println(index)
}
title: test
desc: This is a test file.
author: zentao
version: 1.0
fields:
- field: field1
note: 字符区间步长、随机
range: a-f:R,0-9:2
format: "%3d"
loop: 3
loopfix: ","
prefix: "["
postfix: "] "
- field: field2
note: 单词、重复
range: [bug,task,story]:2{2},[testcase]{2}
postfix: " "
- field: field3
note: 引用同级目录中的yaml文件,取small和large两个分组的值
from: demo/numb.yaml
use: large
postfix: " "
expect: 101,102,103...
- field: field4
note: 引用內置IP地址数据定义中的C类地址
from: system.ip.v1.yaml
use: privateC
postfix: " "
expect: 192.168.0.1 ...​
- field: field5
node: 检索、引用內置城市Excel中的数据
from: system.address.v1.city
select: name
where: state like '%西藏%'
postfix: " "
expect: 青岛、济南 ...​
- field: fieldA
node: 嵌套字段
fields:
- field: fieldA.1
type: list
range: 1-999
postfix: "."
- field: fieldA.2
prefix: '['
postfix: ']'
loop: 2
loopfix: ","
fields:
- field: fieldA.2.1
type: list
range: X-Z
- field: fieldA.2.2
type: list
range: 1-9
loop: 2
#!/usr/bin/env php
<?php
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
getZDCmd();
if (!function_exists('simplexml_load_file')) {
print("simplexml_load_file missing, pls use 'sudo apt-get install php7.0-simplexml' to install\n");
}
\ No newline at end of file
<?php
function getZDCmd()
{
$os = strtolower(PHP_OS);
$is64bit = is64bit();
print("$os $is64bit \n");
$ret = '';
if ($is64bit && $os == 'darwin') {
$ret = './zd-mac';
} else if ($is64bit && $os == 'linux') {
$ret = './zd-linux';
} else if ($is64bit && strpos($os,"win") > -1) {
$ret = 'zd-amd64.exe';
} else if (!$is64bit && strpos($os,"win") > -1) {
$ret = 'zd-x86.exe';
}
if ($ret == '') {
die('Please test on 64/32 bits windows, 64 bits linux or mac system.\n');
} else {
print("$ret \n");
}
return $ret;
}
function is64bit() {
$int = "9223372036854775807";
$int = intval($int);
if ($int == 9223372036854775807) {
/* 64bit */
return true;
} else if ($int == 2147483647) {
/* 32bit */
return false;
} else {
/* error */
return false;
}
}
>> 104
>> field: id
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=generate yaml from database table ddl
cid=0
pid=0
[group]
1. count >>
2. line of id field >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -i ../test/definition/_ddl.sql -o ../test/output", $output);
$str = join("\n", $output);
print("$str\n");
$content = file_get_contents('../test/output/zt_action.yaml');
$arr = explode("\n", $content);
$count = sprintf("%d", count($arr));
print(">> $count\n");
$line = $arr[5];
print(">> $line\n");
\ No newline at end of file
>> '济南市-青岛市-淄博市'
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=query excel
cid=0
pid=0
[group]
1. output >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -y ../test/definition/refer.yaml -c 7 -field excel -o ../test/output/output.txt -f text", $output);
print(">> $output[0]\n");
\ No newline at end of file
>> Usage:
>> 3
>> 'a,b,c'
>> output.txt
>> '1,3,5'
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=basic
cid=0
pid=0
[group]
1. usage output >>
2. basic output >>
3. step output >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -h", $output);
print(">> $output[0]\n");
$output = [];
exec("$cmd -y ../test/definition/basic.yaml -c 3 -field basic -o ../test/output/output.txt -f text", $output);
$count = sprintf("%d", count($output));
print(">> $count\n");
print(">> $output[0]\n");
$output = [];
exec('ls ../test/output/output.txt -f text', $output);
print(">> $output[0]\n");
$output = [];
exec("$cmd -y ../test/definition/basic.yaml -c 7 -field step -o ../test/output/output.txt -f text", $output);
print(">> $output[0]\n");
\ No newline at end of file
>> 2, 1.100, char is c
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=defferent data type with format
cid=0
pid=0
[group]
1. defferent data type with format >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -y ../test/definition/format.yaml -c 3 -field int,float,char -o ../test/output/output.txt -f text", $output);
print(">> $output[1]\n");
\ No newline at end of file
>> {a b}
>> ='1,2' '3,4'-
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=field inherit
cid=0
pid=0
[group]
1. inherit from basic field >>
2. inherit from reference field >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -d ../test/definition/basic.yaml -y ../test/definition/inherit.yaml -c 3 -field basic -o ../test/output/output.txt -f text", $output);
print(">> $output[0]\n");
$output = [];
exec("$cmd -d ../test/definition/refer.yaml -y ../test/definition/inherit.yaml -c 3 -field refer2 -o ../test/output/output.txt -f text", $output);
print(">> $output[0]\n");
\ No newline at end of file
>> 1. 'X12,Y34'
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=field nested
cid=0
pid=0
[group]
1. output >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -y ../test/definition/nested.yaml -c 3 -field nested", $output);
print(">> $output[0]\n");
\ No newline at end of file
>> 6
>> is random
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=random
cid=0
pid=0
[group]
1. output >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -y ../test/definition/basic.yaml -c 7 -field random -o ../test/output/output.txt -f text", $output);
$line = $output[0];
print("Got $line\n");
// 1,2,2,2,8,1
$numbs = explode(",", $line);
$count = sprintf("%d", count($numbs));
print(">> $count\n");
$result = 'not random';
$i = 0;
for($i = 0; $i < $count; $i++) {
if ($numbs[$i] != $i + 1) { // at lease one not equal sequence numb 1,2,3,4,5,6
$result = 'is random';
break;
}
}
print(">> $result\n");
\ No newline at end of file
>> 192.168.0.1
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=reference
cid=0
pid=0
[group]
1. output >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -y ../test/definition/refer.yaml -c 7 -field refer -o ../test/output/output.txt -f text", $output);
print(">> $output[0]\n");
\ No newline at end of file
>> story 1.0 create
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=repeat
cid=0
pid=0
[group]
1. output >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -y ../test/definition/repeat.yaml -c 7 -o ../test/output/output.txt -f text", $output);
print(">> $output[3]\n");
\ No newline at end of file
>> 4
>> a1
>> a
>> INSERT INTO (char,numb) VALUES('a','1');
>> a
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=basic
cid=0
pid=0
[group]
1. count of text >>
2. value from text >>
3. value from json >>
4. value from xml >>
5. first line of sql >>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php';
$cmd = getZDCmd();
$output = [];
exec("$cmd -y ../test/definition/basic.yaml -c 3 -field char,numb -o ../test/output/output.txt -f text", $output);
$content = file_get_contents('../test/output/output.txt');
$arr = explode("\n", $content);
$count = sprintf("%d", count($arr));
print(">> $count\n");
print(">> $arr[0]\n");
$output = [];
exec("$cmd -y ../test/definition/basic.yaml -c 3 -field char,numb -o ../test/output/output.json -f json", $output);
$content = file_get_contents('../test/output/output.json');
$json = json_decode($content);
$val = $json[0][0];
print(">> $val\n");
$output = [];
exec("$cmd -y ../test/definition/basic.yaml -c 3 -field char,numb -o ../test/output/output.sql -f sql", $output);
$content = file_get_contents('../test/output/output.sql');
$arr = explode("\n", $content);
print(">> $arr[0]\n");
if (!function_exists('simplexml_load_file')) {
print("lib simplexml_load_file missing, pls use 'sudo apt-get install php7.0-simplexml' to install\n");
} else {
$output = [];
exec("$cmd -y ../test/definition/basic.yaml -c 3 -field char,numb -o ../test/output/output.xml -f xml", $output);
$xml = simplexml_load_file('../test/output/output.xml'); // sudo apt-get install php7.0-simplexml
$val = $xml->table->row->col[0];
print(">> $val\n");
}
rm -rf build
mkdir build
cp -r data build/
cp -r demo build/
go-bindata -o=res/res.go -pkg=res res/ res/doc
......
cp -r data build/
rm -rf build/data/system/domain
rm -rf build/data/system/email
rm -rf build/data/system/misc
rm -rf build/data/system/name
cp -r demo build/
rm -rf build/demo/out
cd build
rm -rf zendata
mkdir -p zendata/1.1
mkdir -p zendata/1.1/win32
mkdir -p zendata/1.1/win64
mkdir -p zendata/1.1/linux
mkdir -p zendata/1.1/mac
cp zd-x86.exe zd.exe
zip -r zd-win-x86-1.1.zip zd.exe data demo
zip -r zd.zip zd.exe data demo
cp zd.zip zendata/1.1/win32
rm zd.exe
rm zd.zip
cp zd-amd64.exe zd.exe
zip -r zd-win-amd64-1.1.zip zd.exe data demo
zip -r zd.zip zd.exe data demo
cp zd.zip zendata/1.1/win64
rm zd.exe
rm zd.zip
cp zd-linux zd
tar -zcvf zd-linux-1.1.tar.gz zd data demo
tar -zcvf zd.tar.gz zd data demo
cp zd.tar.gz zendata/1.1/linux
rm zd
rm zd.tar.gz
cp zd-mac zd
zip -r zd-mac-1.1.zip zd data demo
zip -r zd.zip zd data demo
cp zd.zip zendata/1.1/mac
rm zd
rm zd.zip
zip -r zendata-1.1.zip zendata
cd ..
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册