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

fix issue#3345

上级 5a4d8efe
...@@ -76,7 +76,14 @@ func Print(rows [][]string, format string, table string, colIsNumArr []bool, fie ...@@ -76,7 +76,14 @@ func Print(rows [][]string, format string, table string, colIsNumArr []bool, fie
col = stringUtils.AddPad(col, field) col = stringUtils.AddPad(col, field)
} }
lineForText = lineForText + col if j > 0 && vari.Human {
lineForText = strings.TrimRight(lineForText, "\t")
col = strings.TrimLeft(col, "\t")
lineForText = lineForText + "\t" + col
} else {
lineForText = lineForText + col
}
row = append(row, col) row = append(row, col)
rowXml.Cols = append(rowXml.Cols, col) rowXml.Cols = append(rowXml.Cols, col)
...@@ -106,7 +113,7 @@ func printTextHeader(fields []string) { ...@@ -106,7 +113,7 @@ func printTextHeader(fields []string) {
for idx, field := range fields { for idx, field := range fields {
headerLine += field headerLine += field
if idx < len(fields)-1 { if idx < len(fields)-1 {
headerLine += vari.HeadSep headerLine += "\t"
} }
} }
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
) )
func ParseRequestParams(req *http.Request) (defaultFile, yamlFile, fields string, count int, func ParseRequestParams(req *http.Request) (defaultFile, yamlFile, fields string, count int,
human string, format, table string, decode bool, input, output string) { format, table string, decode bool, input, output string) {
query := req.URL.Query() query := req.URL.Query()
defaultFile = GetRequestParams(query,"default", "d") defaultFile = GetRequestParams(query,"default", "d")
...@@ -25,8 +25,6 @@ func ParseRequestParams(req *http.Request) (defaultFile, yamlFile, fields string ...@@ -25,8 +25,6 @@ func ParseRequestParams(req *http.Request) (defaultFile, yamlFile, fields string
format = constant.FormatJson format = constant.FormatJson
table = "" table = ""
human = GetRequestParams(query,"human", "H")
if req.Method == http.MethodPost { if req.Method == http.MethodPost {
// save to files // save to files
req.ParseForm() req.ParseForm()
......
...@@ -22,7 +22,7 @@ var ( ...@@ -22,7 +22,7 @@ var (
Total int Total int
WithHead bool WithHead bool
HeadSep string Human bool
Trim bool Trim bool
Recursive bool Recursive bool
......
...@@ -90,8 +90,8 @@ func main() { ...@@ -90,8 +90,8 @@ func main() {
flagSet.StringVar(&md5, "md5", "", "") flagSet.StringVar(&md5, "md5", "", "")
flagSet.StringVar(&vari.HeadSep, "H", "", "") flagSet.BoolVar(&vari.Human, "H", false, "")
flagSet.StringVar(&vari.HeadSep, "human", "", "") flagSet.BoolVar(&vari.Human, "human", false, "")
flagSet.BoolVar(&decode, "D", false, "") flagSet.BoolVar(&decode, "D", false, "")
flagSet.BoolVar(&decode, "decode", false, "") flagSet.BoolVar(&decode, "decode", false, "")
...@@ -183,7 +183,7 @@ func toGen() { ...@@ -183,7 +183,7 @@ func toGen() {
} else if vari.RunMode == constant.RunModeParse { } else if vari.RunMode == constant.RunModeParse {
action.ParseSql(input, output) action.ParseSql(input, output)
} else if vari.RunMode == constant.RunModeGen { } else if vari.RunMode == constant.RunModeGen {
if vari.HeadSep != "" { if vari.Human {
vari.WithHead = true vari.WithHead = true
} }
...@@ -230,7 +230,7 @@ func StartServer() { ...@@ -230,7 +230,7 @@ func StartServer() {
func DataHandler(writer http.ResponseWriter, req *http.Request) { func DataHandler(writer http.ResponseWriter, req *http.Request) {
action.HttpWriter = writer action.HttpWriter = writer
defaultFile, configFile, fields, count, vari.HeadSep, defaultFile, configFile, fields, count,
format, table, decode, input, output = service.ParseRequestParams(req) format, table, decode, input, output = service.ParseRequestParams(req)
if decode { if decode {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册