func GetReviews(Config config.RVConfig) (listCount [][2]string) {

	token := config.GetGithubToken()
	if utils.IsEmpty(token) {
		fmt.Println("No GitHub Token found in the environment variable", config.ENV_GITHUB_VAR)
		return
	}

	return
}
Example #2
0
func parseArgs() (confFromCommandline config.RVConfig) {
	flag.Parse()

	// version
	if *versionFlag {
		fmt.Println("Version:", APP_VERSION)
		os.Exit(0)
	}
	//// repos to be checked
	//if (utils.IsEmpty(*repos) || utils.IsEmpty(*sentinel)) {
	//	flag.PrintDefaults()
	//}
	if !utils.IsEmpty(*repos) {
		confFromCommandline.Repos = strings.Split(*repos, " ")
	}
	if !utils.IsEmpty(*sentinel) {
		confFromCommandline.Sentinel = strings.Split(*sentinel, " ")
	}
	if !utils.IsEmpty(*token) {
		confFromCommandline.Token = *token
	}
	return
}
func ChooseConfig(confFromCommandline RVConfig, confFromFile RVConfig) (finalConfig RVConfig) {

	if len(confFromCommandline.Repos) > 0 {
		finalConfig.Repos = confFromCommandline.Repos
	} else {
		finalConfig.Repos = confFromFile.Repos
	}

	if len(confFromCommandline.Sentinel) > 0 {
		finalConfig.Sentinel = confFromCommandline.Sentinel
	} else {
		finalConfig.Sentinel = confFromFile.Sentinel
	}

	if !utils.IsEmpty(confFromCommandline.Token) {
		finalConfig.Token = confFromCommandline.Token
	} else {
		finalConfig.Token = confFromFile.Token
	}

	return
}