@@ -16,6 +16,26 @@ import (
16
16
"github.com/spf13/pflag"
17
17
)
18
18
19
+ const Usage = `usage: git-sizer [OPTS]
20
+ --branches process all branches
21
+ --tags process all tags
22
+ --remotes process all remotes
23
+ -v, --verbose report all statistics, whether concerning or not
24
+ --threshold threshold minimum level of concern (i.e., number of stars)
25
+ that should be reported. Default:
26
+ '--threshold=1'.
27
+ --critical only report critical statistics
28
+ --names=[none|hash|full] display names of large objects in the specified
29
+ style: 'none' (omit footnotes entirely), 'hash'
30
+ (show only the SHA-1s of objects), or 'full'
31
+ (show full names). Default is '--names=full'.
32
+ -j, --json output results in JSON format
33
+ --json-version=[1|2] choose which JSON format version to output.
34
+ Default: --json-version=1.
35
+ --[no-]progress report (don't report) progress to stderr.
36
+ --version only report the git-sizer version number
37
+ `
38
+
19
39
var ReleaseVersion string
20
40
var BuildVersion string
21
41
@@ -65,7 +85,10 @@ func mainImplementation() error {
65
85
var progress bool
66
86
var version bool
67
87
68
- flags := pflag .NewFlagSet ("" , pflag .ContinueOnError )
88
+ flags := pflag .NewFlagSet ("git-sizer" , pflag .ContinueOnError )
89
+ flags .Usage = func () {
90
+ fmt .Print (Usage )
91
+ }
69
92
70
93
flags .BoolVar (& processBranches , "branches" , false , "process all branches" )
71
94
flags .BoolVar (& processTags , "tags" , false , "process all tags" )
@@ -116,6 +139,9 @@ func mainImplementation() error {
116
139
117
140
err = flags .Parse (os .Args [1 :])
118
141
if err != nil {
142
+ if err == pflag .ErrHelp {
143
+ return nil
144
+ }
119
145
return err
120
146
}
121
147
0 commit comments