提交 94e8218b 作者: Brian Tiger Chow 提交者: Juan Batiz-Benet

add todo

上级 fcabf222
...@@ -29,6 +29,7 @@ type Option struct { ...@@ -29,6 +29,7 @@ type Option struct {
// constructor helper functions // constructor helper functions
func NewOption(kind reflect.Kind, names ...string) Option { func NewOption(kind reflect.Kind, names ...string) Option {
if len(names) < 2 { if len(names) < 2 {
// FIXME(btc) don't panic (fix_before_merge)
panic("Options require at least two string values (name and description)") panic("Options require at least two string values (name and description)")
} }
...@@ -42,6 +43,12 @@ func NewOption(kind reflect.Kind, names ...string) Option { ...@@ -42,6 +43,12 @@ func NewOption(kind reflect.Kind, names ...string) Option {
} }
} }
// TODO handle description separately. this will take care of the panic case in
// NewOption
// For all func {Type}Option(...string) functions, the last variadic argument
// is treated as the description field.
func BoolOption(names ...string) Option { func BoolOption(names ...string) Option {
return NewOption(Bool, names...) return NewOption(Bool, names...)
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论