code: func NewCmdAttach(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
  	o := NewAttachOptions(streams)
  	cmd := &cobra.Command{
  		Use:                   "attach (POD | TYPE/NAME) -c CONTAINER",
  		DisableFlagsInUseLine: true,
  		Short:                 i18n.T("Attach to a running container"),
  		Long:                  "Attach to a process that is already running inside an existing container.",
  		Example:               attachExample,
  		Run: func(cmd *cobra.Command, args []string) {
  			cmdutil.CheckErr(o.Complete(f, cmd, args))
  			cmdutil.CheckErr(o.Validate())
  			cmdutil.CheckErr(o.Run())
  		},
  	}
  	cmdutil.AddPodRunningTimeoutFlag(cmd, defaultPodAttachTimeout)
  	cmd.Flags().StringVarP(&o.ContainerName, "container", "c", o.ContainerName, "Container name. If omitted, the first container in the pod will be chosen")
  	cmd.Flags().BoolVarP(&o.Stdin, "stdin", "i", o.Stdin, "Pass stdin to the container")
  	cmd.Flags().BoolVarP(&o.TTY, "tty", "t", o.TTY, "Stdin is a TTY")
  	return cmd
  }
docs: // NewCmdAttach returns the attach Cobra command