Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "edward", Short: "A tool for managing local instances of microservices", Long: `Edward is a tool to simplify your microservices development workflow. Build, start and manage service instances with a single command.`, SilenceUsage: true, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { logger.Printf("=== Edward v%v ===\n", common.EdwardVersion) logger.Printf("Args: %v\n", os.Args) edwardClient = edward.NewClient() if configPath != "" { edwardClient.Config = configPath } else { edwardClient.Config = getConfigPath() } edwardClient.ServiceChecks = func(sgs []services.ServiceOrGroup) error { return errors.WithStack(sudoIfNeeded(sgs)) } edwardClient.Logger = logger edwardClient.EdwardExecutable = os.Args[0] command := cmd.Use if command != "generate" { err := config.LoadSharedConfig(edwardClient.Config, common.EdwardVersion, logger) if err != nil { return errors.WithStack(err) } err = os.Chdir(config.GetBasePath()) if err != nil { return errors.WithStack(err) } } else { config.InitEmptyConfig() } if command != "stop" { for _, service := range config.GetServiceMap() { if _, err := os.Stat(service.GetPidPathLegacy()); !os.IsNotExist(err) { return errors.New("one or more services were started with an older version of Edward. Please run `edward stop` to stop these instances") } } } if command != "run" { checkUpdateChan = make(chan interface{}) go checkUpdateAvailable(checkUpdateChan) } return nil }, PersistentPostRun: func(cmd *cobra.Command, args []string) { defer logger.Printf("=== Exiting ===\n") if checkUpdateChan != nil { updateAvailable, ok := (<-checkUpdateChan).(bool) if ok && updateAvailable { latestVersion := (<-checkUpdateChan).(string) fmt.Printf("A new version of Edward is available (%v), update with:\n\tgo get -u github.com/yext/edward\n", latestVersion) } } }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.