Documentation ¶
Overview ¶
Example ¶
im, err := InstallManpageCommand(&InstallManpageCommandInput{ AppName: "demo", }) if err != nil { panic(err) } app := &cli.App{ Name: "demo", Version: "0.0.1", Compiled: time.Now(), Authors: []*cli.Author{ { Name: "John Doe", Email: "j@doe.com", }, }, HelpName: "demo", Usage: "a demo cli app", EnableBashCompletion: true, Commands: []*cli.Command{ { Name: "s3", Usage: "simple S3 commands", Subcommands: []*cli.Command{ { Name: "get", Usage: "[object path] [destination path]", UsageText: "it's going to get an object", Action: func(c *cli.Context) error { fmt.Println("get") return nil }, }, }, }, im, { Name: "version", Aliases: []string{"v"}, Usage: "Print version info", Action: func(c *cli.Context) error { fmt.Println("version") return nil }, }, }, } md, _ := ToMarkdown(app) fmt.Println(md) man, _ := ToMan(app) fmt.Println(man)
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallManpageCommand ¶ added in v0.2.0
func InstallManpageCommand(opts *InstallManpageCommandInput) (*cli.Command, error)
InstallManpageCommand will generate a *cli.Command to be used with a cli.App. This will install a manual page (8) to the man-db.
func ToMan ¶
ToMan creates a man page string for the *cli.App The function errors if either parsing or writing of the string fails.
func ToMarkdown ¶
ToMarkdown creates a markdown string for the *cli.App The function errors if either parsing or writing of the string fails.
Types ¶
type InstallManpageCommandInput ¶ added in v0.2.0
type InstallManpageCommandInput struct { AppName string `required:"true"` CmdName string `default:"install-command"` Path string `default:"/usr/local/share/man/man8"` Hidden bool `default:"false"` }
InstallManpageCommandInput provides an interface to pass in options for the InstallManpageCommand
- AppName is required.
- CmdName defaults to 'install-manpage'
- Path defaults to '/usr/local/share/man/man8'
Click to show internal directories.
Click to hide internal directories.