func setupDependencies() (deps *cliDependencies) { if os.Getenv("CF_COLOR") == "" { os.Setenv("CF_COLOR", "true") } deps = new(cliDependencies) deps.termUI = terminal.NewUI(os.Stdin) deps.manifestRepo = manifest.NewManifestDiskRepository() deps.configRepo = configuration.NewRepositoryFromFilepath(configuration.DefaultFilePath(), func(err error) { if err != nil { deps.termUI.Failed(fmt.Sprintf("Config error: %s", err)) } }) deps.apiRepoLocator = api.NewRepositoryLocator(deps.configRepo, map[string]net.Gateway{ "auth": net.NewUAAGateway(deps.configRepo), "cloud-controller": net.NewCloudControllerGateway(deps.configRepo), "uaa": net.NewUAAGateway(deps.configRepo), }) return }
func main() { fileutils.SetTmpPathPrefix("cf") if os.Getenv("CF_COLOR") == "" { os.Setenv("CF_COLOR", "true") } termUI := terminal.NewUI() assignTemplates() configRepo := configuration.NewConfigurationDiskRepository() config := loadConfig(termUI, configRepo) repoLocator := api.NewRepositoryLocator(config, configRepo, map[string]net.Gateway{ "auth": net.NewUAAGateway(), "cloud-controller": net.NewCloudControllerGateway(), "uaa": net.NewUAAGateway(), }) cmdFactory := commands.NewFactory(termUI, config, configRepo, repoLocator) reqFactory := requirements.NewFactory(termUI, config, repoLocator) cmdRunner := commands.NewRunner(cmdFactory, reqFactory) app, err := app.NewApp(cmdRunner) if err != nil { return } app.Run(os.Args) }
func main() { defer func() { maybeSomething := recover() if maybeSomething != nil { displayCrashDialog() } }() fileutils.SetTmpPathPrefix("cf") if os.Getenv("CF_COLOR") == "" { os.Setenv("CF_COLOR", "true") } termUI := terminal.NewUI() configRepo := configuration.NewConfigurationDiskRepository() config := loadConfig(termUI, configRepo) manifestRepo := manifest.NewManifestDiskRepository() repoLocator := api.NewRepositoryLocator(config, configRepo, map[string]net.Gateway{ "auth": net.NewUAAGateway(), "cloud-controller": net.NewCloudControllerGateway(), "uaa": net.NewUAAGateway(), }) cmdFactory := commands.NewFactory(termUI, config, configRepo, manifestRepo, repoLocator) reqFactory := requirements.NewFactory(termUI, config, repoLocator) cmdRunner := commands.NewRunner(cmdFactory, reqFactory) app, err := app.NewApp(cmdRunner) if err != nil { return } app.Run(os.Args) }