當前位置: 首頁>>代碼示例>>Golang>>正文


Golang command_registry.NewDependency函數代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/command_registry.NewDependency函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewDependency函數的具體用法?Golang NewDependency怎麽用?Golang NewDependency使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewDependency函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: CallCoreCommand

func (cmd *CliRpcCmd) CallCoreCommand(args []string, retVal *bool) error {
	defer func() {
		recover()
	}()

	var err error
	cmdRegistry := command_registry.Commands

	cmd.outputBucket = &[]string{}
	cmd.outputCapture.SetOutputBucket(cmd.outputBucket)

	if cmdRegistry.CommandExists(args[0]) {
		deps := command_registry.NewDependency()

		//set deps objs to be the one used by all other codegangsta commands
		//once all commands are converted, we can make fresh deps for each command run
		deps.Config = cmd.cliConfig
		deps.RepoLocator = cmd.repoLocator
		deps.Ui = terminal.NewUI(os.Stdin, cmd.outputCapture.(*terminal.TeePrinter))

		err = cmd.newCmdRunner.Command(args, deps, false)
	} else {
		//call codegangsta command
		err = cmd.coreCommandRunner.Run(append([]string{"CF_NAME"}, args...))
	}

	if err != nil {
		*retVal = false
		return err
	}

	*retVal = true
	return nil
}
開發者ID:tools-alexuser01,項目名稱:cli,代碼行數:34,代碼來源:cli_rpc_server.go

示例2: CallCoreCommand

func (cmd *CliRpcCmd) CallCoreCommand(args []string, retVal *bool) error {
	defer func() {
		recover()
	}()

	var err error
	cmdRegistry := command_registry.Commands

	if cmdRegistry.CommandExists(args[0]) {
		deps := command_registry.NewDependency()

		//set deps objs to be the one used by all other codegangsta commands
		//once all commands are converted, we can make fresh deps for each command run
		deps.Config = cmd.cliConfig
		deps.RepoLocator = cmd.repoLocator

		err = cmd.newCmdRunner.Command(args, deps)
	} else {
		//call codegangsta command
		err = cmd.coreCommandRunner.Run(append([]string{"CF_NAME"}, args...))
	}

	if err != nil {
		*retVal = false
		return err
	}

	*retVal = true
	return nil
}
開發者ID:ECSTeam,項目名稱:usagereport-plugin,代碼行數:30,代碼來源:cli_rpc_server.go

示例3: GetApp

func (cmd *CliRpcCmd) GetApp(appName string, retVal *plugin_models.Application) error {
	defer func() {
		recover()
	}()

	deps := command_registry.NewDependency()

	//set deps objs to be the one used by all other codegangsta commands
	//once all commands are converted, we can make fresh deps for each command run
	deps.Config = cmd.cliConfig
	deps.RepoLocator = cmd.repoLocator
	deps.PluginModels.Application = retVal
	deps.Ui.DisableTerminalOutput(true)

	return cmd.newCmdRunner.Command([]string{"app", appName}, deps)
}
開發者ID:ECSTeam,項目名稱:usagereport-plugin,代碼行數:16,代碼來源:cli_rpc_server.go

示例4: GetService

func (cmd *CliRpcCmd) GetService(serviceInstance string, retVal *plugin_models.GetService_Model) error {
	defer func() {
		recover()
	}()

	deps := command_registry.NewDependency(cmd.logger)

	//set deps objs to be the one used by all other commands
	//once all commands are converted, we can make fresh deps for each command run
	deps.Config = cmd.cliConfig
	deps.RepoLocator = cmd.repoLocator
	deps.PluginModels.Service = retVal
	cmd.terminalOutputSwitch.DisableTerminalOutput(true)
	deps.Ui = terminal.NewUI(os.Stdin, cmd.terminalOutputSwitch.(*terminal.TeePrinter), cmd.logger)

	return cmd.newCmdRunner.Command([]string{"service", serviceInstance}, deps, true)
}
開發者ID:cloudfoundry-incubator,項目名稱:Diego-Enabler,代碼行數:17,代碼來源:cli_rpc_server.go

示例5: GetOrg

func (cmd *CliRpcCmd) GetOrg(orgName string, retVal *plugin_models.Organization) error {
	defer func() {
		recover()
	}()

	deps := command_registry.NewDependency()

	//set deps objs to be the one used by all other codegangsta commands
	//once all commands are converted, we can make fresh deps for each command run
	deps.Config = cmd.cliConfig
	deps.RepoLocator = cmd.repoLocator
	deps.PluginModels.Organization = retVal
	cmd.terminalOutputSwitch.DisableTerminalOutput(true)
	deps.Ui = terminal.NewUI(os.Stdin, cmd.terminalOutputSwitch.(*terminal.TeePrinter))

	return cmd.newCmdRunner.Command([]string{"org", orgName}, deps, true)
}
開發者ID:tools-alexuser01,項目名稱:cli,代碼行數:17,代碼來源:cli_rpc_server.go

示例6: GetSpaceUsers

func (cmd *CliRpcCmd) GetSpaceUsers(args []string, retVal *[]plugin_models.GetSpaceUsers_Model) error {
	defer func() {
		recover()
	}()

	deps := command_registry.NewDependency()

	//set deps objs to be the one used by all other codegangsta commands
	//once all commands are converted, we can make fresh deps for each command run
	deps.Config = cmd.cliConfig
	deps.RepoLocator = cmd.repoLocator
	deps.PluginModels.SpaceUsers = retVal
	cmd.terminalOutputSwitch.DisableTerminalOutput(true)
	deps.Ui = terminal.NewUI(os.Stdin, cmd.terminalOutputSwitch.(*terminal.TeePrinter))

	return cmd.newCmdRunner.Command(append([]string{"space-users"}, args...), deps, true)
}
開發者ID:vframbach,項目名稱:cli,代碼行數:17,代碼來源:cli_rpc_server.go

示例7: CallCoreCommand

func (cmd *CliRpcCmd) CallCoreCommand(args []string, retVal *bool) error {
	defer func() {
		recover()
	}()

	var err error
	cmdRegistry := command_registry.Commands

	cmd.outputBucket = &[]string{}
	cmd.outputCapture.SetOutputBucket(cmd.outputBucket)

	if cmdRegistry.CommandExists(args[0]) {
		deps := command_registry.NewDependency(cmd.logger)

		//set deps objs to be the one used by all other commands
		//once all commands are converted, we can make fresh deps for each command run
		deps.Config = cmd.cliConfig
		deps.RepoLocator = cmd.repoLocator

		//set command ui's TeePrinter to be the one used by RpcService, for output to be captured
		deps.Ui = terminal.NewUI(os.Stdin, cmd.outputCapture.(*terminal.TeePrinter), cmd.logger)

		err = cmd.newCmdRunner.Command(args, deps, false)
	} else {
		*retVal = false
		return nil
	}

	if err != nil {
		*retVal = false
		return err
	}

	*retVal = true
	return nil
}
開發者ID:cloudfoundry-incubator,項目名稱:Diego-Enabler,代碼行數:36,代碼來源:cli_rpc_server.go

示例8: CallCoreCommand

func (cmd *CliRpcCmd) CallCoreCommand(args []string, retVal *bool) error {
	defer func() {
		recover()
	}()

	var err error
	cmdRegistry := command_registry.Commands

	if cmdRegistry.CommandExists(args[0]) {
		//non-codegangsta path
		deps := command_registry.NewDependency()

		//set deps objs to be the one used by all other codegangsta commands
		//once all commands are converted, we can make fresh deps for each command run
		deps.Config = cmd.cliConfig
		deps.RepoLocator = cmd.repoLocator

		fc := flags.NewFlagContext(cmdRegistry.FindCommand(args[0]).MetaData().Flags)
		err = fc.Parse(args[1:]...)
		if err == nil {
			cmdRegistry.SetCommand(cmdRegistry.FindCommand(args[0]).SetDependency(deps))
			cmdRegistry.FindCommand(args[0]).Execute(fc)
		}
	} else {
		//call codegangsta command
		err = cmd.coreCommandRunner.Run(append([]string{"CF_NAME"}, args...))
	}

	if err != nil {
		*retVal = false
		return err
	}

	*retVal = true
	return nil
}
開發者ID:jmcarp,項目名稱:autopilot,代碼行數:36,代碼來源:cli_rpc_server.go

示例9:

	}

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		appSummaryRepo = &testapi.FakeAppSummaryRepo{}
		appLogsNoaaRepo = &testapi.FakeLogsNoaaRepository{}
		appInstancesRepo = &testAppInstanaces.FakeAppInstancesRepository{}
		configRepo = testconfig.NewRepositoryWithDefaults()
		requirementsFactory = &testreq.FakeReqFactory{
			LoginSuccess:         true,
			TargetedSpaceSuccess: true,
		}
		app = makeAppWithRoute("my-app")
		appSummaryRepo.GetSummarySummary = app

		deps = command_registry.NewDependency()
		updateCommandDependency(false)
	})

	runCommand := func(args ...string) bool {
		cmd := command_registry.Commands.FindCommand("app")
		return testcmd.RunCliCommand(cmd, args, requirementsFactory)
	}

	Describe("requirements", func() {
		It("fails if not logged in", func() {
			requirementsFactory.LoginSuccess = false
			Expect(runCommand("my-app")).To(BeFalse())
		})

		It("fails if a space is not targeted", func() {
開發者ID:MontesClarosServidores,項目名稱:cli,代碼行數:31,代碼來源:app_test.go

示例10: Init

func Init(path string) {
	os.Setenv("CF_HOME", path)
	command_registry.InitI18nFunc()
	deps = command_registry.NewDependency()
}
開發者ID:dprotaso,項目名稱:cf-cli-ios,代碼行數:5,代碼來源:bridge.go


注:本文中的github.com/cloudfoundry/cli/cf/command_registry.NewDependency函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。