You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: gen.go
    path of file: ./repos/sealos/cmd/sealos/cmd
    
    the code of the file until where you have to start completion: /*
Copyright 2022 cuisongliu@qq.com.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS
    
func newGenCmd() *cobra.Command {
	genArgs := &apply.RunArgs{
		Cluster: &apply.Cluster{},
		SSH:     &apply.SSH{},
	}

	var out string
	var genCmd = &cobra.Command{
		Use:     "gen",
		Short:   "generate a Clusterfile with all default settings",
		Long:    `generate a Clusterfile of the kubernetes cluster, which can be applied by 'sealos apply' command`,
		Example: exampleGen,
		Args:    cobra.MinimumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			data, err := apply.NewClusterFromGenArgs(cmd, genArgs, args)
			if err != nil {
				return err
			}
			var outputWriter io.WriteCloser
			switch out {
			case "", "stdout":
				logger.Info("if you want to save the output of gen command, use '--output' option instead of redirecting to file")
				outputWriter = os.Stdout
			default:
				outputWriter, err = os.Create(out)
			}
			if err != nil {
				return err
			}
			defer outputWriter.Close()
			_, err = fmt.Fprintln(outputWriter, string(data))
			return err
		},
	}
	setRequireBuildahAnnotation(genCmd)
	genArgs.RegisterFlags(genCmd.Flags())
	genCmd.Flags().StringVarP(&out, "output", "o", "", "print output to named file")

	return genCmd
}