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

Proposal to Add -v or --version Parameter to CLI Interface #80

Open
gregoriopellegrino opened this issue Jun 27, 2023 · 8 comments
Open
Assignees
Labels

Comments

@gregoriopellegrino
Copy link

I would like to propose the addition of a new parameter, either -v or --version, to the command-line interface (CLI) of our tool. This parameter would allow users to quickly retrieve information about the version of the tool they are using.

Currently, when working with the CLI, it can be cumbersome to find the version of the tool.

@mickael-menu
Copy link
Member

Sure, good idea.

I would avoid hard-coding the current version though. We can use this snippet during build time to get the version number from the Git tags:

git describe --tags --match v[0-9]* 2> /dev/null

Cool thing is that between two versions you still get a descriptive version number, e.g. v0.11.1-2-gab1d8fd

@chocolatkey
Copy link
Member

This is very easy to do using goreleaser (which we already use). See https://goreleaser.com/cookbooks/using-main.version/
That might be all we need, but can also be overridden, e.g.

ldflags:
      - -s -w -X github.com/xxx/yyy/internal/consts.BuildCommit={{.Commit}} -X github.com/xxx/yyy/internal/consts.BuildTimestamp={{.Timestamp}}

@HadrienGardeur
Copy link
Member

We'll also need to add this version number in our JSON output, as we're increasingly going to rely on it.

@chocolatkey
Copy link
Member

@HadrienGardeur Has it been decided how the version number would be output in the WebPub?

@HadrienGardeur
Copy link
Member

@chocolatkey since our extensibility is built on URIs in RWPM, I recommend using https://github.com/readium/go-toolkit/releases/ as the key and that we use a string for its value.

@chocolatkey
Copy link
Member

@HadrienGardeur Just to confirm - the / character is supposed to be at the end of the key?

@HadrienGardeur
Copy link
Member

You're right, we can drop it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants