Skip to content

Add `-help` and `-version` flags to the Gitaly CLI

Andrew Newdigate requested to merge better-usage into master

The Production team have requested that we add usage and version flags to the Gitaly CLI, for easier problem diagnosis.

At present, running the binary does output the version, but having a proper interface for it make is easier for other teams to understand and use.

Example Usage:

Help:

$ gitaly -help # or gitaly --help
Gitaly, version X.Y.Z
Usage: gitaly [OPTIONS] configfile
  -version
    	Print version and exit
exit status 2
$ echo $?
2

Version:

$ gitaly -version
Gitaly, version X.Y.Z
$ echo $?
0

Invalid:

$ gitaly -asdasd
flag provided but not defined: -asdasd
Gitaly, version X.Y.Z
Usage: gitaly [OPTIONS] configfile
  -version
    	Print version and exit
exit status 2
$ echo $?
2

Normal:

$ gitaly config.toml
INFO[0000] Starting Gitaly                               version=
INFO[0000] listening at tcp address                      address=":9999"
INFO[0000] Starting prometheus listener                  address=":9236"

cc @omame

Merge request reports