code: func runCompletion(w io.Writer, cmd *cobra.Command, args []string) (exit int) {
  	if len(args) == 0 {
  		stderr.Print("shell type is not specified")
  		return 254
  	}
  
  	if len(args) > 1 {
  		stderr.Print("too many arguments, only shell type is expected")
  		return 254
  	}
  
  	// Right now only bash completion is supported, but zsh could be
  	// supported in a future as well.
  	completion, ok := completionShells[args[0]]
  	if !ok {
  		stderr.Printf("'%s' shell is not supported", args[0])
  		return 254
  	}
  
  	// Write the shell completion to the specified writer.
  	err := completion(w, cmd.Parent())
  	if err != nil {
  		stderr.PrintE("completion failed", err)
  		return 254
  	}
  
  	return 0
  }
docs: // runCompletion is a command handler to generate the shell script with
  // shell completion functions.
  //
  // It ensures that there are enough arguments to generate the completion
  // scripts.