String maps configuration directive with the specified name to variable referenced by 'store' pointer. Configuration directive must be in form 'name arbitrary_string'. See Custom function for details about inheritGlobal, required and defaultVal.
(name string, inheritGlobal, required bool, defaultVal string, store *string)
| 377 | // See Custom function for details about inheritGlobal, required and |
| 378 | // defaultVal. |
| 379 | func (m *Map) String(name string, inheritGlobal, required bool, defaultVal string, store *string) { |
| 380 | m.Custom(name, inheritGlobal, required, func() (interface{}, error) { |
| 381 | return defaultVal, nil |
| 382 | }, func(_ *Map, node Node) (interface{}, error) { |
| 383 | if len(node.Args) != 1 { |
| 384 | return nil, NodeErr(node, "expected 1 argument") |
| 385 | } |
| 386 | if len(node.Children) != 0 { |
| 387 | return nil, NodeErr(node, "can't declare block here") |
| 388 | } |
| 389 | |
| 390 | return node.Args[0], nil |
| 391 | }, store) |
| 392 | } |
| 393 | |
| 394 | // Int maps configuration directive with the specified name to variable |
| 395 | // referenced by 'store' pointer. |