A multivalued parameter that is followed by another required parameter is
limited to a single value unless prefaced with its switch, eg:
pts adduser A B C D
B, C and D are group names and A is a user name, despite the user name field
taking multiple values. In contrast in:
pts adduser -user A B -group C D
A and B are users and only C and D are groups.
Signed-off-by: David Howells <dhowells@redhat.com>
i = i + 1
if match[2][1] == "m":
- # All remaining arguments up to the next switch belong to this
- while i < len(args):
- if args[i][0] == "-" and not args[i][1:].isnumeric():
- break
- params.append(args[i])
- i = i + 1
- need_switch = True
+ # Multiple-value arguments that are not preceded by their
+ # switch are forced to be single-value if there's yet another
+ # required argument following.
+ if av < len(available_arguments) and available_arguments[av][2][0] == "r":
+ pass
+ else:
+ # All remaining arguments up to the next switch belong to this
+ while i < len(args):
+ if args[i][0] == "-" and not args[i][1:].isnumeric():
+ break
+ params.append(args[i])
+ i = i + 1
+ need_switch = True
else:
# Deal with tagged arguments