(opts *ViewOptions)
| 55 | } |
| 56 | |
| 57 | func viewRun(opts *ViewOptions) error { |
| 58 | space, err := opts.Client.Spaces.GetByIDOrName(opts.Selector) |
| 59 | if err != nil { |
| 60 | return err |
| 61 | } |
| 62 | |
| 63 | host := opts.Host |
| 64 | return output.PrintResource(space, opts.Command, output.Mappers[*spaces.Space]{ |
| 65 | Json: func(item *spaces.Space) any { |
| 66 | return SpaceAsJson{ |
| 67 | Id: item.GetID(), |
| 68 | Name: item.Name, |
| 69 | Description: item.Description, |
| 70 | TaskQueue: getTaskQueueStatus(item), |
| 71 | WebUrl: generateWebUrl(host, item), |
| 72 | } |
| 73 | }, |
| 74 | Table: output.TableDefinition[*spaces.Space]{ |
| 75 | Header: []string{"NAME", "DESCRIPTION", "TASK QUEUE", "WEB URL"}, |
| 76 | Row: func(item *spaces.Space) []string { |
| 77 | description := item.Description |
| 78 | if description == "" { |
| 79 | description = constants.NoDescription |
| 80 | } |
| 81 | |
| 82 | return []string{output.Bold(item.Name), description, getTaskQueueStatusColored(item), output.Blue(generateWebUrl(host, item))} |
| 83 | }, |
| 84 | }, |
| 85 | Basic: func(item *spaces.Space) string { |
| 86 | return formatSpaceForBasic(host, item) |
| 87 | }, |
| 88 | }) |
| 89 | } |
| 90 | |
| 91 | type SpaceAsJson struct { |
| 92 | Id string `json:"Id"` |
no test coverage detected