UsageString returns usage string.
()
| 524 | |
| 525 | // UsageString returns usage string. |
| 526 | func (c *Command) UsageString() string { |
| 527 | // Storing normal writers |
| 528 | tmpOutput := c.outWriter |
| 529 | tmpErr := c.errWriter |
| 530 | |
| 531 | bb := new(bytes.Buffer) |
| 532 | c.outWriter = bb |
| 533 | c.errWriter = bb |
| 534 | |
| 535 | CheckErr(c.Usage()) |
| 536 | |
| 537 | // Setting things back to normal |
| 538 | c.outWriter = tmpOutput |
| 539 | c.errWriter = tmpErr |
| 540 | |
| 541 | return bb.String() |
| 542 | } |
| 543 | |
| 544 | // FlagErrorFunc returns either the function set by SetFlagErrorFunc for this |
| 545 | // command or a parent, or it returns a function which returns the original |