当前位置: 首页>>代码示例>>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;未经允许,请勿转载。