mirror of
https://github.com/evennia/evennia.git
synced 2026-03-28 02:36:32 +01:00
Bypass no valid index iterable edge case
and slight refactor + comments
This commit is contained in:
parent
24cec94a6b
commit
134cc9bc8a
1 changed files with 7 additions and 7 deletions
|
|
@ -113,7 +113,7 @@ class MuxCommand(Command):
|
|||
self.account_caller = False
|
||||
|
||||
# split out switches
|
||||
switches = []
|
||||
switches, delimiters = [], self.rhs_split
|
||||
if args and len(args) > 1 and raw[0] == "/":
|
||||
# we have a switch, or a set of switches. These end with a space.
|
||||
switches = args[1:].split(None, 1)
|
||||
|
|
@ -150,14 +150,14 @@ class MuxCommand(Command):
|
|||
# check for arg1, arg2, ... = argA, argB, ... constructs
|
||||
lhs, rhs = args.strip(), None
|
||||
if lhs:
|
||||
if hasattr(self.rhs_split, '__iter__'): # If delimiter is iterable, try each
|
||||
best_split = self.rhs_split[0]
|
||||
for this_split in self.rhs_split:
|
||||
if this_split in lhs: # delimiter to allow first successful
|
||||
best_split = this_split # split to be the best split.
|
||||
if delimiters and hasattr(delimiters, '__iter__'): # If delimiter is iterable,
|
||||
best_split = delimiters[0] # (default to first delimiter)
|
||||
for this_split in delimiters: # try each delimiter
|
||||
if this_split in lhs: # to find first successful split
|
||||
best_split = this_split # to be the best split.
|
||||
break
|
||||
else:
|
||||
best_split = self.rhs_split
|
||||
best_split = delimiters
|
||||
# Parse to separate left into left/right sides using best_split delimiter string
|
||||
if best_split in lhs:
|
||||
lhs, rhs = lhs.split(best_split, 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue