diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index fb2efd6460..04c8945993 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -8253,6 +8253,12 @@ public Map commandInfo(String... commands) { return CommandInfo.COMMAND_INFO_RESPONSE.build(connection.getOne()); } + public Map command() { + checkIsInMultiOrPipeline(); + connection.sendCommand(COMMAND); + return CommandInfo.COMMAND_INFO_RESPONSE.build(connection.getOne()); + } + public List commandList() { checkIsInMultiOrPipeline(); connection.sendCommand(COMMAND, LIST); diff --git a/src/test/java/redis/clients/jedis/commands/jedis/ControlCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/ControlCommandsTest.java index 4b67a295c7..d79eb2086f 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/ControlCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/ControlCommandsTest.java @@ -501,6 +501,28 @@ public void commandGetKeys() { assertEquals(2, keySandFlags.get(0).getValue().size()); } + + @Test + public void commandNoArgs() { + Map infos = jedis.command(); + + assertThat(infos.size(), greaterThan(0)); + + CommandInfo getInfo = infos.get("get"); + assertEquals(2, getInfo.getArity()); + assertEquals(2, getInfo.getFlags().size()); + assertEquals(1, getInfo.getFirstKey()); + assertEquals(1, getInfo.getLastKey()); + assertEquals(1, getInfo.getStep()); + + assertNull(infos.get("foo")); // non-existing command + + CommandInfo setInfo = infos.get("set"); + assertEquals(3, setInfo.getAclCategories().size()); + assertEquals(0, setInfo.getTips().size()); + assertEquals(0, setInfo.getSubcommands().size()); + } + @Test public void commandInfo() { Map infos = jedis.commandInfo("GET", "foo", "SET");