Skip to content

Commit 625920d

Browse files
marklapbiomarklap
authored andcommitted
working version flag
1 parent f5265bf commit 625920d

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

.goreleaser.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ builds:
1212
- amd64
1313
- arm
1414
- arm64
15-
- "386"
15+
- '386'
1616
goos:
1717
- darwin
1818
- linux
@@ -22,17 +22,18 @@ builds:
2222
- openbsd
2323
ignore:
2424
- goos: darwin
25-
goarch: "386"
25+
goarch: '386'
2626
- goos: openbsd
2727
goarch: arm
2828
flags:
2929
- -trimpath
3030
ldflags:
3131
- -s
3232
- -w
33+
- -X github.com/justjanne/powerline-go/powerline.Version={{ .Version }}
3334

3435
archives:
35-
- name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
36+
- name_template: '{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}'
3637
format: binary
3738

3839
checksum:

args.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type arguments struct {
4747
IgnoreWarnings *bool
4848
Time *string
4949
ViMode *string
50+
Version *bool
5051
}
5152

5253
var args = arguments{
@@ -231,4 +232,8 @@ var args = arguments{
231232
"vi-mode",
232233
defaults.ViMode,
233234
comments("The current vi-mode (eg. KEYMAP for zsh) for vi-module module")),
235+
Version: flag.Bool(
236+
"version",
237+
false,
238+
comments("Print the current version and exit")),
234239
}

main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ func commentsWithDefaults(lines ...string) string {
125125
func main() {
126126
flag.Parse()
127127

128+
if *args.Version {
129+
fmt.Println(pwl.Version)
130+
return
131+
}
132+
128133
cfg := defaults
129134
err := cfg.Load()
130135
if err != nil {

pg

2.63 MB
Binary file not shown.

powerline/version.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package powerline
2+
3+
var Version = "development"

0 commit comments

Comments
 (0)