tabby icon indicating copy to clipboard operation
tabby copied to clipboard

AddHeader It's not a good name

Open avelino opened this issue 5 years ago • 1 comments

AddHeader declares the table header does not necessarily add, the example below explains better my point of view

package main

import "github.com/cheynewallace/tabby"

func main(){
	t := tabby.New()
	t.AddHeader("NAME", "TITLE", "DEPARTMENT")
	t.AddLine("John Smith", "Developer", "Engineering")
	t.AddHeader("NAME", "TITLE", "DEPARTMENT")
	t.Print()
}

OUT:

NAME        TITLE      DEPARTMENT
----        -----      ----------
John Smith  Developer  Engineering

SetHeader sounds better

avelino avatar Mar 12 '19 14:03 avelino

Random user here...

I see what you mean. And actually I think this would be a good enhancement when one is outputting 10s of lines it is good to throw the header in there every N lines.

Alternatively one could say t.AddHeader("NAME", "TITLE", "DEPARTMENT", N) to automatically add it every N lines.

sshaw avatar Jan 09 '21 21:01 sshaw