Permalink
Browse files

Rename option.options to option.Field.Tag

  • Loading branch information...
1 parent 0d778f1 commit 5b42bf560bc58bb8587d9e917aee88c82a5dd82b @jessevdk committed Dec 13, 2012
Showing with 10 additions and 10 deletions.
  1. +1 −1 group_private.go
  2. +1 −1 help.go
  3. +5 −5 ini.go
  4. +2 −2 option_private.go
  5. +1 −1 parser_private.go
View
2 group_private.go
@@ -13,7 +13,7 @@ func (g *Group) lookupByName(name string, ini bool) (*Option, string) {
if ini {
if ret := g.IniNames[name]; ret != nil {
- return ret, ret.options.Get("ini-name")
+ return ret, ret.Field.Tag.Get("ini-name")
}
if ret := g.Names[name]; ret != nil {
View
2 help.go
@@ -68,7 +68,7 @@ func (p *Parser) writeHelpOption(writer *bufio.Writer, option *Option, maxlen in
def := option.Default
if def == "" && !option.isBool() {
- def = convertToString(option.Value, option.options)
+ def = convertToString(option.Value, option.Field.Tag)
}
var desc string
View
10 ini.go
@@ -71,7 +71,7 @@ func writeIni(parser *Parser, writer io.Writer, options IniOptions) {
continue
}
- if len(option.options.Get("no-ini")) != 0 {
+ if len(option.Field.Tag.Get("no-ini")) != 0 {
continue
}
@@ -93,24 +93,24 @@ func writeIni(parser *Parser, writer io.Writer, options IniOptions) {
"%s = %s\n",
option.iniName(),
convertToString(val.Index(idx),
- option.options))
+ option.Field.Tag))
}
case reflect.Map:
for _, key := range val.MapKeys() {
fmt.Fprintf(writer,
"%s = %s:%s\n",
option.iniName(),
convertToString(key,
- option.options),
+ option.Field.Tag),
convertToString(val.MapIndex(key),
- option.options))
+ option.Field.Tag))
}
default:
fmt.Fprintf(writer,
"%s = %s\n",
option.iniName(),
convertToString(val,
- option.options))
+ option.Field.Tag))
}
}
})
View
4 option_private.go
@@ -38,7 +38,7 @@ func (option *Option) iniName() string {
return option.iniUsedName
}
- name := option.options.Get("ini-name")
+ name := option.Field.Tag.Get("ini-name")
if len(name) != 0 {
return name
@@ -58,7 +58,7 @@ func (option *Option) call(value *string) error {
val := reflect.New(tp)
val = reflect.Indirect(val)
- if err := convert(*value, val, option.options); err != nil {
+ if err := convert(*value, val, option.Field.Tag); err != nil {
return err
}
View
2 parser_private.go
@@ -137,7 +137,7 @@ func (p *Parser) parseIni(ini Ini) error {
continue
}
- if opt.options.Get("no-ini") != "" {
+ if opt.Field.Tag.Get("no-ini") != "" {
continue
}

0 comments on commit 5b42bf5

Please sign in to comment.