File tree Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ builds:
1818 - 6
1919 - 7
2020 main : ./cmd/aws-fuzzy/main.go
21+ ldflags :
22+ - -X github.com/AndreZiviani/aws-fuzzy/internal/version.versionTag={{.Version}}
2123 - id : " windows"
2224 env :
2325 - CGO_ENABLED=0
@@ -26,6 +28,8 @@ builds:
2628 goarch :
2729 - amd64
2830 main : ./cmd/aws-fuzzy/main.go
31+ ldflags :
32+ - -X github.com/AndreZiviani/aws-fuzzy/internal/version.versionTag={{.Version}}
2933 - id : " macos"
3034 env :
3135 - CGO_ENABLED=1
@@ -35,6 +39,8 @@ builds:
3539 - amd64
3640 - arm64
3741 main : ./cmd/aws-fuzzy/main.go
42+ ldflags :
43+ - -X github.com/AndreZiviani/aws-fuzzy/internal/version.versionTag={{.Version}}
3844archives :
3945 - format : binary
4046checksum :
Original file line number Diff line number Diff line change 66 "github.com/AndreZiviani/aws-fuzzy/internal/ssh"
77 "github.com/AndreZiviani/aws-fuzzy/internal/ssm"
88 "github.com/AndreZiviani/aws-fuzzy/internal/sso"
9+ "github.com/AndreZiviani/aws-fuzzy/internal/version"
910 flags "github.com/jessevdk/go-flags"
1011)
1112
@@ -19,5 +20,6 @@ func Run() {
1920 chart .Init (Parser )
2021 sso .Init (Parser )
2122 ssm .Init (Parser )
23+ version .Init (Parser )
2224 Parser .Parse ()
2325}
Original file line number Diff line number Diff line change 1+ package version
2+
3+ import (
4+ flags "github.com/jessevdk/go-flags"
5+ )
6+
7+ type Version struct {
8+ }
9+
10+ var (
11+ versionTag string
12+ version Version
13+ )
14+
15+ func Init (parser * flags.Parser ) {
16+ _ , err := parser .AddCommand (
17+ "version" ,
18+ "Show aws-fuzzy version" ,
19+ "Show aws-fuzzy version" ,
20+ & version )
21+
22+ if err != nil {
23+ return
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ package version
2+
3+ import (
4+ "fmt"
5+ )
6+
7+ func (p * Version ) Execute (args []string ) error {
8+ if len (versionTag ) > 0 {
9+ fmt .Printf ("aws-fuzzy %s\n " , versionTag )
10+ } else {
11+ fmt .Printf ("Unknown version, manually compiled from git?\n " )
12+ }
13+ return nil
14+ }
You can’t perform that action at this time.
0 commit comments