func()

in pkg/repo/query.go [52:83]


func (r *Repo) PrepareQueryOpts(opts *QueryOpts) error {
	err := opts.Validate()
	if err != nil {
		return fmt.Errorf("invalid query opts: %w", err)
	}

	groups := r.KEPHandler.Groups

	if len(opts.Groups) > 0 {
		sigs, err := selectByRegexp(groups, opts.Groups)
		if err != nil {
			return err
		}

		if len(sigs) == 0 {
			return fmt.Errorf("no SIGs match any of: %v", opts.Groups)
		}

		opts.Groups = sigs
	} else {
		// if no SIGs are passed, list KEPs from all SIGs
		opts.Groups = groups
	}

	for i, v := range opts.Stage {
		if v == "none" {
			opts.Stage[i] = ""
		}
	}

	return nil
}