code: func RunExport(dockerCli command.Cli, opts *ExportOptions) error {
  	if err := validateContextName(opts.ContextName); err != nil && opts.ContextName != command.DefaultContextName {
  		return err
  	}
  	ctxMeta, err := dockerCli.ContextStore().GetMetadata(opts.ContextName)
  	if err != nil {
  		return err
  	}
  	if !opts.Kubeconfig {
  		reader := store.Export(opts.ContextName, dockerCli.ContextStore())
  		defer reader.Close()
  		return writeTo(dockerCli, reader, opts.Dest)
  	}
  	kubernetesEndpointMeta := kubernetes.EndpointFromContext(ctxMeta)
  	if kubernetesEndpointMeta == nil {
  		return fmt.Errorf("context %q has no kubernetes endpoint", opts.ContextName)
  	}
  	kubernetesEndpoint, err := kubernetesEndpointMeta.WithTLSData(dockerCli.ContextStore(), opts.ContextName)
  	if err != nil {
  		return err
  	}
  	kubeConfig := kubernetesEndpoint.KubernetesConfig()
  	rawCfg, err := kubeConfig.RawConfig()
  	if err != nil {
  		return err
  	}
  	data, err := clientcmd.Write(rawCfg)
  	if err != nil {
  		return err
  	}
  	return writeTo(dockerCli, bytes.NewBuffer(data), opts.Dest)
  }
docs: // RunExport exports a Docker context