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

Allow passing args directly to Scala Native CLI #3474

Open
keynmol opened this issue Feb 4, 2025 · 3 comments
Open

Allow passing args directly to Scala Native CLI #3474

keynmol opened this issue Feb 4, 2025 · 3 comments
Labels
enhancement New feature or request Scala Native

Comments

@keynmol
Copy link
Contributor

keynmol commented Feb 4, 2025

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

I propose adding a --native-cli-opt <flag-value> repeated option that allows passing <flag-value> directly to scala-native-cli.
The option can be marked as hidden as it's considered advanced usage.

Describe alternatives you've considered

Porting flags one by one – requires keeping CLIs in sync and slows down everyone.

Additional context

N/A

@keynmol keynmol added the enhancement New feature or request label Feb 4, 2025
@tgodzik
Copy link
Member

tgodzik commented Feb 5, 2025

Thanks for reporting! @Gedochao will have most background here, but he is out this week.

@Gedochao
Copy link
Contributor

We could support it similar to how we do Scala compiler options with -O, sure... but similar to that, it would require the same amount of extra fluff to detect duplicates with the existing options. Doable, but requires a bit of effort to both implement and maintain.

Alternatively, we could maybe depend on scala-native-cli somehow, if the command line options were exposed as an API (or perhaps via a common dependency), so that new options are immediately supported when we bump Scala Native? @WojciechMazur is that something worth considering?

@WojciechMazur
Copy link
Contributor

AFAIK the scala-cli does not use scala-native-cli API but instead uses it as command line so that there is no issues with binary compatibility. The scala-native-cli itself has no other dependencies beside the Scala Native toolchain itself. So the API approach might not be trivial

However, becouse currently it's used a command line, we can add command lines that would be available since next sn-cli. Currently we're using scopt which I belive does not have builtin option to do it (beside using --help and parsing the stdout) but we might consider adjusting the code to automatically register available settings names and make them available as command output, eg. in JSON format. This can be consumed if available (when using SN 0.5.7+) or ignored by scala-cli otherwise

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

No branches or pull requests

4 participants