Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
zendata
提交
fcbf81ac
Z
zendata
项目概览
LinuxSuRen
/
zendata
与 Fork 源项目一致
Fork自
易企天创 / zendata
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zendata
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fcbf81ac
编写于
4月 13, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init
上级
8f8e39d3
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
38 addition
and
64 deletion
+38
-64
res/messages_en.json
res/messages_en.json
+4
-0
res/messages_zh.json
res/messages_zh.json
+4
-0
src/action/gen.go
src/action/gen.go
+3
-1
src/action/set.go
src/action/set.go
+4
-0
src/model/config.go
src/model/config.go
+0
-13
src/utils/config/config.go
src/utils/config/config.go
+0
-34
src/utils/const/const.go
src/utils/const/const.go
+1
-1
src/zdata.go
src/zdata.go
+22
-15
未找到文件。
res/messages_en.json
浏览文件 @
fcbf81ac
...
...
@@ -8,6 +8,10 @@
{
"id"
:
"total"
,
"translation"
:
"Total"
},
{
"id"
:
"enter_language"
,
"translation"
:
"Enter the language you want to use:
\n
1. English %s
\n
2. Chinese %s"
}
]
}
\ No newline at end of file
res/messages_zh.json
浏览文件 @
fcbf81ac
...
...
@@ -4,6 +4,10 @@
{
"id"
:
"for_example"
,
"translation"
:
"例如 %s"
},
{
"id"
:
"enter_language"
,
"translation"
:
"请输入你期望使用的语言:
\n
1. 英文 %s
\n
2. 中文 %s"
}
]
}
\ No newline at end of file
src/action/gen.go
浏览文件 @
fcbf81ac
package
action
func
Generate
(
file
string
,
count
int
,
fields
string
,
out
string
,
table
string
)
{
import
logUtils
"github.com/easysoft/zendata/src/utils/log"
func
Generate
(
file
string
,
count
int
,
fields
string
,
out
string
,
table
string
)
{
logUtils
.
Log
(
file
)
}
src/action/set.go
0 → 100644
浏览文件 @
fcbf81ac
package
action
func
Set
()
{
}
src/model/config.go
浏览文件 @
fcbf81ac
...
...
@@ -3,17 +3,4 @@ package model
type
Config
struct
{
Version
int
Language
string
Url
string
Account
string
Password
string
Javascript
string
Lua
string
Perl
string
Php
string
Python
string
Ruby
string
Tcl
string
Autoit
string
}
src/utils/config/config.go
浏览文件 @
fcbf81ac
...
...
@@ -24,10 +24,8 @@ func InitConfig() {
constant
.
ConfigFile
=
vari
.
ZDataDir
+
constant
.
ConfigFile
vari
.
Config
=
getInst
()
// screen size
InitScreenSize
()
// internationalization
i118Utils
.
InitI118
(
vari
.
Config
.
Language
)
}
...
...
@@ -82,8 +80,6 @@ func ReadCurrConfig() model.Config {
ini
.
MapTo
(
&
config
,
constant
.
ConfigFile
)
config
.
Url
=
commonUtils
.
UpdateUrl
(
config
.
Url
)
return
config
}
...
...
@@ -126,8 +122,6 @@ func CheckConfigReady() {
func
InputForSet
()
{
conf
:=
ReadCurrConfig
()
var
configSite
bool
logUtils
.
PrintToWithColor
(
i118Utils
.
I118Prt
.
Sprintf
(
"begin_config"
),
color
.
FgCyan
)
enCheck
:=
""
...
...
@@ -150,34 +144,6 @@ func InputForSet() {
conf
.
Language
=
"zh"
}
stdinUtils
.
InputForBool
(
&
configSite
,
true
,
"config_zentao_site"
)
if
configSite
{
conf
.
Url
=
stdinUtils
.
GetInput
(
"(http://.*)"
,
conf
.
Url
,
"enter_url"
,
conf
.
Url
)
conf
.
Account
=
stdinUtils
.
GetInput
(
"(.{2,})"
,
conf
.
Account
,
"enter_account"
,
conf
.
Account
)
conf
.
Password
=
stdinUtils
.
GetInput
(
"(.{2,})"
,
conf
.
Password
,
"enter_password"
,
conf
.
Password
)
}
SaveConfig
(
conf
)
PrintCurrConfig
()
}
func
CheckRequestConfig
()
{
conf
:=
ReadCurrConfig
()
if
conf
.
Url
==
""
||
conf
.
Account
==
""
||
conf
.
Password
==
""
{
InputForRequest
()
}
}
func
InputForRequest
()
{
conf
:=
ReadCurrConfig
()
logUtils
.
PrintToWithColor
(
i118Utils
.
I118Prt
.
Sprintf
(
"need_config"
),
color
.
FgCyan
)
conf
.
Url
=
stdinUtils
.
GetInput
(
"(http://.*)"
,
conf
.
Url
,
"enter_url"
,
conf
.
Url
)
conf
.
Account
=
stdinUtils
.
GetInput
(
"(.{2,})"
,
conf
.
Account
,
"enter_account"
,
conf
.
Account
)
conf
.
Password
=
stdinUtils
.
GetInput
(
"(.{2,})"
,
conf
.
Password
,
"enter_password"
,
conf
.
Password
)
SaveConfig
(
conf
)
}
\ No newline at end of file
src/utils/const/const.go
浏览文件 @
fcbf81ac
...
...
@@ -7,7 +7,7 @@ import (
var
(
ConfigVer
=
1
ConfigFile
=
fmt
.
Sprintf
(
"conf%sz
tf
.conf"
,
string
(
os
.
PathSeparator
))
ConfigFile
=
fmt
.
Sprintf
(
"conf%sz
data
.conf"
,
string
(
os
.
PathSeparator
))
UrlZentaoSettings
=
"zentaoSettings"
UrlImportProject
=
"importProject"
...
...
src/zdata.go
浏览文件 @
fcbf81ac
...
...
@@ -3,6 +3,7 @@ package main
import
(
"flag"
"github.com/easysoft/zendata/src/action"
configUtils
"github.com/easysoft/zendata/src/utils/config"
logUtils
"github.com/easysoft/zendata/src/utils/log"
"github.com/fatih/color"
"os"
...
...
@@ -16,7 +17,7 @@ var (
file
string
count
int
fields
string
parse
string
parse
bool
out
string
table
string
...
...
@@ -39,13 +40,13 @@ func main() {
flagSet
.
StringVar
(
&
file
,
"f"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"file"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"c"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"count"
,
""
,
""
)
flagSet
.
IntVar
(
&
count
,
"c"
,
10
,
""
)
flagSet
.
IntVar
(
&
count
,
"count"
,
10
,
""
)
flagSet
.
StringVar
(
&
fi
le
,
"field"
,
""
,
""
)
flagSet
.
StringVar
(
&
fi
elds
,
"field"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"p"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"parse"
,
""
,
""
)
flagSet
.
BoolVar
(
&
parse
,
"p"
,
false
,
""
)
flagSet
.
BoolVar
(
&
parse
,
"parse"
,
false
,
""
)
flagSet
.
StringVar
(
&
file
,
"o"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"out"
,
""
,
""
)
...
...
@@ -53,8 +54,8 @@ func main() {
flagSet
.
StringVar
(
&
file
,
"t"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"table"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"h"
,
""
,
""
)
flagSet
.
StringVar
(
&
file
,
"help"
,
""
,
""
)
flagSet
.
BoolVar
(
&
help
,
"h"
,
false
,
""
)
flagSet
.
BoolVar
(
&
help
,
"help"
,
false
,
""
)
if
len
(
os
.
Args
)
==
1
{
os
.
Args
=
append
(
os
.
Args
,
"run"
,
"."
)
...
...
@@ -62,18 +63,18 @@ func main() {
switch
os
.
Args
[
1
]
{
case
"gen"
:
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
2
:
]);
err
==
nil
{
action
.
Generate
(
file
,
count
,
fields
,
out
,
table
)
}
gen
(
os
.
Args
)
case
"set"
,
"-set"
:
action
.
Set
()
case
"help"
,
"-h"
:
logUtils
.
PrintUsage
()
default
:
//
ru
n
default
:
//
ge
n
if
len
(
os
.
Args
)
>
1
{
args
:=
[]
string
{
os
.
Args
[
0
],
"
ru
n"
}
args
:=
[]
string
{
os
.
Args
[
0
],
"
ge
n"
}
args
=
append
(
args
,
os
.
Args
[
1
:
]
...
)
//ru
n(args)
ge
n
(
args
)
}
else
{
logUtils
.
PrintUsage
()
}
...
...
@@ -81,9 +82,15 @@ func main() {
}
}
func
gen
(
args
[]
string
)
{
if
err
:=
flagSet
.
Parse
(
args
[
2
:
]);
err
==
nil
{
action
.
Generate
(
file
,
count
,
fields
,
out
,
table
)
}
}
func
init
()
{
cleanup
()
//
configUtils.InitConfig()
configUtils
.
InitConfig
()
}
func
cleanup
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录