Format prints out details about the message onto the specified output stream.
(w io.Writer)
| 50 | |
| 51 | // Format prints out details about the message onto the specified output stream. |
| 52 | func (h *HelpMessage) Format(w io.Writer) { |
| 53 | if h.Command != "" { |
| 54 | fmt.Fprintf(w, "Command: %s\n", h.Command) |
| 55 | } |
| 56 | if h.Function != "" { |
| 57 | fmt.Fprintf(w, "Function: %s\n", h.Function) |
| 58 | } |
| 59 | if h.ShortDescription != "" { |
| 60 | fmt.Fprintf(w, "Description: %s\n", h.ShortDescription) |
| 61 | } |
| 62 | if h.Category != "" { |
| 63 | fmt.Fprintf(w, "Category: %s\n", h.Category) |
| 64 | } |
| 65 | if h.Command != "" { |
| 66 | fmt.Fprintln(w, "Syntax:") |
| 67 | } |
| 68 | fmt.Fprintln(w, strings.TrimSpace(h.Text)) |
| 69 | if h.SeeAlso != "" { |
| 70 | fmt.Fprintf(w, "\nSee also:\n %s\n", h.SeeAlso) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // helpWith is to be used in parser actions to mark the parser "in |
| 75 | // error", with the error set to a contextual help message about the |