| 507 | } |
| 508 | |
| 509 | func helpDescription(runtime *app.Runtime) string { |
| 510 | desc := baseDescription() |
| 511 | |
| 512 | configLine := "unknown" |
| 513 | if err := configureRuntimeConfig(runtime); err != nil { |
| 514 | configLine = fmt.Sprintf("error: %v", err) |
| 515 | } else if runtime.Config.Path() != "" { |
| 516 | configLine = runtime.Config.Path() |
| 517 | } |
| 518 | |
| 519 | backendInfo, err := runtimeKeyringBackendInfo(runtime) |
| 520 | var backendLine string |
| 521 | if err != nil { |
| 522 | backendLine = fmt.Sprintf("error: %v", err) |
| 523 | } else if backendInfo.Value != "" { |
| 524 | backendLine = fmt.Sprintf("%s (source: %s)", backendInfo.Value, backendInfo.Source) |
| 525 | } |
| 526 | |
| 527 | return fmt.Sprintf("%s\n\nConfig:\n file: %s\n keyring backend: %s", desc, configLine, backendLine) |
| 528 | } |
| 529 | |
| 530 | // newUsageError wraps errors in a way main() can map to exit code 2. |
| 531 | func newUsageError(err error) error { |