code: func (c *TopCommand) Top(client *roundtrip.Client) error {
  	if err := ui.Init(); err != nil {
  		return trace.Wrap(err)
  	}
  	defer ui.Close()
  
  	ctx, cancel := context.WithCancel(context.TODO())
  	defer cancel()
  
  	uiEvents := ui.PollEvents()
  	ticker := time.NewTicker(*c.refreshPeriod)
  	defer ticker.Stop()
  
  	// fetch and render first time
  	var prev *Report
  	re, err := c.fetchAndGenerateReport(ctx, client, nil)
  	if err != nil {
  		return trace.Wrap(err)
  	}
  	lastTab := ""
  	if err := c.render(ctx, *re, lastTab); err != nil {
  		return trace.Wrap(err)
  	}
  	for {
  		select {
  		case e := <-uiEvents:
  			switch e.ID { // event string/identifier
  			case "q", "<C-c>": // press 'q' or 'C-c' to quit
  				return nil
  			}
  			if e.ID == "1" || e.ID == "2" || e.ID == "3" {
  				lastTab = e.ID
  			}
  			// render previously fetched data on the resize event
  			if re != nil {
  				if err := c.render(ctx, *re, lastTab); err != nil {
  					return trace.Wrap(err)
  				}
  			}
  		case <-ticker.C:
  			// fetch data and re-render on ticker
  			prev = re
  			re, err = c.fetchAndGenerateReport(ctx, client, prev)
  			if err != nil {
  				return trace.Wrap(err)
  			}
  			if err := c.render(ctx, *re, lastTab); err != nil {
  				return trace.Wrap(err)
  			}
  		}
  	}
  }
docs: // Top is called to execute "status" CLI command.