func (command *OutCommand) match(params Params, sourceDir string) (string, error) {
	var matches []string
	var err error
	var pattern string

	if params.File != "" {
		pattern = params.File
		matches, err = filepath.Glob(filepath.Join(sourceDir, pattern))
	} else {
		paths := []string{}
		filepath.Walk(sourceDir, func(path string, info os.FileInfo, err error) error {
			paths = append(paths, path)
			return nil
		})
		pattern = params.From
		matches, err = versions.MatchUnanchored(paths, pattern)
	}

	if err != nil {
		return "", err
	}

	if len(matches) == 0 {
		return "", fmt.Errorf("no matches found for pattern: %s", pattern)
	}

	if len(matches) > 1 {
		return "", fmt.Errorf("more than one match found for pattern: %s\n%v", pattern, matches)
	}

	return matches[0], nil
}
func (command *OutCommand) match(sourceDir, pattern string) (string, error) {
	paths := []string{}
	filepath.Walk(sourceDir, func(path string, info os.FileInfo, err error) error {
		paths = append(paths, path)
		return nil
	})

	matches, err := versions.MatchUnanchored(paths, pattern)
	if err != nil {
		return "", err
	}

	if len(matches) == 0 {
		return "", fmt.Errorf("no matches found for pattern: %s", pattern)
	}

	if len(matches) > 1 {
		return "", fmt.Errorf("more than one match found for pattern: %s\n%v", pattern, matches)
	}

	return matches[0], nil
}