(response *simplejson.Json, table *tablewriter.Table)
| 352 | } |
| 353 | |
| 354 | func tableProcess(response *simplejson.Json, table *tablewriter.Table) { |
| 355 | table.SetHeader([]string{"PID", "AGENT_ID", "NETNS_ID", "NAME", "PROCESS_NAME", "USER", "START_TIME"}) |
| 356 | |
| 357 | tableItems := [][]string{} |
| 358 | for i := range response.Get("DATA").MustArray() { |
| 359 | data := response.Get("DATA").GetIndex(i) |
| 360 | tableItem := []string{} |
| 361 | tableItem = append(tableItem, strconv.Itoa(data.Get("PID").MustInt())) |
| 362 | tableItem = append(tableItem, strconv.Itoa(data.Get("VTAP_ID").MustInt())) |
| 363 | tableItem = append(tableItem, strconv.Itoa(data.Get("NETNS_ID").MustInt())) |
| 364 | tableItem = append(tableItem, data.Get("NAME").MustString()) |
| 365 | tableItem = append(tableItem, data.Get("PROCESS_NAME").MustString()) |
| 366 | tableItem = append(tableItem, data.Get("USER").MustString()) |
| 367 | tableItem = append(tableItem, data.Get("START_TIME").MustString()) |
| 368 | tableItems = append(tableItems, tableItem) |
| 369 | } |
| 370 | |
| 371 | table.AppendBulk(tableItems) |
| 372 | table.Render() |
| 373 | } |
| 374 | |
| 375 | func agentInfo(cmd *cobra.Command, args []string) { |
| 376 | if len(args) == 0 { |
no test coverage detected