()
| 210 | } |
| 211 | |
| 212 | func (cmd HelpCommand) displayCommand() error { |
| 213 | cmdInfo, err := cmd.Actor.CommandInfoByName(Commands, cmd.OptionalArgs.CommandName) |
| 214 | if err != nil { |
| 215 | if err1, ok := err.(actionerror.InvalidCommandError); ok { |
| 216 | var found bool |
| 217 | if cmdInfo, found = cmd.findPlugin(); !found { |
| 218 | return err1 |
| 219 | } |
| 220 | } else { |
| 221 | return err |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | cmd.UI.DisplayText("NAME:") |
| 226 | cmd.UI.DisplayText(sharedaction.CommandIndent+"{{.CommandName}} - {{.CommandDescription}}", |
| 227 | map[string]interface{}{ |
| 228 | "CommandName": cmdInfo.Name, |
| 229 | "CommandDescription": cmd.UI.TranslateText(cmdInfo.Description), |
| 230 | }) |
| 231 | |
| 232 | cmd.UI.DisplayNewline() |
| 233 | |
| 234 | usageString := strings.Replace(cmdInfo.Usage, "CF_NAME", cmd.Config.BinaryName(), -1) |
| 235 | cmd.UI.DisplayText("USAGE:") |
| 236 | cmd.UI.DisplayText(sharedaction.CommandIndent+"{{.CommandUsage}}", |
| 237 | map[string]interface{}{ |
| 238 | "CommandUsage": cmd.UI.TranslateText(usageString), |
| 239 | }, |
| 240 | ) |
| 241 | |
| 242 | if cmdInfo.Examples != "" { |
| 243 | examplesString := strings.Replace(cmdInfo.Examples, "CF_NAME", cmd.Config.BinaryName(), -1) |
| 244 | cmd.UI.DisplayNewline() |
| 245 | cmd.UI.DisplayText("EXAMPLES:") |
| 246 | cmd.UI.DisplayText(sharedaction.CommandIndent+"{{.Examples}}", |
| 247 | map[string]interface{}{ |
| 248 | "Examples": examplesString, |
| 249 | }, |
| 250 | ) |
| 251 | } |
| 252 | |
| 253 | if cmdInfo.Resources != "" { |
| 254 | cmd.UI.DisplayNewline() |
| 255 | cmd.UI.DisplayText("RESOURCES:") |
| 256 | cmd.UI.DisplayText(sharedaction.CommandIndent+"{{.Resources}}", |
| 257 | map[string]interface{}{ |
| 258 | "Resources": cmdInfo.Resources, |
| 259 | }, |
| 260 | ) |
| 261 | } |
| 262 | |
| 263 | if cmdInfo.Alias != "" { |
| 264 | cmd.UI.DisplayNewline() |
| 265 | cmd.UI.DisplayText("ALIAS:") |
| 266 | cmd.UI.DisplayText(sharedaction.CommandIndent+"{{.Alias}}", |
| 267 | map[string]interface{}{ |
| 268 | "Alias": cmdInfo.Alias, |
| 269 | }) |
no test coverage detected