Mesg-core: add version command

proposal

#1

sample usage:
mesg-core version

sample output:
v0.7 (commit 047d331)

sample output:
dev (commit 433fede)


#2

already exist with:

mesg-core --version

output is:

mesg-core version v0.7.0

#3

That’s good. I’d also like to have the commit hash next to the version, this is specially good for the dev release, this way we can know the exact version in Git system.

Maybe we can create an alias for --version to make it work as a command too like mesg-core version? This seems a bit more convenient to me, easier to guess.


#4

It’s already the case for developer release. Check https://github.com/mesg-foundation/core/blob/master/.circleci/config.yml.

"publish_docker_dev":
    <<: *runOnMachine
    steps:
      - checkout
      - run: docker build -t mesg/core:dev --build-arg version="dev build `echo $CIRCLE_SHA1 | cut -c1-7`" .
"release_cli_dev":
    <<: *runOnDocker
    steps:
      - checkout
      - run: scripts/build-cli.sh "dev build `echo $CIRCLE_SHA1 | cut -c1-7`"

You can try by downloading a dev release: https://github.com/mesg-foundation/core/releases/tag/release-dev

I’m not sure we can create alias for this. It’s automatically done by cobra.