mirror of
https://github.com/charmbracelet/gum
synced 2024-06-08 08:42:16 +02:00
Use encoding/csv to write proper CSV for the selected row
This commit is contained in:
parent
5ed1f2b1b8
commit
e20d3a97f0
|
@ -4,7 +4,6 @@ import (
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
"github.com/alecthomas/kong"
|
||||||
"github.com/charmbracelet/bubbles/table"
|
"github.com/charmbracelet/bubbles/table"
|
||||||
|
@ -102,7 +101,11 @@ func (o Options) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
m := tm.(model)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue