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