Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Envvar is ignored for options inside option group #330

Closed
zeldigas opened this issue Jan 12, 2022 · 0 comments · Fixed by #333
Closed

Envvar is ignored for options inside option group #330

zeldigas opened this issue Jan 12, 2022 · 0 comments · Fixed by #333

Comments

@zeldigas
Copy link

I'm using option group to organize 2 properties with cooccuring feature. Options inside has envvar defined.

The problem is that env variable is not used to resolve option. This works properly for plain options that are defined without option group

private class UserCreds : OptionGroup("Confluence user credentials") {
    val confluenceUser: String by option("--user", envvar = "CONFLUENCE_USER").required()
    val confluencePassword: String? by option(
        "--password",
        envvar = "CONFLUENCE_PASSWORD",
        help = "User password or personal API token provided instead of password (e.g. in Confluence Cloud)"
    )
}

class Upload : CliktCommand(name = "upload", help = "Converts source files and uploads them to confluence") {

    private val confluenceUrl: Url? by option(
        "--confluence-url", envvar = "CONFLUENCE_URL",
        help = "Address of confluence server. For Confluence cloud it is usually https://<site>.atlassian.net/wiki"
    ).convert { Url(it) }
    private val userCreds: UserCreds? by UserCreds().cooccurring()
....

In this example CONFLUENCE_URL is propertly resolved, while CONFLUENCE_USER is ignored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant