Skip to content

Commit

Permalink
Merge pull request #142 from adrdev10/allow-case-option
Browse files Browse the repository at this point in the history
Add option to select for title case for headers
  • Loading branch information
olekukonko authored Oct 21, 2020
2 parents 239be5e + 01c053c commit cd41d7d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions csv2table/csv2table.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var (
align = flag.String("a", "none", "Set alignment with eg. none|left|right|center")
pipe = flag.Bool("p", false, "Support for Piping from STDIN")
border = flag.Bool("b", true, "Enable / disable table border")
casing = flag.Bool("c", false, "Set header to be title case")
)

func main() {
Expand Down Expand Up @@ -76,6 +77,10 @@ func process(r io.Reader) {
table.SetAlignment(tablewriter.ALIGN_CENTER)
}
table.SetBorder(*border)
if *casing {
table.SetAutoFormatHeaders(false)
table.SetTitleCase(*casing)
}
table.Render()
}

Expand Down

0 comments on commit cd41d7d

Please sign in to comment.