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

Timestamp still shows in man documentation #741

Closed
speedingdaemon opened this issue Sep 6, 2018 · 8 comments
Closed

Timestamp still shows in man documentation #741

speedingdaemon opened this issue Sep 6, 2018 · 8 comments

Comments

@speedingdaemon
Copy link

I thought that this issue was resolved with #142
But even after specifying in my root cmd:
DisableAutoGenTag: true,

I see this text in my man documentation:
Auto generated by spf13/cobra on 6-Sep-2018

markdown and ReST documentation don't have this text.
Am I doing something wrong?

Here is my code:
var rootCmd = &cobra.Command{
Use: "hello",
Short: "test",
Long: "my test",
DisableAutoGenTag: true,
}

func genManDocs() {
header := &doc.GenManHeader{
Title: "MINE",
Section: "3",
}
err := doc.GenManTree(rootCmd, header, "./")

    if err != nil {
            fmt.Println(err)
    }

}

@Skarlso
Copy link

Skarlso commented Jan 16, 2020

Yep, second that. It's still in there.

@Simran-B
Copy link

I want to add that it's also showing in the Markdown documentation, so likely a general issue of DisableAutoGenTag not working properly (not passed on correctly?)

@kamalgrover
Copy link

Guys, Is there a workarround for the same ?

@Skarlso
Copy link

Skarlso commented Apr 3, 2020

Not that I know off, sorry. :/

@kamalgrover
Copy link

kamalgrover commented Apr 13, 2020

I used the "Source" member to overcome this.
Here is the code snippet.

func main() {

	header := &doc.GenManHeader{
		Title:   "shorthand",
		Section: "1",
		Manual:  "My Product Manual",
		Source: "Copyright (C) 2020 All Rights Reserved.",

	}
	//Disables the autogenerated comment at the end of the man page.
	cmd.RootCmd.DisableAutoGenTag = true
	err := doc.GenManTree(cmd.RootCmd, header, "doc/")
	if err != nil {
		log.Fatal(err)
	}
}

@jpmcb
Copy link
Collaborator

jpmcb commented Apr 21, 2020

@jharshman I did some investigation on this and seems that cmd.DisableAutoGenTag will only skip placing the auto gen tag in the body while the header "source" will get auto populated with the auto gen tag if nothing is specified.

I was able to work around this by specifying something other than an empty string:

header := &doc.GenManHeader{
	Title: "someTitle",
	Section: "1",
	Source: " ",
}

Would we expect setting cmd.DisableAutoGenTag = true to disable the string "Auto generated by spf13/cobra" everywhere when docs are generated? If so, I'd recommend we extend this to disable all auto generated tags when the bool is set to true. I can work on this as well if that's the direction we want to go.

jpmcb added a commit to jpmcb/cobra that referenced this issue Apr 25, 2020
jharshman pushed a commit that referenced this issue Apr 29, 2020
* Man pages wont have  auto gen tag when option is disabled

- this addresses #741

* Add documentation for doc generation and a changelog
@github-actions
Copy link

This issue is being marked as stale due to a long period of inactivity

@jpmcb
Copy link
Collaborator

jpmcb commented Jun 22, 2020

@jharshman this can be closed as #1104 addressed this

@jpmcb jpmcb closed this as completed Jul 9, 2020
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

5 participants