my_args = %[--switch val some other positional --sw2 val2]
i = Iter(my_args)
named = {}
positional = []
while i {
t = i.next()
m = t ~ Pfx('--')
if m {
named[m.after] = i.next()
} else {
positional.push(t)
}
}
echo(named)
echo(positional)
# Output:
# {switch=val, sw2=val2}
# ['some','other','positional']