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) if configPath == "" { var err error configPath, err = config.GetConfigPathFromWorkingDirectory() if err != nil { return errors.WithStack(err) } } command := cmd.Use var err error if command != "generate" { edwardClient, err = edward.NewClientWithConfig(configPath, common.EdwardVersion) if err != nil { return errors.WithStack(err) } err = os.Chdir(edwardClient.BasePath()) if err != nil { return errors.WithStack(err) } } else { edwardClient, err = edward.NewClient() if err != nil { return errors.WithStack(err) } } edwardClient.ServiceChecks = func(sgs []services.ServiceOrGroup) error { return errors.WithStack(sudoIfNeeded(sgs)) } edwardClient.Logger = logger edwardClient.EdwardExecutable = os.Args[0] if command != "stop" { for _, service := range edwardClient.ServiceMap() { 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.