mirror of
https://github.com/charmbracelet/gum
synced 2024-06-09 17:22:22 +02:00
Set writer.Comma in same manner as reader.Comma
Fix linting issue with ignoring an error
This commit is contained in:
parent
e20d3a97f0
commit
7bb92dec2f
|
@ -36,6 +36,9 @@ func (o Options) Run() error {
|
||||||
}
|
}
|
||||||
reader.Comma = separatorRunes[0]
|
reader.Comma = separatorRunes[0]
|
||||||
|
|
||||||
|
writer := csv.NewWriter(os.Stdout)
|
||||||
|
writer.Comma = separatorRunes[0]
|
||||||
|
|
||||||
var columnNames []string
|
var columnNames []string
|
||||||
var err error
|
var err error
|
||||||
// If no columns are provided we'll use the first row of the CSV as the
|
// If no columns are provided we'll use the first row of the CSV as the
|
||||||
|
@ -102,10 +105,12 @@ func (o Options) Run() error {
|
||||||
|
|
||||||
m := tm.(model)
|
m := tm.(model)
|
||||||
|
|
||||||
w := csv.NewWriter(os.Stdout)
|
err = writer.Write([]string(m.selected))
|
||||||
w.Comma = reader.Comma
|
if err != nil {
|
||||||
w.Write([]string(m.selected))
|
return fmt.Errorf("failed to write selected row: %w", err)
|
||||||
w.Flush()
|
}
|
||||||
|
|
||||||
|
writer.Flush()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue