本文整理汇总了Golang中github.com/cloudfoundry-community/bosh-softlayer-tools/cmds.Command.Options方法的典型用法代码示例。如果您正苦于以下问题:Golang Command.Options方法的具体用法?Golang Command.Options怎么用?Golang Command.Options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-community/bosh-softlayer-tools/cmds.Command
的用法示例。
在下文中一共展示了Command.Options方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Describe("#Description", func() {
It("returns the description of a BmsCommand", func() {
Expect(cmd.Description()).To(Equal("List all bare metals"))
})
})
Describe("#Usage", func() {
It("returns the usage text of a BmsCommand", func() {
Expect(cmd.Usage()).To(Equal("bmp bms --deployment[-d] <deployment file>"))
})
})
Describe("#Options", func() {
It("returns the options of a BmsCommand", func() {
Expect(cmds.EqualOptions(cmd.Options(), options)).To(BeTrue())
Expect(cmd.Options().Deployment).ToNot(Equal(""))
Expect(cmd.Options().Deployment).To(Equal("../../test_fixtures/bmp/deployment.yml"))
})
})
Describe("#Validate", func() {
It("validates a good BmsCommand", func() {
validate, err := cmd.Validate()
Expect(validate).To(BeTrue())
Expect(err).ToNot(HaveOccurred())
})
Context("bad BmsCommand", func() {
BeforeEach(func() {
示例2:
Describe("#Description", func() {
It("returns the description of a StemcellsCommand", func() {
Expect(cmd.Description()).To(Equal("List all stemcells"))
})
})
Describe("#Usage", func() {
It("returns the usage text of a StemcellsCommand", func() {
Expect(cmd.Usage()).To(Equal("bmp stemcells"))
})
})
Describe("#Options", func() {
It("returns the options of a StemcellsCommand", func() {
Expect(cmds.EqualOptions(cmd.Options(), options)).To(BeTrue())
})
})
Describe("#Validate", func() {
It("validates a good StemcellsCommand", func() {
validate, err := cmd.Validate()
Expect(validate).To(BeTrue())
Expect(err).ToNot(HaveOccurred())
})
})
Describe("#Execute", func() {
Context("executes a good StemcellsCommand", func() {
BeforeEach(func() {
fakeBmpClient.StemcellsResponse.Status = 200
示例3:
Describe("#Description", func() {
It("returns the description of a ProvisioningBaremetalCommand", func() {
Expect(cmd.Description()).To(Equal(`provisioning a baremetal with specific stemcell, netboot image`))
})
})
Describe("#Usage", func() {
It("returns the usage text of a ProvisioningBaremetalCommand", func() {
Expect(cmd.Usage()).To(Equal("bmp provisioning-baremetal --vmprefix <vm-prefix> --stemcell <bm-stemcell> --netbootimage <bm-netboot-image>"))
})
})
Describe("#Options", func() {
It("returns the options of a ProvisioningBaremetalCommand", func() {
Expect(cmds.EqualOptions(cmd.Options(), options)).To(BeTrue())
Expect(cmd.Options().VMPrefix).To(Equal("fake-vmprefix"))
Expect(cmd.Options().Stemecell).To(Equal("fake-stemcell"))
Expect(cmd.Options().NetbootImage).To(Equal("fake-netboot-image"))
})
})
Describe("#Validate", func() {
It("validates a good ProvisioningBaremetalCommand", func() {
validate, err := cmd.Validate()
Expect(validate).To(BeTrue())
Expect(err).ToNot(HaveOccurred())
})
Context("when validating a bad ProvisioningBaremetalCommand", func() {
Context("when no options passed", func() {
开发者ID:cloudfoundry-community,项目名称:bosh-softlayer-tools,代码行数:30,代码来源:provisioning_baremetal_command_test.go
示例4:
Describe("#Description", func() {
It("returns the description of a TaskCommand", func() {
Expect(cmd.Description()).To(Equal(`Show the output of the task: \"option --debug, Get the debug info of the task; --json, show info with JSON format\"`))
})
})
Describe("#Usage", func() {
It("returns the usage text of a TaskCommand", func() {
Expect(cmd.Usage()).To(Equal("bmp task <task-id>"))
})
})
Describe("#Options", func() {
It("returns the options of a TaskCommand", func() {
Expect(cmds.EqualOptions(cmd.Options(), options)).To(BeTrue())
Expect(cmd.Options().TaskID).To(Equal(1))
Expect(cmd.Options().JSON).To(BeFalse())
Expect(cmd.Options().Debug).To(BeFalse())
})
})
Describe("#Validate", func() {
It("validates a good TaskCommand", func() {
validate, err := cmd.Validate()
Expect(validate).To(BeTrue())
Expect(err).ToNot(HaveOccurred())
})
Context("validates a bad TaskCommand", func() {
BeforeEach(func() {
示例5:
Describe("#Description", func() {
It("returns the description of a UpdateStateCommand", func() {
Expect(cmd.Description()).To(Equal(`Update the server state (\"bm.state.new\", \"bm.state.using\", \"bm.state.loading\", \"bm.state.failed\", \"bm.state.deleted\")`))
})
})
Describe("#Usage", func() {
It("returns the usage text of a UpdateStateCommand", func() {
Expect(cmd.Usage()).To(Equal("bmp update-state --server <server-id> --state <state>"))
})
})
Describe("#Options", func() {
It("returns the options of a UpdateStateCommand", func() {
Expect(cmds.EqualOptions(cmd.Options(), options)).To(BeTrue())
Expect(cmd.Options().Server).ToNot(Equal(""))
Expect(cmd.Options().Server).To(Equal("fake-server-id"))
Expect(cmd.Options().State).ToNot(Equal(""))
Expect(cmd.Options().State).To(Equal("bm.state.new"))
})
})
Describe("#Validate", func() {
It("validates a good UpdateStateCommand", func() {
validate, err := cmd.Validate()
Expect(validate).To(BeTrue())
Expect(err).ToNot(HaveOccurred())
})
Context("when validating a bad UpdateStateCommand", func() {
示例6:
Describe("#Description", func() {
It("returns the description of a LoginCommand", func() {
Expect(cmd.Description()).To(Equal("Login to the Bare Metal Provision Server"))
})
})
Describe("#Usage", func() {
It("returns the usage text of a LoginCommand", func() {
Expect(cmd.Usage()).To(Equal("bmp login --username[-u] <username> --password[-p] <password>"))
})
})
Describe("#Options", func() {
It("returns the options of a LoginCommand", func() {
Expect(cmds.EqualOptions(cmd.Options(), options)).To(BeTrue())
Expect(cmd.Options().Username).ToNot(Equal(""))
Expect(cmd.Options().Username).To(Equal("fake-username"))
Expect(cmd.Options().Password).ToNot(Equal(""))
Expect(cmd.Options().Password).To(Equal("fake-password"))
})
})
Describe("#Validate", func() {
It("validates a good LoginCommand", func() {
validate, err := cmd.Validate()
Expect(validate).To(BeTrue())
Expect(err).ToNot(HaveOccurred())
})