github.com/telepresenceio/telepresence/v2@v2.20.0-pro.6.0.20240517030216-236ea954e789/pkg/client/cli/cmd/quit.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 ) 9 10 func quit() *cobra.Command { 11 quitDaemons := false 12 cmd := &cobra.Command{ 13 Use: "quit", 14 Args: cobra.NoArgs, 15 Short: "Tell telepresence daemons to quit", 16 RunE: func(cmd *cobra.Command, _ []string) error { 17 if quitDaemons { 18 connect.Quit(cmd.Context()) 19 } else { 20 cmd.Annotations = map[string]string{ann.UserDaemon: ann.Optional} 21 if err := connect.InitCommand(cmd); err != nil { 22 return err 23 } 24 connect.Disconnect(cmd.Context()) 25 } 26 return nil 27 }, 28 } 29 flags := cmd.Flags() 30 flags.BoolVarP(&quitDaemons, "stop-daemons", "s", false, "stop all local telepresence daemons") 31 return cmd 32 }