Name

import_keyvalue_pairs — Import an argument list into the named array

Synopsis

::rivet::import_keyvalue_pairs ?arrayName? ?argsList?

Description

key-value pairs, like "-foo bar" are stored in the array ?arrayName?. In that case, the value "bar" would be stored in the element "foo"

If "--" appears or a key doesn't begin with "-", the rest of the arg list is stored in the special args element of the array.

Example:

::rivet::import_keyvalue_pairs keyvalue_map [list -a1 v1 -a2 v2 -a3 v3 -- 1 2 3 4 5]
parray keyvalue_map

keyvalue_map(a1)   = v1
keyvalue_map(a2)   = v2
keyvalue_map(a3)   = v3
keyvalue_map(args) = 1 2 3 4 5