Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
d9b212fb
Z
zendata
项目概览
易企天创
/
zendata
9 个月 前同步成功
通知
17
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zendata
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d9b212fb
编写于
9月 21, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update resource
上级
bc4a7dc4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
20 addition
and
20 deletion
+20
-20
demo/default.yaml
demo/default.yaml
+2
-2
res/en/sample.yaml
res/en/sample.yaml
+2
-2
res/zh/sample.yaml
res/zh/sample.yaml
+2
-2
src/gen/decode.go
src/gen/decode.go
+3
-3
src/gen/definition.go
src/gen/definition.go
+2
-2
src/gen/output.go
src/gen/output.go
+1
-1
src/model/definition.go
src/model/definition.go
+6
-6
src/utils/string/string.go
src/utils/string/string.go
+2
-2
未找到文件。
demo/default.yaml
浏览文件 @
d9b212fb
...
...
@@ -94,8 +94,8 @@ fields:
postfix
:
"
\t
"
-
field
:
field_length
# 指定宽度。
range
:
1-9
# 001,002,003..., 099,100
width
:
3
# 包含前后缀的宽度。
range
:
1-9
9
# 01\t,02\t,03\t..., 99\t
length
:
3
# 包含前后缀的宽度。
leftpad
:
0
# 宽度不够时,补充的字符。
postfix
:
"
\t
"
...
...
res/en/sample.yaml
浏览文件 @
d9b212fb
...
...
@@ -94,8 +94,8 @@ fields:
postfix
:
"
\t
"
-
field
:
field_length
# Fixed length field.
range
:
1-
100
# 001,002,003..., 099,100
width
:
3
# the length in Byte including prefix and postfix.
range
:
1-
99
# 01\t,02\t,03\t..., 99\t
length
:
3
# the length in Byte including prefix and postfix.
leftpad
:
0
# Using 0 to pad.
postfix
:
"
\t
"
...
...
res/zh/sample.yaml
浏览文件 @
d9b212fb
...
...
@@ -94,8 +94,8 @@ fields:
postfix
:
"
\t
"
-
field
:
field_length
# 指定宽度。
range
:
1-9
# 001,002,003..., 099,100
width
:
3
# 包含前后缀的宽度。
range
:
1-9
9
# 01\t,02\t,03\t..., 99\t
length
:
3
# 包含前后缀的宽度。
leftpad
:
0
# 宽度不够时,补充的字符。
postfix
:
"
\t
"
...
...
src/gen/decode.go
浏览文件 @
d9b212fb
...
...
@@ -73,9 +73,9 @@ func decodeOneLevel(line string, fields []model.DefField, rowMap *map[string]int
for
j
,
field
:=
range
fields
{
col
:=
""
if
field
.
Wid
th
>
0
{
col
=
string
(
left
[
:
field
.
Wid
th
])
left
=
left
[
field
.
Wid
th
:
]
if
field
.
Leng
th
>
0
{
col
=
string
(
left
[
:
field
.
Leng
th
])
left
=
left
[
field
.
Leng
th
:
]
}
else
{
sepStr
:=
""
if
j
<
len
(
fields
)
-
1
{
...
...
src/gen/definition.go
浏览文件 @
d9b212fb
...
...
@@ -222,8 +222,8 @@ func CopyField(child model.DefField, parent *model.DefField) {
if
child
.
Precision
!=
0
{
(
*
parent
)
.
Precision
=
child
.
Precision
}
if
child
.
Wid
th
!=
0
{
(
*
parent
)
.
Width
=
child
.
Wid
th
if
child
.
Leng
th
!=
0
{
(
*
parent
)
.
Length
=
child
.
Leng
th
}
}
...
...
src/gen/output.go
浏览文件 @
d9b212fb
...
...
@@ -33,7 +33,7 @@ func Print(rows [][]string, format string, table string, colIsNumArr []bool,
for
j
,
col
:=
range
cols
{
col
=
replacePlaceholder
(
col
)
field
:=
vari
.
TopFieldMap
[
fields
[
j
]]
if
field
.
Wid
th
>
runewidth
.
StringWidth
(
col
)
{
if
field
.
Leng
th
>
runewidth
.
StringWidth
(
col
)
{
col
=
stringUtils
.
AddPad
(
col
,
field
)
}
...
...
src/model/definition.go
浏览文件 @
d9b212fb
...
...
@@ -38,12 +38,12 @@ type DefData struct {
Fields
[]
DefField
`yaml:"fields,flow"`
}
type
DefField
struct
{
FieldBase
`yaml:",inline"`
Fields
[]
DefField
`yaml:"fields,flow"`
Width
int
`yaml:"wid
th"`
LeftPad
string
`yaml:"leftpad"`
RightPad
string
`yaml:"rightpad"`
Path
string
FieldBase
`yaml:",inline"`
Fields
[]
DefField
`yaml:"fields,flow"`
Length
int
`yaml:"leng
th"`
LeftPad
string
`yaml:"leftpad"`
RightPad
string
`yaml:"rightpad"`
Path
string
Froms
[]
DefField
`yaml:"froms,flow"`
}
...
...
src/utils/string/string.go
浏览文件 @
d9b212fb
...
...
@@ -143,8 +143,8 @@ func FormatStr(format string, val interface{}, precision int) (ret string, pass
}
func
AddPad
(
str
string
,
field
model
.
DefField
)
string
{
if
field
.
Width
>
0
&&
field
.
Wid
th
>
runewidth
.
StringWidth
(
str
)
{
gap
:=
field
.
Wid
th
-
len
(
str
)
if
field
.
Length
>
0
&&
field
.
Leng
th
>
runewidth
.
StringWidth
(
str
)
{
gap
:=
field
.
Leng
th
-
len
(
str
)
if
field
.
LeftPad
!=
""
{
field
.
LeftPad
=
field
.
LeftPad
[
:
1
]
pads
:=
strings
.
Repeat
(
field
.
LeftPad
,
gap
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录