aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/infini/router.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/infini/router.py b/src/infini/router.py
index 127f83be..c84e11a4 100644
--- a/src/infini/router.py
+++ b/src/infini/router.py
@@ -38,3 +38,17 @@ class Endswith(Router):
def match(self, input: str) -> bool:
input = input.strip()
return any([input.endswith(sign) for sign in self.signs])
+
+
+class Command(Router):
+ type: Literal["command"] = "command"
+ prefix: tuple = (".", "/")
+
+ def match(self, input: str) -> bool:
+ input = input.strip()
+ if input:
+ if input.startswith(self.prefix):
+ input = input[1:]
+ return any([input.startswith(sign) for sign in self.signs])
+
+ return False