Make scripts/objects lists use EvMore. Change EvMore to not justify by default.

This commit is contained in:
Griatch 2020-01-11 15:49:12 +01:00
parent b5aee2c41e
commit 69d85bd184
221 changed files with 2190 additions and 6810 deletions

View file

@ -71,18 +71,13 @@ def build_matches(raw_string, cmdset, include_prefixes=False):
for cmdname in [cmd.key] + cmd.aliases
if cmdname
and l_raw_string.startswith(cmdname.lower())
and (
not cmd.arg_regex
or cmd.arg_regex.match(l_raw_string[len(cmdname) :])
)
and (not cmd.arg_regex or cmd.arg_regex.match(l_raw_string[len(cmdname) :]))
]
)
else:
# strip prefixes set in settings
raw_string = (
raw_string.lstrip(_CMD_IGNORE_PREFIXES)
if len(raw_string) > 1
else raw_string
raw_string.lstrip(_CMD_IGNORE_PREFIXES) if len(raw_string) > 1 else raw_string
)
l_raw_string = raw_string.lower()
for cmd in cmdset:
@ -95,14 +90,9 @@ def build_matches(raw_string, cmdset, include_prefixes=False):
if (
cmdname
and l_raw_string.startswith(cmdname.lower())
and (
not cmd.arg_regex
or cmd.arg_regex.match(l_raw_string[len(cmdname) :])
)
and (not cmd.arg_regex or cmd.arg_regex.match(l_raw_string[len(cmdname) :]))
):
matches.append(
create_match(cmdname, raw_string, cmd, raw_cmdname)
)
matches.append(create_match(cmdname, raw_string, cmd, raw_cmdname))
except Exception:
log_trace("cmdhandler error. raw_input:%s" % raw_string)
return matches
@ -135,10 +125,7 @@ def try_num_prefixes(raw_string):
# the user might be trying to identify the command
# with a #num-command style syntax. We expect the regex to
# contain the groups "number" and "name".
mindex, new_raw_string = (
num_ref_match.group("number"),
num_ref_match.group("name"),
)
mindex, new_raw_string = (num_ref_match.group("number"), num_ref_match.group("name"))
return mindex, new_raw_string
else:
return None, None
@ -193,9 +180,7 @@ def cmdparser(raw_string, cmdset, caller, match_index=None):
if _CMD_IGNORE_PREFIXES:
# still no match. Try to strip prefixes
raw_string = (
raw_string.lstrip(_CMD_IGNORE_PREFIXES)
if len(raw_string) > 1
else raw_string
raw_string.lstrip(_CMD_IGNORE_PREFIXES) if len(raw_string) > 1 else raw_string
)
matches = build_matches(raw_string, cmdset, include_prefixes=False)