Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement command (no arg) #4026

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -8253,6 +8253,12 @@ public Map<String, CommandInfo> commandInfo(String... commands) {
return CommandInfo.COMMAND_INFO_RESPONSE.build(connection.getOne());
}

public Map<String, CommandInfo> command() {
checkIsInMultiOrPipeline();
connection.sendCommand(COMMAND);
return CommandInfo.COMMAND_INFO_RESPONSE.build(connection.getOne());
}

public List<String> commandList() {
checkIsInMultiOrPipeline();
connection.sendCommand(COMMAND, LIST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,28 @@ public void commandGetKeys() {
assertEquals(2, keySandFlags.get(0).getValue().size());
}


@Test
public void commandNoArgs() {
Map<String, CommandInfo> 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<String, CommandInfo> infos = jedis.commandInfo("GET", "foo", "SET");
Expand Down
Loading