support --version using -X

This commit is contained in:
fiatjaf 2024-09-15 08:57:53 -03:00
parent 9bbc87b27a
commit 9d02301b2d
2 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }} goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }} goarch: ${{ matrix.goarch }}
ldflags: -X main.version=${{ github.ref }}
overwrite: true overwrite: true
md5sum: false md5sum: false
sha256sum: false sha256sum: false

View File

@ -7,6 +7,8 @@ import (
"github.com/fiatjaf/cli/v3" "github.com/fiatjaf/cli/v3"
) )
var version string = "debug"
var app = &cli.Command{ var app = &cli.Command{
Name: "nak", Name: "nak",
Suggest: true, Suggest: true,
@ -27,6 +29,7 @@ var app = &cli.Command{
bunker, bunker,
serve, serve,
}, },
Version: version,
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "quiet", Name: "quiet",