in imgmod.go [33:81]
func main() {
imgmodHelpText := ""
imgmodHelpEx := ""
logLevelStr := ""
imgmodCmd := &cobra.Command{
Use: "imgmod",
Short: "imgmod is a tool to view and modify Mynewt image files",
Long: imgmodHelpText,
Example: imgmodHelpEx,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
logLevel, err := log.ParseLevel(logLevelStr)
if err != nil {
cli.ImgmodUsage(nil, errors.Wrapf(err, "failed to parse log level"))
}
log.SetLevel(logLevel)
},
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}
imgmodCmd.PersistentFlags().BoolVarP(&iutil.Verbose, "verbose", "v", false,
"Enable verbose output when executing commands")
imgmodCmd.PersistentFlags().BoolVarP(&iutil.Quiet, "quiet", "q", false,
"Be quiet; only display error output")
imgmodCmd.PersistentFlags().StringVarP(&logLevelStr, "loglevel", "l",
"WARN", "Log level")
versHelpText := `Display the imgmod version number`
versHelpEx := " imgmod version"
versCmd := &cobra.Command{
Use: "version",
Short: "Display the imgmod version number",
Long: versHelpText,
Example: versHelpEx,
Run: func(cmd *cobra.Command, args []string) {
iutil.Printf("imgmod %s\n", version.VersionStr())
},
}
imgmodCmd.AddCommand(versCmd)
cli.AddImageCommands(imgmodCmd)
cli.AddMfgCommands(imgmodCmd)
cli.AddKeyCommands(imgmodCmd)
imgmodCmd.Execute()
}