in pkg/commands/root.go [51:90]
func AddCommandsInternal(ctx context.Context, cio *cmdlib.CmdIO, flagset *flag.FlagSet, args []string) *cobra.Command {
gopts := &cmdlib.GlobalOptions{}
rootCmd := &cobra.Command{
Use: "bundlectl",
Short: "bundlectl is tool for inspecting, validation, and modifying components packages and component sets. If a command outputs data, the data is written to STDOUT.",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}
rootCmd.PersistentFlags().StringVarP(
&(gopts.InputFile), "input-file", "f", "", "The path to an input file")
rootCmd.PersistentFlags().StringVarP(
&(gopts.InputFormat), "in-format", "", "", "The input file format. One of either 'json' or 'yaml'. "+
"If an input-file is specified, it is inferred from the file extension. If not specified, it defaults to yaml.")
rootCmd.PersistentFlags().StringVarP(
&(gopts.OutputFormat), "format", "", "", "The output file format. One of either 'json' or 'yaml'. "+
"If not specified, it defaults to yaml.")
rootCmd.AddCommand(build.GetCommand(ctx, cio.FileIO, cio.StdIO, gopts))
rootCmd.AddCommand(export.GetCommand(ctx, cio.FileIO, cio.StdIO, gopts))
rootCmd.AddCommand(filter.GetCommand(ctx, cio.FileIO, cio.StdIO, gopts))
rootCmd.AddCommand(find.GetCommand(ctx, cio.FileIO, cio.StdIO, gopts))
rootCmd.AddCommand(patch.GetCommand(ctx, cio.FileIO, cio.StdIO, gopts))
rootCmd.AddCommand(validate.GetCommand(ctx, cio.FileIO, cio.StdIO, gopts))
rootCmd.AddCommand(version.GetCommand(cio))
// This is magic hackery I don't unherdstand but somehow this fixes
// errrs of the form 'ERROR: logging before flag.Parse'. See more at:
// https://github.com/kubernetes/kubernetes/issues/17162
rootCmd.PersistentFlags().AddGoFlagSet(flagset)
// pflag.Parse()
flag.CommandLine.Parse([]string{})
rootCmd.SetArgs(args)
return rootCmd
}