cobra icon indicating copy to clipboard operation
cobra copied to clipboard

DisableAutoGenTagDate option for docs generation

Open gitkent opened this issue 1 year ago • 0 comments

We are using cobra/doc to generated md files for our commands. Every time we re-generated the docs, all the md files were changed due to the date change here:

	if !cmd.DisableAutoGenTag {
		buf.WriteString("###### Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "\n")
	}

https://github.com/spf13/cobra/blob/main/doc/md_docs.go#L111

I understand that we can disable the GenTag entirely, but we also like to retain Auto generated by spf13/cobra in the content.

It would be good if we can have an option (e.g. DisableAutoGenTagDate = true) to disable the date generation so that when we re-generate the docs, only changed files will be picked up by Git.

I can contribute a PR if this requirement is useful for others as well.

gitkent avatar Oct 13 '23 02:10 gitkent