unsplash / intlc

Compile ICU messages into code. Supports TypeScript and JSX. No runtime.
MIT License
56 stars 2 forks source link

Add --version option #196

Closed samhh closed 1 year ago

samhh commented 1 year ago

Closes #98.

Follows the CLIG idiom/suggestion of --version.

Uses Git to produce the output so it can't fall out of date. Ideally it'd conditionally append "-dirty" as well, but that's not currently supported by the library and my own attempt was flaky.

$ git switch version-opt
$ cabal run -- intlc --version
v0.7.0-12-g8624452
$ git tag v0.8.0
$ cabal clean # Cabal doesn't know we need to rebuild. Naturally won't be an issue in CI.
$ cabal run -- intlc --version
v0.8.0
$ touch foo && git add foo && git commit
$ cabal clean
$ cabal run -- intlc --version
v0.8.0-1-g06fd894