newFormat returns a Format for rendering using a nodeContext.
(source string, quiet bool)
| 81 | |
| 82 | // newFormat returns a Format for rendering using a nodeContext. |
| 83 | func newFormat(source string, quiet bool) formatter.Format { |
| 84 | switch source { |
| 85 | case formatter.PrettyFormatKey: |
| 86 | return nodeInspectPrettyTemplate |
| 87 | case formatter.TableFormatKey: |
| 88 | if quiet { |
| 89 | return formatter.DefaultQuietFormat |
| 90 | } |
| 91 | return defaultNodeTableFormat |
| 92 | case formatter.RawFormatKey: |
| 93 | if quiet { |
| 94 | return `node_id: {{.ID}}` |
| 95 | } |
| 96 | return `node_id: {{.ID}}\nhostname: {{.Hostname}}\nstatus: {{.Status}}\navailability: {{.Availability}}\nmanager_status: {{.ManagerStatus}}\n` |
| 97 | } |
| 98 | return formatter.Format(source) |
| 99 | } |
| 100 | |
| 101 | // formatWrite writes the context. |
| 102 | func formatWrite(fmtCtx formatter.Context, nodes client.NodeListResult, info client.SystemInfoResult) error { |
no outgoing calls
searching dependent graphs…