From afb07f65313dffde838f33975658683445c35a97 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 30 Sep 2019 16:33:21 +0100 Subject: [PATCH] only check arg number at all when not "$-" --- modules/commands/__init__.py | 9 ++++----- 1 file 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)