effekt-lang / effekt

A language with lexical effect handlers and lightweight effect polymorphism
https://effekt-lang.org
MIT License
334 stars 24 forks source link

Use CLI subcommands #534

Open jiribenes opened 4 months ago

jiribenes commented 4 months ago

We have accumulated a lot of CLI flags, but many of them are just exclusive commands. https://github.com/effekt-lang/effekt/blob/7de9eff01bf7ab87059a564dea4e7a103b7145e7/effekt/jvm/src/main/scala/effekt/EffektConfig.scala#L8-L165

Instead, we might want to move to subcommands, so something like:

effekt run <files>
effekt compile --backend=<backend> <files>
effekt lsp
... # etc

This would also allow us to then add other commands like effekt fmt for formatting, effekt watch for rebuilding files upon file change, and effekt doc for documentation generation in the future.

jiribenes commented 3 months ago

If someone tackles this issue, it would be also nice to tackle https://github.com/effekt-lang/effekt/issues/540 as a drive-by :)

dvdvgt commented 2 months ago

What about validating the options instead of using sub commands? https://github.com/scallop/scallop/wiki/Arguments-validation#mutually-exclusive

I am afraid that while server, repl, build, compile are all mutually exclusive, they all share (more or less) the same options and by using sub commands, these options would not be directly visible to the outside without a nice way to query them. https://github.com/scallop/scallop/wiki/Arguments-validation#mutually-exclusive

jiribenes commented 14 hours ago

After we do this: