man_docs.md
This file
Path
doc/man_docs.md
31 lines · 519 bytes · Markdown
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 0ea93dd point at it.
Fixed linter issuesJuan Lenibefore adoption0ea93dd
lines 1–31why, one step back1# Generating Man Pages For Your Own cobra.Command23Generating man pages from a cobra command is incredibly easy. An example is as follows:45```go6package main78import (9 "log"1011 "github.com/spf13/cobra"12 "github.com/spf13/cobra/doc"13)1415func main() {16 cmd := &cobra.Command{17 Use: "test",18 Short: "my test program",19 }20 header := &doc.GenManHeader{21 Title: "MINE",22 Section: "3",23 }24 err := doc.GenManTree(cmd, header, "/tmp")25 if err != nil {26 log.Fatal(err)27 }28}29```3031That will get you a man page `/tmp/test.3`