effekt-lang / effekt

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

Add `--version` CLI flag #556

Closed jiribenes closed 3 months ago

jiribenes commented 3 months ago

Resolves #540

Scallop already supports printing out a version just by calling version(<your version identifier>) (see docs here), let's just use it :)

Usage

$ effekt --version
Effekt 0.99.99+nightly

(I changed my version in build.sbt in order to make this very visible)

Help page

The version also gets printed out on --help:

$ effekt --help
Effekt 0.99.99+nightly
 Common Options
  -c, --compile                  Compile the Effekt program to the backend
                                 specific representation
      --no-compile
  -b, --build                    Compile the Effekt program and build a backend
                                 specific executable
      --nobuild
  -o, --out  <arg>               Path to write generated files to (defaults to
                                 ./out)
      --includes  <arg>...       Path to consider for includes (can be set
                                 multiple times)
  -l, --lib  <arg>               Path to the standard library to be used
      --backend  <arg>           The backend that should be used Choices: js,
                                 js-web, chez-callcc, chez-monadic, chez-lift,
                                 llvm, ml

Note that we could add a larger "Usage: effekt ..."-style banner, see here.

b-studios commented 3 months ago

Ah you already discuss the prefixing in the PR description...

But many tools already prefix it, like javac, git, brew, pdflatex, ...

jiribenes commented 3 months ago

I'm also perfectly fine with somebody else going through the alternative solutions linked in the PR description, my requirements right now are:

To be more specific, I could see somebody implementing the prefixing, but than someone else needs to go ahead and handle this in all of the tooling.

b-studios commented 3 months ago

I agree it is simpler to process, but you probably need to parse the version anyways, no? If not, then lexicographic ordering would also work for a stable prefix, still.

I am just saying: I know how to strip a prefix in javascript (version.replace("Effekt ", "")), but don't know whether it is possible to configure Scallop the right way without forking it.

jiribenes commented 3 months ago

It complicates the tooling [IMO a bit unnecessarily], but I really need this PR to go through to unblock the other ones, so I'll concede the point and just do Effekt 0.1.2.3 instead (see the updated PR description).

Now the question is: are we happy with this format? It will be really difficult to change it afterwards, so please, if there's anybody who wants the output to look differently, now's your chance, please speak up!

b-studios commented 3 months ago

You can also just go with the version number and I'll ask the Scallop developer to help us.

b-studios commented 3 months ago

I don't have a strong preference so choose what you prefer and I'll handle the rest :)

jiribenes commented 3 months ago

I went ahead and customised all of the tooling so that it can handle a prefix, now I just want some confidence vote on the specific prefix to be used so that I don't have to support multiple different ones in the future.

... so, does anybody want a different format?