code: func NewCmdCompletion(root *cobra.Command) *cobra.Command {
  	shells := []string{}
  	for s := range completionShells {
  		shells = append(shells, s)
  	}
  
  	return &cobra.Command{
  		Use:   "completion SHELL",
  		Short: "Generate completion for the s2i command (bash or zsh)",
  		Long:  "Generate completion for the s2i command into standard output  (bash or zsh)",
  		Run: func(cmd *cobra.Command, args []string) {
  			// TODO: The version of cobra we vendor takes a
  			// *bytes.Buffer, while newer versions take an
  			// io.Writer. The code below could be simplified to a
  			// single line `root.GenBashCompletion(os.Stdout)` when
  			// we update cobra.
  			var out bytes.Buffer
  			err := RunCompletion(&out, cmd, root, args)
  			if err != nil {
  				s2ierr.CheckError(err)
  			} else {
  				fmt.Print(out.String())
  			}
  		},
  		ValidArgs: shells,
  	}
  }
docs: // NewCmdCompletion implements the S2I cli completion command.