This might not be necessary since it's just a few helper functions most users can stub out in their code, e.g.,
func getFlagOrEnv(s *cli.State, name string, envPrefix string) (string, error) {
envName := strings.ToUpper(name)
val := cmp.Or(
cli.GetFlag[string](s, name),
os.Getenv(envPrefix+envName),
)
if val == "" {
return "", fmt.Errorf("must provide --%s flag or set %s environment variable", name, envName)
}
return val, nil
}
We could optionally bake this logic into the cli library or add a cli.GetFlagOrEnv helper function.