github.com/jdhenke/godel@v0.0.0-20161213181855-abeb3861bf0d/apps/gunit/app.go (about) 1 // Copyright 2016 Palantir Technologies, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package gunit 16 17 import ( 18 "github.com/nmiyake/pkg/errorstringer" 19 "github.com/palantir/amalgomate/amalgomated" 20 "github.com/palantir/pkg/cli" 21 "github.com/palantir/pkg/cli/cfgcli" 22 23 "github.com/palantir/godel/apps/gunit/cmd" 24 "github.com/palantir/godel/apps/gunit/cmd/clean" 25 "github.com/palantir/godel/apps/gunit/cmd/test" 26 ) 27 28 func RunApp(args []string, supplier amalgomated.CmderSupplier) int { 29 return amalgomated.RunApp(args, nil, cmd.Library, App(supplier).Run) 30 } 31 32 func App(supplier amalgomated.CmderSupplier) *cli.App { 33 app := cli.NewApp(cfgcli.Handler(), cli.DebugHandler(errorstringer.StackWithInterleavedMessages)) 34 app.Name = "gunit" 35 app.Usage = "Run test and coverage commands for Go code" 36 app.Subcommands = []cli.Command{ 37 test.GoTestCommand(supplier), 38 test.GoCoverCommand(supplier), 39 test.GTCommand(supplier), 40 clean.Command(), 41 } 42 app.Action = test.RunGoTestAction(supplier) 43 app.Flags = append(app.Flags, cmd.GlobalFlags...) 44 return app 45 }