code: func (b *Remote) workspaces() ([]string, error) {
  	options := tfe.WorkspaceListOptions{}
  	switch {
  	case b.workspace != "":
  		options.Search = tfe.String(b.workspace)
  	case b.prefix != "":
  		options.Search = tfe.String(b.prefix)
  	}
  
  	// Create a slice to contain all the names.
  	var names []string
  
  	for {
  		wl, err := b.client.Workspaces.List(context.Background(), b.organization, options)
  		if err != nil {
  			return nil, err
  		}
  
  		for _, w := range wl.Items {
  			if b.workspace != "" && w.Name == b.workspace {
  				names = append(names, backend.DefaultStateName)
  				continue
  			}
  			if b.prefix != "" && strings.HasPrefix(w.Name, b.prefix) {
  				names = append(names, strings.TrimPrefix(w.Name, b.prefix))
  			}
  		}
  
  		// Exit the loop when we've seen all pages.
  		if wl.CurrentPage >= wl.TotalPages {
  			break
  		}
  
  		// Update the page number to get the next page.
  		options.PageNumber = wl.NextPage
  	}
  
  	// Sort the result so we have consistent output.
  	sort.StringSlice(names).Sort()
  
  	return names, nil
  }
docs: // workspaces returns a filtered list of remote workspace names.