Пример #1
0
			fc.NewFloat64Flag("f", "f2", "setting new flag")
			fc.Parse("-f", "5.5")
			Ω(fc.IsSet("f")).To(BeTrue())
			Ω(fc.IsSet("f2")).To(BeTrue())
			Ω(fc.Float64("f")).To(Equal(5.5))
			Ω(fc.Float64("f2")).To(Equal(5.5))
		})
	})

	Describe("NewFloat64FlagWithDefault()", func() {
		It("init the flag context with a new Float64 flagset with default value", func() {
			fc.Parse()
			Ω(fc.IsSet("i")).To(BeFalse())
			Ω(fc.Float64("i")).To(Equal(float64(0)))

			fc.NewFloat64FlagWithDefault("i", "i2", "setting new flag", 5.5)
			fc.Parse()
			Ω(fc.IsSet("i")).To(BeTrue())
			Ω(fc.IsSet("i2")).To(BeTrue())
			Ω(fc.Float64("i")).To(Equal(5.5))
			Ω(fc.Float64("i2")).To(Equal(5.5))
		})
	})

	Describe("NewStringSliceFlag()", func() {
		It("init the flag context with a new StringSlice flagset", func() {
			fc.Parse("-s", "5", "-s", "6")
			Ω(fc.IsSet("s")).To(BeFalse())
			Ω(fc.StringSlice("s")).To(Equal([]string{}))

			fc.NewStringSliceFlag("s", "s2", "setting new StringSlice flag")