mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Align cli param names for recipient
This commit is contained in:
parent
ca52c01031
commit
95792be9bc
6 changed files with 17 additions and 15 deletions
|
@ -25,7 +25,7 @@ public class BlockCommand implements JsonRpcLocalCommand {
|
|||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.help("Block the given contacts or groups (no messages will be received)");
|
||||
subparser.addArgument("contact").help("Contact number").nargs("*");
|
||||
subparser.addArgument("recipient").help("Contact number").nargs("*");
|
||||
subparser.addArgument("-g", "--group-id", "--group").help("Group ID").nargs("*");
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class BlockCommand implements JsonRpcLocalCommand {
|
|||
public void handleCommand(
|
||||
final Namespace ns, final Manager m, final OutputWriter outputWriter
|
||||
) throws CommandException {
|
||||
final var contacts = ns.<String>getList("contact");
|
||||
final var contacts = ns.<String>getList("recipient");
|
||||
for (var contact : CommandUtil.getSingleRecipientIdentifiers(contacts, m.getUsername())) {
|
||||
try {
|
||||
m.setContactBlocked(contact, true);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class GetUserStatusCommand implements JsonRpcLocalCommand {
|
|||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.help("Check if the specified phone number/s have been registered");
|
||||
subparser.addArgument("number").help("Phone number").nargs("+");
|
||||
subparser.addArgument("recipient").help("Phone number").nargs("+");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,7 @@ public class GetUserStatusCommand implements JsonRpcLocalCommand {
|
|||
// Get a map of registration statuses
|
||||
Map<String, Pair<String, UUID>> registered;
|
||||
try {
|
||||
registered = m.areUsersRegistered(new HashSet<>(ns.getList("number")));
|
||||
registered = m.areUsersRegistered(new HashSet<>(ns.getList("recipient")));
|
||||
} catch (IOException e) {
|
||||
logger.debug("Failed to check registered users", e);
|
||||
throw new IOErrorException("Unable to check if users are registered");
|
||||
|
@ -69,7 +69,7 @@ public class GetUserStatusCommand implements JsonRpcLocalCommand {
|
|||
|
||||
private static final class JsonUserStatus {
|
||||
|
||||
public final String name;
|
||||
public final String recipient;
|
||||
|
||||
public final String number;
|
||||
|
||||
|
@ -77,8 +77,8 @@ public class GetUserStatusCommand implements JsonRpcLocalCommand {
|
|||
|
||||
public final boolean isRegistered;
|
||||
|
||||
public JsonUserStatus(String name, String number, String uuid, boolean isRegistered) {
|
||||
this.name = name;
|
||||
public JsonUserStatus(String recipient, String number, String uuid, boolean isRegistered) {
|
||||
this.recipient = recipient;
|
||||
this.number = number;
|
||||
this.uuid = uuid;
|
||||
this.isRegistered = isRegistered;
|
||||
|
|
|
@ -27,7 +27,9 @@ public class SendReceiptCommand implements JsonRpcLocalCommand {
|
|||
.type(long.class)
|
||||
.nargs("+")
|
||||
.help("Specify the timestamp of the messages for which a receipt should be sent.");
|
||||
subparser.addArgument("--type").help("Specify the receipt type.").choices("read", "viewed").setDefault("read");
|
||||
subparser.addArgument("--type")
|
||||
.help("Specify the receipt type (default is read receipt).")
|
||||
.choices("read", "viewed");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +43,7 @@ public class SendReceiptCommand implements JsonRpcLocalCommand {
|
|||
final var type = ns.getString("type");
|
||||
|
||||
try {
|
||||
if ("read".equals(type)) {
|
||||
if (type == null || "read".equals(type)) {
|
||||
m.sendReadReceipt(recipient, targetTimestamps);
|
||||
} else if ("viewed".equals(type)) {
|
||||
m.sendViewedReceipt(recipient, targetTimestamps);
|
||||
|
|
|
@ -24,7 +24,7 @@ public class TrustCommand implements JsonRpcLocalCommand {
|
|||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.help("Set the trust level of a given number.");
|
||||
subparser.addArgument("number").help("Specify the phone number, for which to set the trust.").required(true);
|
||||
subparser.addArgument("recipient").help("Specify the phone number, for which to set the trust.").required(true);
|
||||
var mutTrust = subparser.addMutuallyExclusiveGroup();
|
||||
mutTrust.addArgument("-a", "--trust-all-known-keys")
|
||||
.help("Trust all known keys of this user, only use this for testing.")
|
||||
|
@ -37,7 +37,7 @@ public class TrustCommand implements JsonRpcLocalCommand {
|
|||
public void handleCommand(
|
||||
final Namespace ns, final Manager m, final OutputWriter outputWriter
|
||||
) throws CommandException {
|
||||
var recipentString = ns.getString("number");
|
||||
var recipentString = ns.getString("recipient");
|
||||
var recipient = CommandUtil.getSingleRecipientIdentifier(recipentString, m.getUsername());
|
||||
if (ns.getBoolean("trust-all-known-keys")) {
|
||||
boolean res = m.trustIdentityAllKeys(recipient);
|
||||
|
|
|
@ -25,7 +25,7 @@ public class UnblockCommand implements JsonRpcLocalCommand {
|
|||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.help("Unblock the given contacts or groups (messages will be received again)");
|
||||
subparser.addArgument("contact").help("Contact number").nargs("*");
|
||||
subparser.addArgument("recipient").help("Contact number").nargs("*");
|
||||
subparser.addArgument("-g", "--group-id", "--group").help("Group ID").nargs("*");
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class UnblockCommand implements JsonRpcLocalCommand {
|
|||
public void handleCommand(
|
||||
final Namespace ns, final Manager m, final OutputWriter outputWriter
|
||||
) throws CommandException {
|
||||
for (var contactNumber : CommandUtil.getSingleRecipientIdentifiers(ns.getList("contact"), m.getUsername())) {
|
||||
for (var contactNumber : CommandUtil.getSingleRecipientIdentifiers(ns.getList("recipient"), m.getUsername())) {
|
||||
try {
|
||||
m.setContactBlocked(contactNumber, false);
|
||||
} catch (NotMasterDeviceException e) {
|
||||
|
|
|
@ -23,7 +23,7 @@ public class UpdateContactCommand implements JsonRpcLocalCommand {
|
|||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.help("Update the details of a given contact");
|
||||
subparser.addArgument("number").help("Contact number");
|
||||
subparser.addArgument("recipient").help("Contact number");
|
||||
subparser.addArgument("-n", "--name").help("New contact name");
|
||||
subparser.addArgument("-e", "--expiration").type(int.class).help("Set expiration time of messages (seconds)");
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class UpdateContactCommand implements JsonRpcLocalCommand {
|
|||
public void handleCommand(
|
||||
final Namespace ns, final Manager m, final OutputWriter outputWriter
|
||||
) throws CommandException {
|
||||
var recipientString = ns.getString("number");
|
||||
var recipientString = ns.getString("recipient");
|
||||
var recipient = CommandUtil.getSingleRecipientIdentifier(recipientString, m.getUsername());
|
||||
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue