func initRootOpts() error {
	// Set up viper environment variable handling
	viper.SetEnvPrefix("pullsheet")
	envKeys := []string{
		"repos", "branches", "users", "since", "until", "title", "token-path", "out",
	}
	for _, key := range envKeys {
		if err := viper.BindEnv(key); err != nil {
			return err
		}
	}

	if rootOpts.out != "JSON" && rootOpts.out != "CSV" {
		return fmt.Errorf("invalid out parameter %s. Must be JSON or CSV", rootOpts.out)
	}

	// Set options. viper will prioritize flags over env variables
	rootOpts.repos = viper.GetStringSlice("repos")
	rootOpts.branches = viper.GetStringSlice("branches")
	rootOpts.users = viper.GetStringSlice("users")
	rootOpts.since = viper.GetString("since")
	rootOpts.until = viper.GetString("until")
	rootOpts.title = viper.GetString("title")
	rootOpts.tokenPath = viper.GetString("token-path")
	rootOpts.out = viper.GetString("out")
	return nil
}
// initRootOpts sets up root options, using env variables to set options if
// they haven't been set by flags
initRootOpts sets up root options, using env variables to set options if
they haven't been set by flags
// initRootOpts sets up root options using env variables to set options if // they haven ' t been set by flags
func initRootOpts() error {
	viper.SetEnvPrefix("pullsheet")
	envKeys := []string{
		"repos", "branches", "users", "since", "until", "title", "token-path", "out",
	}
	for _, key := range envKeys {
		if err := viper.BindEnv(key); err != nil {
			return err
		}
	}
	if rootOpts.out != "JSON" && rootOpts.out != "CSV" {
		return fmt.Errorf("invalid out parameter %s. Must be JSON or CSV", rootOpts.out)
	}
	rootOpts.repos = viper.GetStringSlice("repos")
	rootOpts.branches = viper.GetStringSlice("branches")
	rootOpts.users = viper.GetStringSlice("users")
	rootOpts.since = viper.GetString("since")
	rootOpts.until = viper.GetString("until")
	rootOpts.title = viper.GetString("title")
	rootOpts.tokenPath = viper.GetString("token-path")
	rootOpts.out = viper.GetString("out")
	return nil
}
func initRootOpts ( ) error { viper . SetEnvPrefix ( " " ) envKeys := [ ] string { " " , " " , " " , " " , " " , " " , " " , " " , } for _ , key := range envKeys { if err := viper . BindEnv ( key ) ; err != nil { return err } } if rootOpts . out != " " && rootOpts . out != " " { return fmt . Errorf ( " " , rootOpts . out ) } rootOpts . repos = viper . GetStringSlice ( " " ) rootOpts . branches = viper . GetStringSlice ( " " ) rootOpts . users = viper . GetStringSlice ( " " ) rootOpts . since = viper . GetString ( " " ) rootOpts . until = viper . GetString ( " " ) rootOpts . title = viper . GetString ( " " ) rootOpts . tokenPath = viper . GetString ( " " ) rootOpts . out = viper . GetString ( " " ) return nil }
initRootOpts sets up root options, using env variables to set options if
they haven't been set by flags
initRootOpts sets up root options using env variables to set options if they haven ' t been set by flags
// Set up viper environment variable handling // Set options. viper will prioritize flags over env variables