signal-cli/src/main/java/org/asamk/signal/commands/VersionCommand.java
AsamK a8bbdb54d0 Implement jsonRpc command
Co-authored-by: technillogue <technillogue@gmail.com>

Closes #668
2021-08-10 18:16:50 +02:00

24 lines
738 B
Java

package org.asamk.signal.commands;
import org.asamk.signal.BaseConfig;
import org.asamk.signal.JsonWriter;
import org.asamk.signal.OutputWriter;
import org.asamk.signal.commands.exceptions.CommandException;
import org.asamk.signal.manager.Manager;
import java.util.Map;
public class VersionCommand implements JsonRpcCommand<Void> {
private final OutputWriter outputWriter;
public VersionCommand(final OutputWriter outputWriter) {
this.outputWriter = outputWriter;
}
@Override
public void handleCommand(final Void request, final Manager m) throws CommandException {
final var jsonWriter = (JsonWriter) outputWriter;
jsonWriter.write(Map.of("version", BaseConfig.PROJECT_VERSION));
}
}