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

::export with vararg #24

Open
elect86 opened this issue Sep 14, 2021 · 2 comments
Open

::export with vararg #24

elect86 opened this issue Sep 14, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@elect86
Copy link

elect86 commented Sep 14, 2021

Hi,

super cool project!

I need to define multiple exports like:

export JAVA_OPTS='-Xms82G -Xmx82G -XX:+UseParallelGC'
export EPISIM_SETUP='org.matsim.run.batch.DresdenCalibration'
export EPISIM_PARAMS='org.matsim.run.batch.DresdenCalibration$Params'
export EPISIM_INPUT='dresden'
export EPISIM_OUTPUT='output-dresden'

I'd like another ::export that accept a vararg, in this way I may simply type

export(
   "JAVA_OPTS" to "-Xms82G -Xmx82G -XX:+UseParallelGC",
   "EPISIM_SETUP" to "org.matsim.run.batch.DresdenCalibration",
   "EPISIM_PARAMS" to "org.matsim.run.batch.DresdenCalibration$Params",
   "EPISIM_INPUT" to "dresden",
   "EPISIM_OUTPUT" to "output-dresden")
@jakubriegel jakubriegel added the enhancement New feature or request label Sep 15, 2021
@jakubriegel
Copy link
Owner

Hi!
Vararg export seems like a good idea 🙂

For now I can suggest to do something like this:

listOf(
   |"JAVA_OPTS" to "-Xms82G -Xmx82G -XX:+UseParallelGC",
   "EPISIM_SETUP" to "org.matsim.run.batch.DresdenCalibration",
   "EPISIM_PARAMS" to "org.matsim.run.batch.DresdenCalibration$Params",
   "EPISIM_INPUT" to "dresden",
   "EPISIM_OUTPUT" to "output-dresden"
).forEach { export(it)}

@elect86
Copy link
Author

elect86 commented Sep 15, 2021

I went with

    fun exports(vararg exports: Pair<String, String>) = exports.map { export(it) }
    exports(
        "JAVA_OPTS" to "-Xms82G -Xmx82G -XX:+UseParallelGC",
        "EPISIM_SETUP" to "org.matsim.run.batch.DresdenCalibration",
        "EPISIM_PARAMS" to "org.matsim.run.batch.DresdenCalibration\$Params",
        "EPISIM_INPUT" to "dresden",
        "EPISIM_OUTPUT" to "output-dresden")

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

No branches or pull requests

2 participants