help returns a help string for a command.
(name string)
| 47 | |
| 48 | // help returns a help string for a command. |
| 49 | func (c *command) help(name string) string { |
| 50 | message := c.description + "\n" |
| 51 | if c.usage != "" { |
| 52 | message += " Usage:\n" |
| 53 | lines := strings.Split(c.usage, "\n") |
| 54 | for _, line := range lines { |
| 55 | message += fmt.Sprintf(" %s\n", line) |
| 56 | } |
| 57 | } |
| 58 | return message + "\n" |
| 59 | } |
| 60 | |
| 61 | // AddCommand adds an additional command to the set of commands |
| 62 | // accepted by pprof. This enables extensions to add new commands for |