Skip to content

Commit

Permalink
Document help-only commands
Browse files Browse the repository at this point in the history
  • Loading branch information
dcowgill committed Feb 25, 2020
1 parent bb40850 commit 7d32f70
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Example progam:
Short: "Example Program",
Commands: []*cli.Command{
cmdHello,
helpTopic,
},
}
program.Run()
Expand Down Expand Up @@ -55,6 +56,11 @@ Example progam:
fmt.Printf(greeting+", %s!\n", args[0])
}
var helpTopic = &cli.Command{
Short: "help about a specific topic",
Long: `This is the help text.`,
}
*/
package cli

Expand All @@ -70,6 +76,10 @@ import (
type Command struct {
// Runs the command. The args are the unparsed (non flag)
// arguments after the command name.
//
// If Run is nil, the Command is treated as a documentation
// topic, not as a runnable command. This affects how it is
// displayed in help and usage instructions.
Run func(cmd *Command, args []string)

// The one-line usage message. The first word in the line is
Expand Down

0 comments on commit 7d32f70

Please sign in to comment.