cmd

package
v0.0.0-...-7de0bc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2021 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:          "mbt",
	Short:        docText("main-summary"),
	Long:         docText("main"),
	SilenceUsage: true,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		if cmd.Use == "version" {
			return nil
		}

		if in == "" {
			cwd, err := os.Getwd()
			if err != nil {
				return err
			}
			in, err = lib.GitRepoRoot(cwd)
			if err != nil {
				return err
			}
		}

		parent := cmd.Parent()
		if parent != nil && parent.Name() == "run-in" && command == "" {
			return e.NewError(lib.ErrClassUser, "--command (-m) is not specified")
		}
		if parent != nil && parent.Name() == "describe" && dependents && name == "" {
			return e.NewError(lib.ErrClassUser, "--dependents flag can only be specified with the --name (-n) flag")
		}

		level := lib.LogLevelNormal
		if debug {
			logrus.SetLevel(logrus.DebugLevel)
			level = lib.LogLevelDebug
		}

		var err error
		system, err = lib.NewSystem(in, level)
		return err
	},
}

RootCmd is the main command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL