diff options
| author | 2019-09-30 16:33:21 +0100 | |
|---|---|---|
| committer | 2019-09-30 16:33:21 +0100 | |
| commit | afb07f65313dffde838f33975658683445c35a97 (patch) | |
| tree | 8fd5a259c8d0f2e69b14ea2f95ebd48cf36a48ff | |
| parent | first_word.lower() -> first_words[0].lower() (diff) | |
| signature | ||
only check arg number at all when not "$-"
| -rw-r--r-- | modules/commands/__init__.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/modules/commands/__init__.py b/modules/commands/__init__.py index 7c1d8ff5..0c8c54c5 100644 --- a/modules/commands/__init__.py +++ b/modules/commands/__init__.py @@ -69,15 +69,14 @@ class Module(ModuleManager.BaseModule): if match.group(1): index = int(match.group(1)) continuous = match.group(2) == "-" + if index >= len(args_split): + raise IndexError("Unknown alias arg index") else: - index = -1 + index = 0 continuous = True - if index >= len(args_split): - raise IndexError("Unknown alias arg index") - if continuous: - replace = " ".join(args_split[min(index, 0):]) + replace = " ".join(args_split[index:]) else: replace = args_split[index] s = s.replace(match.group(0), replace) |
