@@ -16,6 +16,9 @@ import (
16
16
"github.com/spf13/pflag"
17
17
)
18
18
19
+ var ReleaseVersion string
20
+ var BuildVersion string
21
+
19
22
type NegatedBoolValue struct {
20
23
value * bool
21
24
}
@@ -59,6 +62,7 @@ func mainImplementation() error {
59
62
var jsonOutput bool
60
63
var threshold sizes.Threshold = 1
61
64
var progress bool
65
+ var version bool
62
66
63
67
pflag .BoolVar (& processBranches , "branches" , false , "process all branches" )
64
68
pflag .BoolVar (& processTags , "tags" , false , "process all tags" )
@@ -97,6 +101,7 @@ func mainImplementation() error {
97
101
atty = false
98
102
}
99
103
pflag .BoolVar (& progress , "progress" , atty , "report progress to stderr" )
104
+ pflag .BoolVar (& version , "version" , false , "report the git-sizer version number" )
100
105
pflag .Var (& NegatedBoolValue {& progress }, "no-progress" , "suppress progress output" )
101
106
pflag .Lookup ("no-progress" ).NoOptDefVal = "true"
102
107
@@ -116,6 +121,15 @@ func mainImplementation() error {
116
121
defer pprof .StopCPUProfile ()
117
122
}
118
123
124
+ if version {
125
+ if ReleaseVersion != "" {
126
+ fmt .Printf ("git-sizer release %s\n " , ReleaseVersion )
127
+ } else {
128
+ fmt .Printf ("git-sizer build %s\n " , BuildVersion )
129
+ }
130
+ return nil
131
+ }
132
+
119
133
args := pflag .Args ()
120
134
121
135
if len (args ) != 0 {
0 commit comments