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

Question @Recurse with context/prefix #86

Open
harscoet opened this issue Jul 17, 2018 · 1 comment
Open

Question @Recurse with context/prefix #86

harscoet opened this issue Jul 17, 2018 · 1 comment

Comments

@harscoet
Copy link

harscoet commented Jul 17, 2018

I have the following common options

case class CommonOptions(
    prod: Boolean = false,
    dry: Boolean = false,
    @Recurse slack: SlackOptions
)

with slack options defined with

case class SlackOptions(
    slackToken: Option[String],
    slackChannel: Option[String]
)

I would like to be able to define my case class like this

case class SlackOptions(
    token: Option[String],
    channel: Option[String]
)

But I want to keep context informations when I use command line

--slack-token=... --slack-channel=...

It should be great to have one annotation "@PrefixRecurse" (or similar) that uses the name used in parent in command line

--slack.token=... --slack.channel=...

Maybe do you have some tricks to do that? Using "ExtraName" is for the moment the best solution I found but I will have conflict If I have same keys in different context

case class SlackOptions(
    @ExtraName("slack-token")
    token: Option[String],
    @ExtraName("slack-channel")
    channel: Option[String]
)
@joan38
Copy link
Contributor

joan38 commented Nov 12, 2018

It would be cool to have something like @Recurse("slack")

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

No branches or pull requests

2 participants