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

init

上级 8f8e39d3
......@@ -8,6 +8,10 @@
{
"id": "total",
"translation": "Total"
},
{
"id": "enter_language",
"translation": "Enter the language you want to use:\n1. English %s\n2. Chinese %s"
}
]
}
\ No newline at end of file
......@@ -4,6 +4,10 @@
{
"id": "for_example",
"translation": "例如 %s"
},
{
"id": "enter_language",
"translation": "请输入你期望使用的语言:\n1. 英文 %s\n2. 中文 %s"
}
]
}
\ No newline at end of file
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)
}
package action
func Set() {
}
......@@ -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
}
......@@ -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
......@@ -7,7 +7,7 @@ import (
var (
ConfigVer = 1
ConfigFile = fmt.Sprintf("conf%sztf.conf", string(os.PathSeparator))
ConfigFile = fmt.Sprintf("conf%szdata.conf", string(os.PathSeparator))
UrlZentaoSettings = "zentaoSettings"
UrlImportProject = "importProject"
......
......@@ -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(&file, "field", "", "")
flagSet.StringVar(&fields, "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: // run
default: // gen
if len(os.Args) > 1 {
args := []string{os.Args[0], "run"}
args := []string{os.Args[0], "gen"}
args = append(args, os.Args[1:]...)
//run(args)
gen(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.
先完成此消息的编辑!
想要评论请 注册