Skip to content

Directives API #3639

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

Gedochao
Copy link
Contributor

No description provided.

Copy link
Member

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cool, so the next step would be to generate some json structure out of it? Or a separate jar? We could have some code generation that creates a separate jar crosspublished for 2.13 and 3 🤔

Basically something like:

 val all = Directives.getDirectiveHandlers.map {
  handler => 
    s"""|
       |  object ${handler.name} {
       |    def description = "${handler.description}"
       |    def descriptionMd = "${handler.descriptionMd}"
       |    def usage = "${handler.usage}"
       |    def usageMd = "${handler.usageMd}"
       |    def keys = List(${handler.keys.map(key => s""""${key.name}"""").mkString(", ")})
       |  }
       |
       |""".stripMargin
}

  s"""|object Directives {
     |  ${all.mkString("\n")}
     |}
     |""".stripMargin

we can put that into a main to invoke from Mill and paste the output into Directives.scala files in a separate module.

@Gedochao
Copy link
Contributor Author

Looks cool, so the next step would be to generate some json structure out of it? Or a separate jar?

Ideally, I'd like a separate JAR, so that there'd be a way to match definitions with a particular version of Scala CLI.
I'll see what I can hack when I have a moment.

@Gedochao Gedochao force-pushed the feature/directives-api branch from 781de14 to 8a3ead6 Compare April 24, 2025 08:04
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 this pull request may close these issues.

2 participants