Skip to content

Commit

Permalink
dcrlncli: Use standard version flag
Browse files Browse the repository at this point in the history
This makes dcrlncli use the standard -V flag for displaying the version
string. It also makes the printed string match the other Decred tools'
output by printing the current runtime, GOOS and GOARCH versions.
  • Loading branch information
matheusd committed Jun 12, 2023
1 parent f005949 commit bba6722
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/dcrlncli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"os/user"
"path/filepath"
"runtime"
"strings"

macaroon "gopkg.in/macaroon.v2"
Expand Down Expand Up @@ -217,9 +218,19 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {
}

func main() {
// Use the standart decred -V (capital V) flag for version.
cli.VersionFlag = cli.BoolFlag{
Name: "version, V",
Usage: "print the version",
}

// Build the standard version string.
versionStr := fmt.Sprintf("%s (Go version %s %s/%s)\n",
build.Version(), runtime.Version(), runtime.GOOS, runtime.GOARCH)

app := cli.NewApp()
app.Name = "dcrlncli"
app.Version = build.Version()
app.Version = versionStr
app.Usage = "control plane for your Decred Lightning Network Daemon (dcrlnd)"
app.Flags = []cli.Flag{
cli.StringFlag{
Expand Down

0 comments on commit bba6722

Please sign in to comment.