Skip to content

Commit

Permalink
fix #83
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Aug 14, 2019
1 parent 39ca516 commit 6693f05
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- [csvtk v0.18.3](https://github.com/shenwei356/csvtk/releases/tag/v0.18.3)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.18.3/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.18.3)
- `csvtk split`: fix bug of repeatedly output header line when number of output files exceed value of `--buf-groups`. [#83](https://github.com/shenwei356/csvtk/issues/83)
- [csvtk v0.18.2](https://github.com/shenwei356/csvtk/releases/tag/v0.18.2)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.18.2/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.18.2)
- `csvtk replace/rename2/splitxlsx`: fix flag conflicts with global flag `-I` since v0.18.0.
Expand Down
5 changes: 3 additions & 2 deletions csvtk/cmd/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ func appendRows(config Config,
var outfh *xopen.Writer
var err error

if _, ok := moreThanOneWrite.Load(key); ok {
_, writeOnce := moreThanOneWrite.Load(key)
if writeOnce {
outfh, err = xopen.WopenFile(outFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
} else {
outfh, err = xopen.Wopen(outFile)
Expand All @@ -353,7 +354,7 @@ func appendRows(config Config,
if printMetaLine && len(csvReader.MetaLine) > 0 {
outfh.WriteString(fmt.Sprintf("sep=%s\n", string(writer.Comma)))
}
if headerRow != nil {
if !writeOnce && headerRow != nil {
checkError(writer.Write(headerRow))
}

Expand Down
2 changes: 1 addition & 1 deletion csvtk/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

// VERSION of csvtk
const VERSION = "0.18.2"
const VERSION = "0.18.3"

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Expand Down

0 comments on commit 6693f05

Please sign in to comment.