// main defines the bundle usage and registers all defined commands and flags.
main defines the bundle usage and registers all defined commands and flags.
// main defines the bundle usage and registers all defined commands and flags .
func main() {
	var bundleFlagSet = flag.NewFlagSet("bundle", flag.ExitOnError)
	var c cli.Config
	var usageText = `cfssl-bundle -- create a certificate bundle that contains the client cert
	Usage of bundle:
		- Bundle local certificate files
        	bundle -cert file [-ca-bundle file] [-int-bundle file] [-int-dir dir] [-metadata file] [-key keyfile] [-flavor optimal|ubiquitous|force] [-password password]
		- Bundle certificate from remote server.
        	bundle -domain domain_name [-ip ip_address] [-ca-bundle file] [-int-bundle file] [-int-dir dir] [-metadata file]
	Flags:
	`
	registerFlags(&c, bundleFlagSet)
	bundleFlagSet.Usage = func() {
		fmt.Fprintf(os.Stderr, "\t%s", usageText)
		for _, name := range bundle.Command.Flags {
			if f := bundleFlagSet.Lookup(name); f != nil {
				printDefaultValue(f)
			}
		}
	}
	args := os.Args[1:]
	bundleFlagSet.Parse(args)
	args = bundleFlagSet.Args()
	var err error
	c.CFG, err = config.LoadFile(c.ConfigFile)
	if c.ConfigFile != "" && err != nil {
		fmt.Fprintf(os.Stderr, "Failed to load config file: %v", err)
	}
	if err := bundle.Command.Main(args, c); err != nil {
		fmt.Fprintln(os.Stderr, err)
	}
}
func main ( ) { var bundleFlagSet = flag . NewFlagSet ( " " , flag . ExitOnError ) var c cli . Config var usageText = `cfssl-bundle -- create a certificate bundle that contains the client cert

	Usage of bundle:
		- Bundle local certificate files
        	bundle -cert file [-ca-bundle file] [-int-bundle file] [-int-dir dir] [-metadata file] [-key keyfile] [-flavor optimal|ubiquitous|force] [-password password]
		- Bundle certificate from remote server.
        	bundle -domain domain_name [-ip ip_address] [-ca-bundle file] [-int-bundle file] [-int-dir dir] [-metadata file]

	Flags:
	` registerFlags ( & c , bundleFlagSet ) bundleFlagSet . Usage = func ( ) { fmt . Fprintf ( os . Stderr , " \t " , usageText ) for _ , name := range bundle . Command . Flags { if f := bundleFlagSet . Lookup ( name ) ; f != nil { printDefaultValue ( f ) } } } args := os . Args [ 1 : ] bundleFlagSet . Parse ( args ) args = bundleFlagSet . Args ( ) var err error c . CFG , err = config . LoadFile ( c . ConfigFile ) if c . ConfigFile != " " && err != nil { fmt . Fprintf ( os . Stderr , " " , err ) } if err := bundle . Command . Main ( args , c ) ; err != nil { fmt . Fprintln ( os . Stderr , err ) } }
main defines the bundle usage and registers all defined commands and flags.
main defines the bundle usage and registers all defined commands and flags .