Skip to content

Commit

Permalink
Add double quotes to csv output if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
lllama authored and fxaguessy committed Jun 21, 2018
1 parent 9d22395 commit d72913b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion console/displayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ func (d *csvDisplayer) Print(w io.Writer) error {
for i := range values {
var props []string
for j, h := range d.columnDefinitions {
props = append(props, h.format(values[i][j]))
val := h.format(values[i][j])
if strings.Contains(val, ",") {
val = "\"" + val + "\""
}
props = append(props, val)
}
buff.WriteString(strings.Join(props, ",") + "\n")
}
Expand Down

0 comments on commit d72913b

Please sign in to comment.