github.com/telepresenceio/telepresence/v2@v2.20.0-pro.6.0.20240517030216-236ea954e789/pkg/client/cli/cmd/connect.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  
     6  	"github.com/telepresenceio/telepresence/v2/pkg/client/cli/ann"
     7  	"github.com/telepresenceio/telepresence/v2/pkg/client/cli/connect"
     8  	"github.com/telepresenceio/telepresence/v2/pkg/client/cli/daemon"
     9  )
    10  
    11  func connectCmd() *cobra.Command {
    12  	var request *daemon.CobraRequest
    13  
    14  	cmd := &cobra.Command{
    15  		Use:   "connect [flags] [-- <command to run while connected>]",
    16  		Args:  cobra.ArbitraryArgs,
    17  		Short: "Connect to a cluster",
    18  		Annotations: map[string]string{
    19  			ann.Session: ann.Required,
    20  		},
    21  		RunE: func(cmd *cobra.Command, args []string) error {
    22  			if err := request.CommitFlags(cmd); err != nil {
    23  				return err
    24  			}
    25  			return connect.RunConnect(cmd, args)
    26  		},
    27  	}
    28  	request = daemon.InitRequest(cmd)
    29  	return cmd
    30  }