Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddHeader It's not a good name #3

Open
avelino opened this issue Mar 12, 2019 · 1 comment
Open

AddHeader It's not a good name #3

avelino opened this issue Mar 12, 2019 · 1 comment

Comments

@avelino
Copy link

avelino commented Mar 12, 2019

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

@sshaw
Copy link

sshaw commented Jan 9, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants