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) }
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 findCommand(cmdName string) (cmd cli.Command) { cmdFactory := commands.ConcreteFactory{} reqFactory := &testreq.FakeReqFactory{} cmdRunner := commands.NewRunner(cmdFactory, reqFactory) myApp, _ := app.NewApp(cmdRunner) for _, cmd := range myApp.Commands { if cmd.Name == cmdName { return cmd } } return }
func findCommand(cmdName string) (cmd cli.Command) { cmdFactory := commands.ConcreteFactory{} reqFactory := &testreq.FakeReqFactory{} cmdRunner := commands.NewRunner(cmdFactory, reqFactory) myApp, _ := app.NewApp(cmdRunner) for _, cmd := range myApp.Commands { if cmd.Name == cmdName { return cmd } } panic(fmt.Sprintf("command %s does not exist", cmdName)) return }
func main() { defer handlePanics() deps := setupDependencies() defer deps.configRepo.Close() cmdFactory := command_factory.NewFactory(deps.termUI, deps.configRepo, deps.manifestRepo, deps.apiRepoLocator) requirementsFactory := requirements.NewFactory(deps.termUI, deps.configRepo, deps.apiRepoLocator) cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory) app.NewApp(cmdRunner, cmdFactory.CommandMetadatas()...).Run(os.Args) gateways := gatewaySliceFromMap(deps.gateways) net.NewWarningsCollector(deps.termUI, gateways...).PrintWarnings() }
func main() { defer handlePanics() deps := setupDependencies() defer deps.configRepo.Close() cmdFactory := commands.NewFactory(deps.termUI, deps.configRepo, deps.manifestRepo, deps.apiRepoLocator) reqFactory := requirements.NewFactory(deps.termUI, deps.configRepo, deps.apiRepoLocator) cmdRunner := commands.NewRunner(cmdFactory, reqFactory) app, err := app.NewApp(cmdRunner) if err != nil { return } app.Run(os.Args) }
func findCommand(cmdName string) (cmd cli.Command) { fakeUI := &testterm.FakeUI{} configRepo := testconfig.NewRepository() manifestRepo := manifest.NewManifestDiskRepository() apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{ "auth": net.NewUAAGateway(configRepo), "cloud-controller": net.NewCloudControllerGateway(configRepo), "uaa": net.NewUAAGateway(configRepo), }) cmdFactory := command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator) requirementsFactory := &testreq.FakeReqFactory{} cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory) myApp := app.NewApp(cmdRunner, cmdFactory.CommandMetadatas()...) for _, cmd := range myApp.Commands { if cmd.Name == cmdName { return cmd } } panic(fmt.Sprintf("command %s does not exist", cmdName)) return }