Use encoding/csv to write proper CSV for the selected row

This commit is contained in:
Lee Marlow 2022-11-03 14:16:17 -06:00 committed by Maas Lalani
parent 5ed1f2b1b8
commit e20d3a97f0

View file

@ -4,7 +4,6 @@ import (
"encoding/csv"
"fmt"
"os"
"strings"
"github.com/alecthomas/kong"
"github.com/charmbracelet/bubbles/table"
@ -102,7 +101,11 @@ func (o Options) Run() error {
}
m := tm.(model)
fmt.Println(strings.Join([]string(m.selected), o.Separator))
w := csv.NewWriter(os.Stdout)
w.Comma = reader.Comma
w.Write([]string(m.selected))
w.Flush()
return nil
}