Always log version at startup.
authorTom Clegg <tom@tomclegg.ca>
Sun, 12 Sep 2021 19:24:45 +0000 (15:24 -0400)
committerTom Clegg <tom@tomclegg.ca>
Mon, 13 Sep 2021 01:01:32 +0000 (21:01 -0400)
No issue #

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

cmd.go

diff --git a/cmd.go b/cmd.go
index a4df2e0fcbef5ce3a5a4e28786143daed0601fda..3975bf7b0348aff8a84b99712e83758813a79ede 100644 (file)
--- a/cmd.go
+++ b/cmd.go
@@ -10,6 +10,7 @@ import (
        "io/ioutil"
        "os"
        "os/exec"
+       "strings"
 
        "git.arvados.org/arvados.git/lib/cmd"
        "github.com/mattn/go-isatty"
@@ -47,6 +48,9 @@ func Main() {
        if !isatty.IsTerminal(os.Stderr.Fd()) {
                logrus.StandardLogger().Formatter = &logrus.TextFormatter{DisableTimestamp: true}
        }
+       if len(os.Args) >= 2 && !strings.HasSuffix(os.Args[1], "version") {
+               cmd.Version.RunCommand("lightning", nil, nil, os.Stderr, os.Stderr)
+       }
        os.Exit(handler.RunCommand(os.Args[0], os.Args[1:], os.Stdin, os.Stdout, os.Stderr))
 }