Skip to content

Commit 99c5f75

Browse files
committed
mainImplementation(): take the command-line arguments as args
1 parent 9ee5241 commit 99c5f75

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

git-sizer.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ func (v *filterValue) Type() string {
150150
}
151151

152152
func main() {
153-
err := mainImplementation()
153+
err := mainImplementation(os.Args[1:])
154154
if err != nil {
155155
fmt.Fprintf(os.Stderr, "error: %s\n", err)
156156
os.Exit(1)
157157
}
158158
}
159159

160-
func mainImplementation() error {
160+
func mainImplementation(args []string) error {
161161
var nameStyle sizes.NameStyle = sizes.NameStyleFull
162162
var cpuprofile string
163163
var jsonOutput bool
@@ -250,7 +250,7 @@ func mainImplementation() error {
250250

251251
flags.SortFlags = false
252252

253-
err = flags.Parse(os.Args[1:])
253+
err = flags.Parse(args)
254254
if err != nil {
255255
if err == pflag.ErrHelp {
256256
return nil
@@ -280,9 +280,7 @@ func mainImplementation() error {
280280
return nil
281281
}
282282

283-
args := flags.Args()
284-
285-
if len(args) != 0 {
283+
if len(flags.Args()) != 0 {
286284
return errors.New("excess arguments")
287285
}
288286

0 commit comments

Comments
 (0)