From 0d92abfbf6b0e9f12e3522902379071018237a6f Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 5 Jun 2020 10:42:56 +0300 Subject: [PATCH] app/vmalert: print brief usage info for `vmalert -help` --- app/vmalert/main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/vmalert/main.go b/app/vmalert/main.go index c21737f776..526e783129 100644 --- a/app/vmalert/main.go +++ b/app/vmalert/main.go @@ -62,6 +62,7 @@ absolute path to all .yaml files in root.`) func main() { // Write flags and help message to stdout, since it is easier to grep or pipe. flag.CommandLine.SetOutput(os.Stdout) + flag.Usage = usage envflag.Parse() buildinfo.Init() logger.Init() @@ -172,3 +173,15 @@ func checkFlags() { logger.Fatalf("datasource.url is empty") } } + +func usage() { + const s = ` +vmalert processes alerts and recording rules. + +See the docs at https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/app/vmalert/README.md . +` + + f := flag.CommandLine.Output() + fmt.Fprintf(f, "%s\n", s) + flag.PrintDefaults() +}