コード例 #1
0
			fc.NewIntFlag("i", "i2", "setting new int flag")
			fc.Parse("-i", "5")
			Ω(fc.IsSet("i")).To(BeTrue())
			Ω(fc.IsSet("i2")).To(BeTrue())
			Ω(fc.Int("i")).To(Equal(5))
			Ω(fc.Int("i2")).To(Equal(5))
		})
	})

	Describe("NewIntFlagWithDefault()", func() {
		It("init the flag context with a new int flagset with default value", func() {
			fc.Parse("-i", "5")
			Ω(fc.IsSet("i")).To(BeFalse())
			Ω(fc.Int("i")).To(Equal(0))

			fc.NewIntFlagWithDefault("i", "i2", "setting new int flag", 10)
			fc.Parse()
			Ω(fc.IsSet("i")).To(BeTrue())
			Ω(fc.IsSet("i2")).To(BeTrue())
			Ω(fc.Int("i")).To(Equal(10))
			Ω(fc.Int("i2")).To(Equal(10))
		})
	})

	Describe("NewFloat64Flag()", func() {
		It("init the flag context with a new float64 flagset", func() {
			fc.Parse("-f", "5.5")
			Ω(fc.IsSet("f")).To(BeFalse())
			Ω(fc.Float64("f")).To(Equal(float64(0)))

			fc.NewFloat64Flag("f", "f2", "setting new flag")