本文整理匯總了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()
}