Args is a convenience function that loads the next arguments (tokens on the same line) into an arbitrary number of strings pointed to in targets. If there are fewer tokens available than string pointers, the remaining strings will not be changed and false will be returned. If there were enough token
(targets ...*string)
| 189 | // and false will be returned. If there were enough tokens available |
| 190 | // to fill the arguments, then true will be returned. |
| 191 | func (d *Dispenser) Args(targets ...*string) bool { |
| 192 | enough := true |
| 193 | for i := 0; i < len(targets); i++ { |
| 194 | if !d.NextArg() { |
| 195 | enough = false |
| 196 | break |
| 197 | } |
| 198 | *targets[i] = d.Val() |
| 199 | } |
| 200 | return enough |
| 201 | } |
| 202 | |
| 203 | // RemainingArgs loads any more arguments (tokens on the same line) |
| 204 | // into a slice and returns them. Open curly brace tokens also indicate |