Skip to content

Commit 7bdfb18

Browse files
committed
Don't sort flags in usage output
And rearrange them slightly to make the order more logical.
1 parent fea6131 commit 7bdfb18

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

git-sizer.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,41 +63,47 @@ func mainImplementation() error {
6363
pflag.BoolVar(&processBranches, "branches", false, "process all branches")
6464
pflag.BoolVar(&processTags, "tags", false, "process all tags")
6565
pflag.BoolVar(&processRemotes, "remotes", false, "process all remote-tracking branches")
66+
67+
pflag.Var(
68+
sizes.NewThresholdFlagValue(&threshold, 0),
69+
"verbose", "report all statistics, whether concerning or not",
70+
)
71+
pflag.Lookup("verbose").NoOptDefVal = "true"
72+
6673
pflag.Var(
6774
&threshold, "threshold",
6875
"minimum level of concern (i.e., number of stars) that should be\n"+
6976
" reported",
7077
)
78+
7179
pflag.Var(
7280
sizes.NewThresholdFlagValue(&threshold, 30),
7381
"critical", "only report critical statistics",
7482
)
7583
pflag.Lookup("critical").NoOptDefVal = "true"
76-
pflag.Var(
77-
sizes.NewThresholdFlagValue(&threshold, 0),
78-
"verbose", "report all statistics, whether concerning or not",
79-
)
80-
pflag.Lookup("verbose").NoOptDefVal = "true"
84+
8185
pflag.Var(
8286
&nameStyle, "names",
8387
"display names of large objects in the specified `style`:\n"+
8488
" --names=none omit footnotes entirely\n"+
8589
" --names=hash show only the SHA-1s of objects\n"+
8690
" --names=full show full names",
8791
)
92+
8893
pflag.BoolVarP(&jsonOutput, "json", "j", false, "output results in JSON format")
8994

9095
atty, err := isatty.Isatty(os.Stderr.Fd())
9196
if err != nil {
9297
atty = false
9398
}
94-
9599
pflag.BoolVar(&progress, "progress", atty, "report progress to stderr")
96100
pflag.Var(&NegatedBoolValue{&progress}, "no-progress", "suppress progress output")
97101
pflag.Lookup("no-progress").NoOptDefVal = "true"
98102

99103
pflag.StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to file")
100104

105+
pflag.CommandLine.SortFlags = false
106+
101107
pflag.Parse()
102108

103109
if cpuprofile != "" {

0 commit comments

Comments
 (0)