本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/commandregistry.Command類的典型用法代碼示例。如果您正苦於以下問題:Golang Command類的具體用法?Golang Command怎麽用?Golang Command使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Command類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
deps.RepoLocator = deps.RepoLocator.SetBuildpackRepository(buildpackRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("buildpacks").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
buildpackRepo = new(apifakes.OldFakeBuildpackRepository)
requirementsFactory = &testreq.FakeReqFactory{}
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("buildpacks", args, requirementsFactory, updateCommandDependency, false)
}
Context("when arguments are provided", func() {
var cmd commandregistry.Command
var flagContext flags.FlagContext
BeforeEach(func() {
cmd = &buildpack.ListBuildpacks{}
cmd.SetDependency(deps, false)
flagContext = flags.NewFlagContext(cmd.MetaData().Flags)
})
It("should fail with usage", func() {
flagContext.Parse("blahblah")
reqs := cmd.Requirements(requirementsFactory, flagContext)
err := testcmd.RunRequirements(reqs)
Expect(err).To(HaveOccurred())
示例2:
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("UnsetSpaceRole", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
userRepo *apifakes.FakeUserRepository
spaceRepo *apifakes.FakeSpaceRepository
flagRepo *featureflagsfakes.FakeFeatureFlagRepository
cmd commandregistry.Command
deps commandregistry.Dependency
factory *requirementsfakes.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
userRequirement *requirementsfakes.FakeUserRequirement
organizationRequirement *requirementsfakes.FakeOrganizationRequirement
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
userRepo = new(apifakes.FakeUserRepository)
repoLocator := deps.RepoLocator.SetUserRepository(userRepo)
spaceRepo = new(apifakes.FakeSpaceRepository)
repoLocator = repoLocator.SetSpaceRepository(spaceRepo)
示例3:
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CreateUserProvidedService", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
serviceInstanceRepo *apifakes.FakeUserProvidedServiceInstanceRepository
cmd commandregistry.Command
deps commandregistry.Dependency
factory *requirementsfakes.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
targetedSpaceRequirement requirements.Requirement
minAPIVersionRequirement requirements.Requirement
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
configRepo = testconfig.NewRepositoryWithDefaults()
serviceInstanceRepo = new(apifakes.FakeUserProvidedServiceInstanceRepository)
repoLocator := deps.RepoLocator.SetUserProvidedServiceInstanceRepository(serviceInstanceRepo)
deps = commandregistry.Dependency{
UI: ui,
示例4:
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("SetSpaceRole", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
userRepo *apifakes.FakeUserRepository
spaceRepo *spacesfakes.FakeSpaceRepository
flagRepo *featureflagsfakes.FakeFeatureFlagRepository
cmd commandregistry.Command
deps commandregistry.Dependency
factory *requirementsfakes.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
userRequirement *requirementsfakes.FakeUserRequirement
organizationRequirement *requirementsfakes.FakeOrganizationRequirement
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
userRepo = new(apifakes.FakeUserRepository)
repoLocator := deps.RepoLocator.SetUserRepository(userRepo)
spaceRepo = new(spacesfakes.FakeSpaceRepository)
repoLocator = repoLocator.SetSpaceRepository(spaceRepo)
示例5:
[]string{"FAILED"},
))
Expect(ui.WarnOutputs).To(ContainSubstrings([]string{"already exists"}))
})
})
})
Describe("Requirements", func() {
var (
requirementsFactory *requirementsfakes.FakeFactory
ui *testterm.FakeUI
cmd commandregistry.Command
deps commandregistry.Dependency
quotaRepo *quotasfakes.FakeQuotaRepository
flagContext flags.FlagContext
loginRequirement requirements.Requirement
minAPIVersionRequirement requirements.Requirement
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
quotaRepo = new(quotasfakes.FakeQuotaRepository)
repoLocator := deps.RepoLocator.SetQuotaRepository(quotaRepo)
deps = commandregistry.Dependency{
示例6:
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CreateAppManifest", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
appSummaryRepo *apifakes.FakeAppSummaryRepository
stackRepo *stacksfakes.FakeStackRepository
cmd commandregistry.Command
deps commandregistry.Dependency
factory *requirementsfakes.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
targetedSpaceRequirement requirements.Requirement
applicationRequirement *requirementsfakes.FakeApplicationRequirement
fakeManifest *manifestfakes.FakeApp
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
appSummaryRepo = new(apifakes.FakeAppSummaryRepository)
repoLocator := deps.RepoLocator.SetAppSummaryRepository(appSummaryRepo)
stackRepo = new(stacksfakes.FakeStackRepository)
示例7:
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CreateServiceBroker", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
serviceBrokerRepo *apifakes.FakeServiceBrokerRepository
cmd commandregistry.Command
deps commandregistry.Dependency
factory *requirementsfakes.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
targetedSpaceRequirement requirements.Requirement
minAPIVersionRequirement requirements.Requirement
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
serviceBrokerRepo = new(apifakes.FakeServiceBrokerRepository)
repoLocator := deps.RepoLocator.SetServiceBrokerRepository(serviceBrokerRepo)
deps = commandregistry.Dependency{
UI: ui,
示例8:
import (
"github.com/cloudfoundry/cli/cf/commandregistry"
"github.com/cloudfoundry/cli/cf/commands"
"github.com/cloudfoundry/cli/cf/flags"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
"github.com/cloudfoundry/cli/cf"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Version", func() {
var (
ui *testterm.FakeUI
cmd commandregistry.Command
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
deps := commandregistry.Dependency{
UI: ui,
}
cmd = &commands.Version{}
cmd.SetDependency(deps, false)
})
Describe("Execute", func() {
var flagContext flags.FlagContext