You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cmd.go
    path of file: ./repos/infra/internal/cmd
    
    the code of the file until where you have to start completion: package cmd

import (
	"context"
	"crypto/tls"
	"crypto/x509"
	"fmt"
	"io"
	"net/http"
	"os"
	"time"

	"github.com/lensesio/tableprinter"
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
	"golang.org/x/term"

	"github.com/infrahq/infra/api"
	"github.com/infrahq/infra/internal"
	"github.com/infrahq/infra/internal/cmd/cliopts"
	"github.com/infrahq/infra/internal/logging"
)

// Run the main CLI command with the given args. The args should not contain
// the name of the binary (ex: os.Args[1:]).
func Run(ctx context.Context, args ...string) error {
	cli := newCLI(ctx)
	cmd := NewRootCmd(cli)
	cmd.SetArgs(args)
	return cmd.ExecuteContext(ctx)
}

func printTable(data interface{}, out io.Writer) {
	table := tableprinter.New(out)

	
    
func apiClientFromHostConfig(config *ClientHostConfig) (*APIClientOpts, error) {
	server := config.Host
	var accessKey string
	if !config.isExpired() {
		accessKey = config.AccessKey
	}

	if envAccessKey, ok := os.LookupEnv("INFRA_ACCESS_KEY"); ok {
		accessKey = envAccessKey
	}

	if len(accessKey) == 0 {
		if config.isExpired() {
			return nil, Error{Message: "Access key is expired, please `infra login` again", OriginalError: ErrAccessKeyExpired}
		}
		return nil, Error{Message: "Missing access key, must `infra login` or set INFRA_ACCESS_KEY in your environment", OriginalError: ErrAccessKeyMissing}
	}

	if envServer, ok := os.LookupEnv("INFRA_SERVER"); ok {
		server = envServer
	}

	return &APIClientOpts{
		Host:      server,
		AccessKey: accessKey,
		Transport: httpTransportForHostConfig(config),
	}, nil
}