github.com/onsi/ginkgo@v1.16.6-0.20211118180735-4e1925ba4c95/ginkgo/main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/onsi/ginkgo/ginkgo/build"
     8  	"github.com/onsi/ginkgo/ginkgo/command"
     9  	"github.com/onsi/ginkgo/ginkgo/generators"
    10  	"github.com/onsi/ginkgo/ginkgo/labels"
    11  	"github.com/onsi/ginkgo/ginkgo/outline"
    12  	"github.com/onsi/ginkgo/ginkgo/run"
    13  	"github.com/onsi/ginkgo/ginkgo/unfocus"
    14  	"github.com/onsi/ginkgo/ginkgo/watch"
    15  	"github.com/onsi/ginkgo/types"
    16  )
    17  
    18  var program command.Program
    19  
    20  func GenerateCommands() []command.Command {
    21  	return []command.Command{
    22  		watch.BuildWatchCommand(),
    23  		build.BuildBuildCommand(),
    24  		generators.BuildBootstrapCommand(),
    25  		generators.BuildGenerateCommand(),
    26  		labels.BuildLabelsCommand(),
    27  		outline.BuildOutlineCommand(),
    28  		unfocus.BuildUnfocusCommand(),
    29  		BuildVersionCommand(),
    30  	}
    31  }
    32  
    33  func main() {
    34  	program = command.Program{
    35  		Name:           "ginkgo",
    36  		Heading:        fmt.Sprintf("Ginkgo Version %s", types.VERSION),
    37  		Commands:       GenerateCommands(),
    38  		DefaultCommand: run.BuildRunCommand(),
    39  		DeprecatedCommands: []command.DeprecatedCommand{
    40  			{Name: "convert", Deprecation: types.Deprecations.Convert()},
    41  			{Name: "blur", Deprecation: types.Deprecations.Blur()},
    42  			{Name: "nodot", Deprecation: types.Deprecations.Nodot()},
    43  		},
    44  	}
    45  
    46  	program.RunAndExit(os.Args)
    47  }
    48  
    49  func BuildVersionCommand() command.Command {
    50  	return command.Command{
    51  		Name:     "version",
    52  		Usage:    "ginkgo version",
    53  		ShortDoc: "Print Ginkgo's version",
    54  		Command: func(_ []string, _ []string) {
    55  			fmt.Printf("Ginkgo Version %s\n", types.VERSION)
    56  		},
    57  	}
    58  }