code: func (o GetContextsOptions) RunGetContexts() error {
  	config, err := o.configAccess.GetStartingConfig()
  	if err != nil {
  		return err
  	}
  
  	out, found := o.Out.(*tabwriter.Writer)
  	if !found {
  		out = printers.GetNewTabWriter(o.Out)
  		defer out.Flush()
  	}
  
  	// Build a list of context names to print, and warn if any requested contexts are not found.
  	// Do this before printing the headers so it doesn't look ugly.
  	allErrs := []error{}
  	toPrint := []string{}
  	if len(o.contextNames) == 0 {
  		for name := range config.Contexts {
  			toPrint = append(toPrint, name)
  		}
  	} else {
  		for _, name := range o.contextNames {
  			_, ok := config.Contexts[name]
  			if ok {
  				toPrint = append(toPrint, name)
  			} else {
  				allErrs = append(allErrs, fmt.Errorf("context %v not found", name))
  			}
  		}
  	}
  	if o.showHeaders {
  		err = printContextHeaders(out, o.nameOnly)
  		if err != nil {
  			allErrs = append(allErrs, err)
  		}
  	}
  
  	sort.Strings(toPrint)
  	for _, name := range toPrint {
  		err = printContext(name, config.Contexts[name], out, o.nameOnly, config.CurrentContext == name)
  		if err != nil {
  			allErrs = append(allErrs, err)
  		}
  	}
  
  	return utilerrors.NewAggregate(allErrs)
  }
docs: // RunGetContexts implements all the necessary functionality for context retrieval.