File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,12 @@ type lndConfig struct {
99type viewParameters struct {}
1010
1111type config struct {
12- Insecure bool `long:"insecure" description:"disable tls"`
13- Network string `long:"network" description:"network to run on" choice:"regtest" choice:"testnet" choice:"mainnet" choice:"simnet"`
14- SwapServer string `long:"swapserver" description:"swap server address host:port"`
15- RPCListen string `long:"rpclisten" description:"Address to listen on for gRPC clients"`
16- RESTListen string `long:"restlisten" description:"Address to listen on for REST clients"`
12+ ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
13+ Insecure bool `long:"insecure" description:"disable tls"`
14+ Network string `long:"network" description:"network to run on" choice:"regtest" choice:"testnet" choice:"mainnet" choice:"simnet"`
15+ SwapServer string `long:"swapserver" description:"swap server address host:port"`
16+ RPCListen string `long:"rpclisten" description:"Address to listen on for gRPC clients"`
17+ RESTListen string `long:"restlisten" description:"Address to listen on for REST clients"`
1718
1819 Lnd * lndConfig `group:"lnd" namespace:"lnd"`
1920
Original file line number Diff line number Diff line change 44 "fmt"
55 "os"
66 "path/filepath"
7+ "strings"
78 "sync"
89
910 flags "github.com/jessevdk/go-flags"
@@ -72,6 +73,17 @@ func start() error {
7273 return err
7374 }
7475
76+ // Show the version and exit if the version flag was specified.
77+ appName := filepath .Base (os .Args [0 ])
78+ appName = strings .TrimSuffix (appName , filepath .Ext (appName ))
79+ if config .ShowVersion {
80+ fmt .Println (appName , "version" , loop .Version ())
81+ os .Exit (0 )
82+ }
83+
84+ // Print the version before executing either primary directive.
85+ logger .Infof ("Version: %v" , loop .Version ())
86+
7587 // Execute command.
7688 if parser .Active == nil {
7789 return daemon (& config )
You can’t perform that action at this time.
0 commit comments