Skip to content

Commit

Permalink
Change printing logic and split format
Browse files Browse the repository at this point in the history
  • Loading branch information
hahwul committed Feb 12, 2021
1 parent 33cec92 commit f84ca85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
4 changes: 0 additions & 4 deletions pkg/gee/gee.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ func Gee(options model.Options) {
if regexBool {
linec, line := StringProc(l, stdLine, options)

// Prefix and Suffix
line = options.Prefix + line + options.Suffix
linec = options.Prefix + linec + options.Suffix

// Print to Stdout
StdPrint(linec, options)

Expand Down
27 changes: 14 additions & 13 deletions pkg/gee/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func StringProc(l string, stdLine int, options model.Options) (string, string) {
}
switch options.Format {
case "json":
returnString = "{\"line\":\"[" + returnString + "\"\"]\"}\n"
returnPlainString = "{\"line\":\"[" + returnPlainString + "\"\"]\"}\n"
returnString = "{\"line\":[" + returnString + "\"\"]}\n"
returnPlainString = "{\"line\":[" + returnPlainString + "\"\"]}\n"
case "md-table":
returnString = "|" + returnString + "\n"
returnPlainString = "|" + returnPlainString + "\n"
Expand All @@ -69,25 +69,26 @@ func toFormat(str string, options model.Options) string {
var returnString string
switch options.Format {
case "json":
returnString = str + ","
returnString = "\"" + setFix(str, options) + "\","
case "md-table":
returnString = str + "|"
returnString = setFix(str+"|", options)
case "html-table":
returnString = "<td>" + str + "</td>"
returnString = "<td>" + setFix(str, options) + "</td>"
default:
returnString = strings.Replace(str, "\n", "", -1) + "\n"
returnString = setFix(str, options) + "\n"
}
return returnString
}

func toJSON() {

func setFix(str string, options model.Options) string {
pf := setPrefix(strings.Replace(str, "\n", "", -1), options)
sf := setSuffix(pf, options)
return sf
}

func toMarkdownTable() {

func setPrefix(str string, options model.Options) string {
return options.Prefix + str
}

func toHTMLTable() {

func setSuffix(str string, options model.Options) string {
return options.Suffix + str
}

0 comments on commit f84ca85

Please sign in to comment.