summaryrefslogtreecommitdiff
path: root/redis/commands/core.py
diff options
context:
space:
mode:
authordvora-h <67596500+dvora-h@users.noreply.github.com>2022-05-08 15:05:43 +0300
committerGitHub <noreply@github.com>2022-05-08 15:05:43 +0300
commit3a8802214a05fed4a0828b1f2965ac140e11ee32 (patch)
tree9a8dd1c3024af6d2ddfc99774034d96ed93f8259 /redis/commands/core.py
parent061d97abe21d3a8ce9738330cabf771dd05c8dc1 (diff)
downloadredis-py-3a8802214a05fed4a0828b1f2965ac140e11ee32.tar.gz
Add support for COMMAND LIST (#2149)
* Add support for COMMAND LIST * style change
Diffstat (limited to 'redis/commands/core.py')
-rw-r--r--redis/commands/core.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py
index 6526ef1..073161f 100644
--- a/redis/commands/core.py
+++ b/redis/commands/core.py
@@ -769,6 +769,34 @@ class ManagementCommands(CommandsProtocol):
def command_count(self, **kwargs) -> ResponseT:
return self.execute_command("COMMAND COUNT", **kwargs)
+ def command_list(
+ self,
+ module: Optional[str] = None,
+ category: Optional[str] = None,
+ pattern: Optional[str] = None,
+ ) -> ResponseT:
+ """
+ Return an array of the server's command names.
+ You can use one of the following filters:
+ ``module``: get the commands that belong to the module
+ ``category``: get the commands in the ACL category
+ ``pattern``: get the commands that match the given pattern
+
+ For more information see https://redis.io/commands/command-list/
+ """
+ pieces = []
+ if module is not None:
+ pieces.extend(["MODULE", module])
+ if category is not None:
+ pieces.extend(["ACLCAT", category])
+ if pattern is not None:
+ pieces.extend(["PATTERN", pattern])
+
+ if pieces:
+ pieces.insert(0, "FILTERBY")
+
+ return self.execute_command("COMMAND LIST", *pieces)
+
def command_getkeysandflags(self, *args: List[str]) -> List[Union[str, List[str]]]:
"""
Returns array of keys from a full Redis command and their usage flags.