func ExecuteE()

in ctc_lib/cli_interface.go [50:94]


func ExecuteE(ctb CLIInterface) (err error) {
	if err := ctb.ValidateCommand(); err != nil {
		return err
	}
	ctb.Init()
	if ctb.isRunODefined() {
		cobraRunE := func(c *cobra.Command, args []string) error {
			err = ctb.printO(c, args)
			return err
		}
		ctb.setRunE(cobraRunE)
	}

	err = ctb.getCommand().Execute()

	//Add empty line as template.Execute does not print an empty line
	ctb.getCommand().Println()

	// Run Update Command to see if Updates are available.

	lastUpdatedCheckFilePath := filepath.Join(
		util.GetToolTempDirOrDefault(viper.GetString(config.TmpDirKey), ctb.toolName()),
		constants.LastUpdatedCheckFileName)

	Log.WithFields(log.Fields{
		"updatecheck":             viper.GetString(config.UpdateCheckConfigKey),
		"last_updated_check_file": lastUpdatedCheckFilePath,
		"update_interval_in_sec":  viper.GetFloat64(config.UpdateCheckIntervalInSecs),
	}).Debug("Checking if Update Check is required")
	if notify.ShouldCheckURLVersion(lastUpdatedCheckFilePath) && ReleaseUrl != "" {
		// Calling UpdateCheckCommand Explicitly. Hence no need to pass args.
		Log.Debug("Running Update Check Command")
		UpdateCheckCommand.RunE(ctb.getCommand(), nil)
		notify.WriteTimeToFile(lastUpdatedCheckFilePath, time.Now().UTC())
	}

	if util.IsDebug(Log.Level) {
		logFile, ok := logging.GetCurrentFileName(Log)
		if ok {
			ctb.getCommand().Println("See logs at ", logFile)
		}
	}

	return err
}