(s *schema.Schema, rawResult interface{})
| 41 | } |
| 42 | |
| 43 | func (gohanClientCLI *GohanClientCLI) formatOutputTable(s *schema.Schema, rawResult interface{}) string { |
| 44 | buffer := bytes.NewBufferString("") |
| 45 | for k, v := range rawResult.(map[string]interface{}) { |
| 46 | if k == errorKey { |
| 47 | return fmt.Sprintf("%v", v) |
| 48 | } |
| 49 | switch v.(type) { |
| 50 | case []interface{}: |
| 51 | gohanClientCLI.createResourcesTable(s, buffer, v.([]interface{})) |
| 52 | case map[string]interface{}: |
| 53 | gohanClientCLI.createSingleResourceTable(s, buffer, v.(map[string]interface{})) |
| 54 | default: |
| 55 | return fmt.Sprintf("%v", v) |
| 56 | } |
| 57 | } |
| 58 | return buffer.String() |
| 59 | } |
| 60 | |
| 61 | func (gohanClientCLI *GohanClientCLI) createResourcesTable(s *schema.Schema, buffer *bytes.Buffer, resources []interface{}) { |
| 62 | table := tablewriter.NewWriter(buffer) |
no test coverage detected