本文整理汇总了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
}
示例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
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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
}
示例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
}
示例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() {
示例10: Init
func Init(path string) {
os.Setenv("CF_HOME", path)
command_registry.InitI18nFunc()
deps = command_registry.NewDependency()
}